diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-02-23 22:36:54 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-02-23 22:36:54 +0000 |
commit | 88a3ea34080ad3087a8191fbf479543153175d59 (patch) | |
tree | 34eaec34d3588e09f9a77abba776266f124dc823 /libgo/runtime/go-caller.c | |
parent | 25e15aaed275cdfef34b3ee6eb3cb4b43a48d44f (diff) | |
parent | e65055a558093bd4fc0b1b0024b7814cc187b8e8 (diff) | |
download | gccgo.tar.gz |
Merge from trunk revision 257954.gccgo
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gccgo@257955 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/go-caller.c')
-rw-r--r-- | libgo/runtime/go-caller.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libgo/runtime/go-caller.c b/libgo/runtime/go-caller.c index ee8abdc67fe..6b26ddccbcf 100644 --- a/libgo/runtime/go-caller.c +++ b/libgo/runtime/go-caller.c @@ -129,18 +129,26 @@ __go_get_backtrace_state () is the entry on the stack of inlined functions; -1 means the last one. */ -_Bool +static _Bool __go_file_line (uintptr pc, int index, String *fn, String *file, intgo *line) { struct caller c; + struct backtrace_state *state; runtime_memclr (&c, sizeof c); c.index = index; - backtrace_pcinfo (__go_get_backtrace_state (), pc, callback, - error_callback, &c); + state = __go_get_backtrace_state (); + backtrace_pcinfo (state, pc, callback, error_callback, &c); *fn = c.fn; *file = c.file; *line = c.line; + + // If backtrace_pcinfo didn't get the function name from the debug + // info, try to get it from the symbol table. + if (fn->len == 0) + backtrace_syminfo (state, pc, __go_syminfo_fnname_callback, + error_callback, fn); + return c.file.len > 0; } |