mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
[libbacktrace] Declare external backtrace fns noinline
The backtrace functions backtrace_full, backtrace_print and backtrace_simple walk the call stack, but make sure to skip the first entry, in order to skip over the functions themselves, and start the backtrace at the caller of the functions. When compiling with -flto, the functions may be inlined, causing them to skip over the caller instead. Fix this by declaring the functions with __attribute__((noinline)). 2019-02-08 Tom de Vries <tdevries@suse.de> * backtrace.c (backtrace_full): Declare with __attribute__((noinline)). * print.c (backtrace_print): Same. * simple.c (backtrace_simple): Same. From-SVN: r268668
This commit is contained in:
parent
2536d696a3
commit
4af50e13a0
@ -1,3 +1,9 @@
|
||||
2019-02-08 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* backtrace.c (backtrace_full): Declare with __attribute__((noinline)).
|
||||
* print.c (backtrace_print): Same.
|
||||
* simple.c (backtrace_simple): Same.
|
||||
|
||||
2019-02-08 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
PR libbacktrace/78063
|
||||
|
@ -98,7 +98,7 @@ unwind (struct _Unwind_Context *context, void *vdata)
|
||||
|
||||
/* Get a stack backtrace. */
|
||||
|
||||
int
|
||||
int __attribute__((noinline))
|
||||
backtrace_full (struct backtrace_state *state, int skip,
|
||||
backtrace_full_callback callback,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
|
@ -80,7 +80,7 @@ error_callback (void *data, const char *msg, int errnum)
|
||||
|
||||
/* Print a backtrace. */
|
||||
|
||||
void
|
||||
void __attribute__((noinline))
|
||||
backtrace_print (struct backtrace_state *state, int skip, FILE *f)
|
||||
{
|
||||
struct print_data data;
|
||||
|
@ -90,7 +90,7 @@ simple_unwind (struct _Unwind_Context *context, void *vdata)
|
||||
|
||||
/* Get a simple stack backtrace. */
|
||||
|
||||
int
|
||||
int __attribute__((noinline))
|
||||
backtrace_simple (struct backtrace_state *state, int skip,
|
||||
backtrace_simple_callback callback,
|
||||
backtrace_error_callback error_callback, void *data)
|
||||
|
Loading…
Reference in New Issue
Block a user