aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace/elf.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2019-01-29 16:25:46 +0000
committerTom de Vries <vries@gcc.gnu.org>2019-01-29 16:25:46 +0000
commitfddbc19325a3e93a5f72668baa4e4bdeea9ebc7f (patch)
tree080a4c5201ecf818750ce6e5e53ed87a00a4bc75 /libbacktrace/elf.c
parent7e574f68fa82e7c5f879fd468291ec8b5ebecc83 (diff)
downloadgcc-fddbc19325a3e93a5f72668baa4e4bdeea9ebc7f.zip
gcc-fddbc19325a3e93a5f72668baa4e4bdeea9ebc7f.tar.gz
gcc-fddbc19325a3e93a5f72668baa4e4bdeea9ebc7f.tar.bz2
[libbacktrace] Add test-cases exercising build-id and dwz
Add test-cases b2test_buildid and b3test_dwz_buildid. The last one triggers the segfault fixed by "[backtrace] Avoid segfault" ( r268275 ). 2019-01-29 Tom de Vries <tdevries@suse.de> * install-debuginfo-for-buildid.sh.in: New script. * Makefile.am (check_PROGRAMS): Add b2test and b3test. (TESTS): Add b2test_buildid and b3test_dwz_buildid. * Makefile.in: Regenerate. * configure.ac (HAVE_ELF): Set with AM_CONDITIONAL. (READELF): Set with AC_CHECK_PROG. (install-debuginfo-for-buildid.sh): Generate with AC_CONFIG_FILES. * configure: Regenerate. * elf.c (SYSTEM_BUILD_ID_DIR): Factor out of ... (elf_open_debugfile_by_buildid): ... here. From-SVN: r268369
Diffstat (limited to 'libbacktrace/elf.c')
-rw-r--r--libbacktrace/elf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index 6fee865..d933052 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -809,6 +809,8 @@ elf_readlink (struct backtrace_state *state, const char *filename,
}
}
+#define SYSTEM_BUILD_ID_DIR "/usr/lib/debug/.build-id/"
+
/* Open a separate debug info file, using the build ID to find it.
Returns an open file descriptor, or -1.
@@ -821,7 +823,7 @@ elf_open_debugfile_by_buildid (struct backtrace_state *state,
backtrace_error_callback error_callback,
void *data)
{
- const char * const prefix = "/usr/lib/debug/.build-id/";
+ const char * const prefix = SYSTEM_BUILD_ID_DIR;
const size_t prefix_len = strlen (prefix);
const char * const suffix = ".debug";
const size_t suffix_len = strlen (suffix);