diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-09-16 17:03:52 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-09-16 17:04:43 -0700 |
commit | 90c254565122fa5c02114698ce35ac46679c03b0 (patch) | |
tree | c893c6c0c0e87f702441fd7d31f57e522083aa22 /libbacktrace/mtest.c | |
parent | fd111c419d146ee47c7df9a36a535e8d843d4802 (diff) | |
download | gcc-90c254565122fa5c02114698ce35ac46679c03b0.zip gcc-90c254565122fa5c02114698ce35ac46679c03b0.tar.gz gcc-90c254565122fa5c02114698ce35ac46679c03b0.tar.bz2 |
libbacktrace: use ELF symbol table if no debug info available
PR libbacktrace/97080
* fileline.c (backtrace_syminfo_to_full_callback): New function.
(backtrace_syminfo_to_full_error_callback): New function.
* elf.c (elf_nodebug): Call syminfo_fn if possible.
* internal.h (struct backtrace_call_full): Define.
(backtrace_syminfo_to_full_callback): Declare.
(backtrace_syminfo_to_full_error_callback): Declare.
* mtest.c (f3): Only check all[i] if data.index permits.
Diffstat (limited to 'libbacktrace/mtest.c')
-rw-r--r-- | libbacktrace/mtest.c | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/libbacktrace/mtest.c b/libbacktrace/mtest.c index d90fd1e..d73c98d 100644 --- a/libbacktrace/mtest.c +++ b/libbacktrace/mtest.c @@ -156,40 +156,49 @@ f3 (int f1line __attribute__ ((unused)), int f2line __attribute__ ((unused))) } } - if (all[0].function == NULL) + if (data.index > 0) { - fprintf (stderr, "test1: [0]: missing function name\n"); - data.failed = 1; - } - else if (strcmp (all[0].function, "f3") != 0) - { - fprintf (stderr, "test1: [0]: got %s expected %s\n", - all[0].function, "f3"); - data.failed = 1; + if (all[0].function == NULL) + { + fprintf (stderr, "test1: [0]: missing function name\n"); + data.failed = 1; + } + else if (strcmp (all[0].function, "f3") != 0) + { + fprintf (stderr, "test1: [0]: got %s expected %s\n", + all[0].function, "f3"); + data.failed = 1; + } } - if (all[1].function == NULL) - { - fprintf (stderr, "test1: [1]: missing function name\n"); - data.failed = 1; - } - else if (strcmp (all[1].function, "f2") != 0) + if (data.index > 1) { - fprintf (stderr, "test1: [1]: got %s expected %s\n", - all[0].function, "f2"); - data.failed = 1; + if (all[1].function == NULL) + { + fprintf (stderr, "test1: [1]: missing function name\n"); + data.failed = 1; + } + else if (strcmp (all[1].function, "f2") != 0) + { + fprintf (stderr, "test1: [1]: got %s expected %s\n", + all[0].function, "f2"); + data.failed = 1; + } } - if (all[2].function == NULL) - { - fprintf (stderr, "test1: [2]: missing function name\n"); - data.failed = 1; - } - else if (strcmp (all[2].function, "test1") != 0) + if (data.index > 2) { - fprintf (stderr, "test1: [2]: got %s expected %s\n", - all[0].function, "test1"); - data.failed = 1; + if (all[2].function == NULL) + { + fprintf (stderr, "test1: [2]: missing function name\n"); + data.failed = 1; + } + else if (strcmp (all[2].function, "test1") != 0) + { + fprintf (stderr, "test1: [2]: got %s expected %s\n", + all[0].function, "test1"); + data.failed = 1; + } } printf ("%s: backtrace_full noinline\n", data.failed ? "FAIL" : "PASS"); |