Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(196)

Issue 167810044: code review 167810044: runtime: fix line number in first stack frame in printe... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 6 months ago by rsc
Modified:
9 years, 6 months ago
Reviewers:
r, iant
CC:
r, iant, golang-codereviews
Visibility:
Public.

Description

runtime: fix line number in first stack frame in printed stack trace Originally traceback was only used for printing the stack when an unexpected signal came in. In that case, the initial PC is taken from the signal and should be used unaltered. For the callers, the PC is the return address, which might be on the line after the call; we subtract 1 to get to the CALL instruction. Traceback is now used for a variety of things, and for almost all of those the initial PC is a return address, whether from getcallerpc, or gp->sched.pc, or gp->syscallpc. In those cases, we need to subtract 1 from this initial PC, but the traceback code had a hard rule "never subtract 1 from the initial PC", left over from the signal handling days. Change gentraceback to take a flag that specifies whether we are tracing a trap. Change traceback to default to "starting with a return PC", which is the overwhelmingly common case. Add tracebacktrap, like traceback but starting with a trap PC. Use tracebacktrap in signal handlers. Fixes issue 7690.

Patch Set 1 #

Patch Set 2 : diff -r 7fa57615d95007484b3dc70aff51739317ad429a https://code.google.com/p/go/ #

Patch Set 3 : diff -r 7fa57615d95007484b3dc70aff51739317ad429a https://code.google.com/p/go/ #

Patch Set 4 : diff -r 94c3ccfacd821df673743065940f88b0f49966e0 https://code.google.com/p/go/ #

Patch Set 5 : diff -r 47166db901fffb117d14cf42c75688d09589c13e https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -25 lines) Patch
M src/runtime/heapdump.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/mgc0.c View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/runtime/mprof.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/os_plan9_386.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/os_plan9_amd64.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/os_windows_386.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/os_windows_amd64.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/proc.c View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/runtime/runtime.h View 1 1 chunk +7 lines, -1 line 0 comments Download
M src/runtime/signal_386.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/signal_amd64x.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/signal_arm.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/stack.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/runtime/traceback.go View 1 4 chunks +24 lines, -9 lines 0 comments Download
A test/fixedbugs/issue7690.go View 1 2 1 chunk +49 lines, -0 lines 0 comments Download

Messages

Total messages: 5
rsc
Hello r (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
9 years, 6 months ago (2014-10-29 03:16:23 UTC) #1
rsc
Hello r, r@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
9 years, 6 months ago (2014-10-29 14:19:27 UTC) #2
iant
LGTM
9 years, 6 months ago (2014-10-29 15:28:31 UTC) #3
r
LGTM
9 years, 6 months ago (2014-10-29 16:29:52 UTC) #4
rsc
9 years, 6 months ago (2014-10-29 19:14:30 UTC) #5
*** Submitted as https://code.google.com/p/go/source/detail?r=001109d7b7af ***

runtime: fix line number in first stack frame in printed stack trace

Originally traceback was only used for printing the stack
when an unexpected signal came in. In that case, the
initial PC is taken from the signal and should be used
unaltered. For the callers, the PC is the return address,
which might be on the line after the call; we subtract 1
to get to the CALL instruction.

Traceback is now used for a variety of things, and for
almost all of those the initial PC is a return address,
whether from getcallerpc, or gp->sched.pc, or gp->syscallpc.
In those cases, we need to subtract 1 from this initial PC,
but the traceback code had a hard rule "never subtract 1
from the initial PC", left over from the signal handling days.

Change gentraceback to take a flag that specifies whether
we are tracing a trap.

Change traceback to default to "starting with a return PC",
which is the overwhelmingly common case.

Add tracebacktrap, like traceback but starting with a trap PC.

Use tracebacktrap in signal handlers.

Fixes issue 7690.

LGTM=iant, r
R=r, iant
CC=golang-codereviews
https://codereview.appspot.com/167810044
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b