diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-17 19:29:43 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-04-17 19:29:43 +0000 |
commit | 9203b5842b219352fa6fad05f0b049b1bd8d46d0 (patch) | |
tree | d3fb473a7711c434fcc88643a7883a65379d4cf9 | |
parent | 8a4f544a2b08b7b4aa137c8a0e8ab606e78fab16 (diff) | |
download | gcc-9203b5842b219352fa6fad05f0b049b1bd8d46d0.tar.gz |
PR go/64999
PR go/65180
runtime: Adjust libbacktrace PC value to what runtime.Callers expects.
From Lynn Boger.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@222197 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libgo/runtime/go-callers.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c index 34a21188e3a..b5ab3be6473 100644 --- a/libgo/runtime/go-callers.c +++ b/libgo/runtime/go-callers.c @@ -83,7 +83,20 @@ callback (void *data, uintptr_t pc, const char *filename, int lineno, } loc = &arg->locbuf[arg->index]; - loc->pc = pc; + + /* On the call to backtrace_full the pc value was most likely + decremented if there was a normal call, since the pc referred to + the instruction where the call returned and not the call itself. + This was done so that the line number referred to the call + instruction. To make sure the actual pc from the call stack is + used, it is incremented here. + + In the case of a signal, the pc was not decremented by + backtrace_full but still incremented here. That doesn't really + hurt anything since the line number is right and the pc refers to + the same instruction. */ + + loc->pc = pc + 1; /* The libbacktrace library says that these strings might disappear, but with the current implementation they won't. We can't easily |