diff options
author | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-23 23:32:13 +0000 |
---|---|---|
committer | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-23 23:32:13 +0000 |
commit | 47ca840875e13f7d2b0a43b48d9603f2641579e8 (patch) | |
tree | b44087841eaf6762c6bc6a3cf8ad284c54367930 /libgfortran | |
parent | f7e5bfa6980469650a5e8c5c111b262e8d79a749 (diff) | |
download | gcc-47ca840875e13f7d2b0a43b48d9603f2641579e8.tar.gz |
PR libfortran/68744
* runtime/backtrace.c: Include gthr.h.
(show_backtrace): Use __gthread_active_p() to determine whether threads
are active. Return if lbstate is NULL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232770 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/runtime/backtrace.c | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index c993191f371..4c7befa2128 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2016-01-23 John David Anglin <danglin@gcc.gnu.org> + + PR libfortran/68744 + * runtime/backtrace.c: Include gthr.h. + (show_backtrace): Use __gthread_active_p() to determine whether threads + are active. Return if lbstate is NULL. + 2016-01-15 Jakub Jelinek <jakub@redhat.com> * intrinsics/execute_command_line.c (set_cmdstat): Use "%s", msg diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c index a61363af2a6..5b8735d53f4 100644 --- a/libgfortran/runtime/backtrace.c +++ b/libgfortran/runtime/backtrace.c @@ -24,6 +24,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" +#include <gthr.h> + #include <string.h> #include <stdlib.h> #include <errno.h> @@ -137,7 +139,11 @@ show_backtrace (bool in_signal_handler) struct backtrace_state *lbstate; struct mystate state = { 0, false, in_signal_handler }; - lbstate = backtrace_create_state (NULL, 1, error_callback, NULL); + lbstate = backtrace_create_state (NULL, __gthread_active_p (), + error_callback, NULL); + + if (lbstate == NULL) + return; if (!BACKTRACE_SUPPORTED || (in_signal_handler && BACKTRACE_USES_MALLOC)) { |