summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-13 13:56:14 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-13 13:56:14 +0000
commitbf43ea3130edad221adec10ff0f2af54a8654599 (patch)
tree1cfa435d5ce2396765fab16a6a0aa320fb7646dc /libgo
parent56fc16a1120d09971adb2fb2159cdf3d3871524e (diff)
downloadgcc-bf43ea3130edad221adec10ff0f2af54a8654599.tar.gz
PR go/52583
runtime: Stop backtrace at a few recognized functions. On x86_64 Solaris the makecontext function does not properly indicate that it is at the top of the stack. Attempting to unwind the stack past a call to makecontext tends to crash. This patch changes libgo to look for certain functions that are always found at the top of the stack, and to stop unwinding when it reaches one of those functions. There is never anything interesting past these functions--that is, there is never any code written by the user. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211640 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/runtime/go-callers.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c
index ae411d9c83a..213686933d9 100644
--- a/libgo/runtime/go-callers.c
+++ b/libgo/runtime/go-callers.c
@@ -93,6 +93,32 @@ callback (void *data, uintptr_t pc, const char *filename, int lineno,
loc->lineno = lineno;
++arg->index;
+
+ /* There is no point to tracing past certain runtime functions.
+ Stopping the backtrace here can avoid problems on systems that
+ don't provide proper unwind information for makecontext, such as
+ Solaris (http://gcc.gnu.org/PR52583 comment #21). */
+ if (function != NULL)
+ {
+ if (__builtin_strcmp (function, "makecontext") == 0)
+ return 1;
+ if (filename != NULL)
+ {
+ const char *p;
+
+ p = strrchr (filename, '/');
+ if (p == NULL)
+ p = filename;
+ if (__builtin_strcmp (p, "/proc.c") == 0)
+ {
+ if (__builtin_strcmp (function, "kickoff") == 0
+ || __builtin_strcmp (function, "runtime_mstart") == 0
+ || __builtin_strcmp (function, "runtime_main") == 0)
+ return 1;
+ }
+ }
+ }
+
return arg->index >= arg->max;
}