aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace/elf.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-06-12 03:25:04 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-06-12 03:25:04 +0000
commitd1609a232616d0a85f2f7bd9ebf4dae4b11fd481 (patch)
tree9b4b2fbd658631dc5cb019d57ba0843423218b4b /libbacktrace/elf.c
parent1e7a4be3a1f37e9feb5b5b3a6a1f9a31d7a2cd7e (diff)
downloadgcc-d1609a232616d0a85f2f7bd9ebf4dae4b11fd481.zip
gcc-d1609a232616d0a85f2f7bd9ebf4dae4b11fd481.tar.gz
gcc-d1609a232616d0a85f2f7bd9ebf4dae4b11fd481.tar.bz2
elf.c (backtrace_initialize): Always set *fileline_fn.
* elf.c (backtrace_initialize): Always set *fileline_fn. * ttest.c: New file. * btest.c: Move support functions into testlib.c. Change calls to check to pass file name. * testlib.c: New file, copied from (part of) btest.c. * testlib.h: New file, declarations for testlib.c. * edtest.c: Use testlib.h and testlib.c. * configure.ac: Test for -pthread, set HAVE_PTHREAD conditional. * Makefile.am (btest_SOURCES): Add testlib.c. (edtest_SOURCES): Likewise. (CHECK_PROGRAMS): Add ttest if HAVE_PTHREAD. (ttest_SOURCES, ttest_CFLAGS, ttest_LDADD): Define. * configure, Makefile.in: Rebuild. From-SVN: r249111
Diffstat (limited to 'libbacktrace/elf.c')
-rw-r--r--libbacktrace/elf.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index 89ed42b..8e16971 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -962,18 +962,12 @@ backtrace_initialize (struct backtrace_state *state, int descriptor,
}
if (!state->threaded)
- {
- if (state->fileline_fn == NULL || state->fileline_fn == elf_nodebug)
- *fileline_fn = elf_fileline_fn;
- }
+ *fileline_fn = state->fileline_fn;
else
- {
- fileline current_fn;
+ *fileline_fn = backtrace_atomic_load_pointer (&state->fileline_fn);
- current_fn = backtrace_atomic_load_pointer (&state->fileline_fn);
- if (current_fn == NULL || current_fn == elf_nodebug)
- *fileline_fn = elf_fileline_fn;
- }
+ if (*fileline_fn == NULL || *fileline_fn == elf_nodebug)
+ *fileline_fn = elf_fileline_fn;
return 1;
}