summaryrefslogtreecommitdiff
path: root/libgo/runtime/go-callers.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-04 17:57:29 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-04 17:57:29 +0000
commit48ff1d417d4c49525c09b013395e38dda8bd50fe (patch)
treeffb4ea05f14bc936b5dd3681e19b2aa3cee8c3bf /libgo/runtime/go-callers.c
parent144409bbbdb293946cea105115e0e329f633d333 (diff)
downloadgcc-48ff1d417d4c49525c09b013395e38dda8bd50fe.tar.gz
2014-01-04 Basile Starynkevitch <basile@starynkevitch.net>
{{merge using svnmerge.py with trunk GCC 4.9 svn rev206333 now in stage 3; very unstable, xtramelt-ana-base don't compile anymore...}} git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@206336 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/go-callers.c')
-rw-r--r--libgo/runtime/go-callers.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c
index 291dfd0d666..ae411d9c83a 100644
--- a/libgo/runtime/go-callers.c
+++ b/libgo/runtime/go-callers.c
@@ -11,6 +11,13 @@
#include "runtime.h"
#include "array.h"
+/* This is set to non-zero when calling backtrace_full. This is used
+ to avoid getting hanging on a recursive lock in dl_iterate_phdr on
+ older versions of glibc when a SIGPROF signal arrives while
+ collecting a backtrace. */
+
+uint32 runtime_in_callers;
+
/* Argument passed to callback function. */
struct callers_data
@@ -111,8 +118,10 @@ runtime_callers (int32 skip, Location *locbuf, int32 m)
data.skip = skip + 1;
data.index = 0;
data.max = m;
+ runtime_xadd (&runtime_in_callers, 1);
backtrace_full (__go_get_backtrace_state (), 0, callback, error_callback,
&data);
+ runtime_xadd (&runtime_in_callers, -1);
return data.index;
}