r266858 - in /branches/gcc-7-branch/libgfortran...
jb@gcc.gnu.org
jb@gcc.gnu.org
Thu Dec 6 15:38:00 GMT 2018
Author: jb
Date: Thu Dec 6 15:38:25 2018
New Revision: 266858
URL: https://gcc.gnu.org/viewcvs?rev=266858&root=gcc&view=rev
Log:
Initialize backtrace state once
>From backtrace.h for backtrace_create_state:
Calling this function allocates resources that can not be freed.
There is no backtrace_free_state function. The state is used to
cache information that is expensive to recompute. Programs are
expected to call this function at most once and to save the return
value for all later calls to backtrace functions.
So instead of calling backtrace_create_state every time we wish to
show a backtrace, do it once and store the result in a static
variable. libbacktrace allows multiple threads to access the state,
so no need to use TLS, but use atomic load/store to access the static
variable.
Regtested on x86_64-pc-linux-gnu.
libgfortran/ChangeLog:
2018-12-06 Janne Blomqvist <jb@gcc.gnu.org>
Backport from trunk
PR libfortran/88137
* runtime/backtrace.c (show_backtrace): Store backtrace state in a
static variable, initialize once.
Modified:
branches/gcc-7-branch/libgfortran/ChangeLog
branches/gcc-7-branch/libgfortran/runtime/backtrace.c
More information about the Gcc-cvs
mailing list