From 48cd836f73a91f430cc8088d7be8159a08162f8c Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 22 Feb 2018 18:52:33 +0000 Subject: runtime: funcfileline: get missing function name from symbol table Copy the idea of https://golang.org/cl/92756 to funcfileline, which is used by runtime.FuncForPC, runtime.(*Frames).Next, and others. Reviewed-on: https://go-review.googlesource.com/96175 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257913 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-callers.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'libgo/runtime/go-callers.c') diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c index 590315376e3..b16ae0c4036 100644 --- a/libgo/runtime/go-callers.c +++ b/libgo/runtime/go-callers.c @@ -145,16 +145,17 @@ callback (void *data, uintptr_t pc, const char *filename, int lineno, /* Syminfo callback. */ -static void -syminfo_fnname_callback (void *data, uintptr_t pc __attribute__ ((unused)), - const char *symname, - uintptr_t address __attribute__ ((unused)), - uintptr_t size __attribute__ ((unused))) +void +__go_syminfo_fnname_callback (void *data, + uintptr_t pc __attribute__ ((unused)), + const char *symname, + uintptr_t address __attribute__ ((unused)), + uintptr_t size __attribute__ ((unused))) { - Location* locptr = (Location*) data; + String* strptr = (String*) data; if (symname != NULL) - locptr->function = runtime_gostringnocopy ((const byte *) symname); + *strptr = runtime_gostringnocopy ((const byte *) symname); } /* Error callback. */ @@ -228,8 +229,8 @@ runtime_callers (int32 skip, Location *locbuf, int32 m, bool keep_thunks) for (i = 0; i < data.index; ++i) { if (locbuf[i].function.len == 0 && locbuf[i].pc != 0) - backtrace_syminfo (state, locbuf[i].pc, syminfo_fnname_callback, - error_callback, &locbuf[i]); + backtrace_syminfo (state, locbuf[i].pc, __go_syminfo_fnname_callback, + error_callback, &locbuf[i].function); } return data.index; -- cgit v1.2.1