aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace/elf.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2019-01-17 00:07:32 +0000
committerTom de Vries <vries@gcc.gnu.org>2019-01-17 00:07:32 +0000
commite6f00c83f4478e7e9174edf39219a6e0c1043c6c (patch)
treec45e23be50aa5e71905476e8df2e1ee1299a73ec /libbacktrace/elf.c
parenta34c2a3d19b096a97184253d1e1f225f13bd3a0f (diff)
downloadgcc-e6f00c83f4478e7e9174edf39219a6e0c1043c6c.zip
gcc-e6f00c83f4478e7e9174edf39219a6e0c1043c6c.tar.gz
gcc-e6f00c83f4478e7e9174edf39219a6e0c1043c6c.tar.bz2
[libbacktrace] Return struct dwarf_data pointer from elf_add
Allow the caller of elf_add access to the struct dwarf_data pointer corresponding to the added elf. 2019-01-17 Tom de Vries <tdevries@suse.de> * internal.h (backtrace_dwarf_add): Add fileline_entry parameter. * dwarf.c (backtrace_dwarf_add): Add and handle fileline_entry parameter. * elf.c (elf_add): Add and handle fileline_entry parameter. Add argument to backtrace_dwarf_add call. (phdr_callback, backtrace_initialize): Add argument to elf_add calls. * pecoff.c (coff_add): Add argument to backtrace_dwarf_add call. * xcoff.c (xcoff_add): Same. From-SVN: r267993
Diffstat (limited to 'libbacktrace/elf.c')
-rw-r--r--libbacktrace/elf.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index abe4cde..a863327 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -2638,8 +2638,8 @@ static int
elf_add (struct backtrace_state *state, const char *filename, int descriptor,
uintptr_t base_address, backtrace_error_callback error_callback,
void *data, fileline *fileline_fn, int *found_sym, int *found_dwarf,
- int exe, int debuginfo, const char *with_buildid_data,
- uint32_t with_buildid_size)
+ struct dwarf_data **fileline_entry, int exe, int debuginfo,
+ const char *with_buildid_data, uint32_t with_buildid_size)
{
struct backtrace_view ehdr_view;
b_elf_ehdr ehdr;
@@ -3042,7 +3042,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
backtrace_release_view (state, &debugaltlink_view, error_callback,
data);
ret = elf_add (state, NULL, d, base_address, error_callback, data,
- fileline_fn, found_sym, found_dwarf, 0, 1, NULL, 0);
+ fileline_fn, found_sym, found_dwarf, NULL, 0, 1, NULL,
+ 0);
if (ret < 0)
backtrace_close (d, error_callback, data);
else
@@ -3080,7 +3081,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
backtrace_release_view (state, &debugaltlink_view, error_callback,
data);
ret = elf_add (state, NULL, d, base_address, error_callback, data,
- fileline_fn, found_sym, found_dwarf, 0, 1, NULL, 0);
+ fileline_fn, found_sym, found_dwarf, NULL, 0, 1, NULL,
+ 0);
if (ret < 0)
backtrace_close (d, error_callback, data);
else
@@ -3106,8 +3108,9 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
int ret;
ret = elf_add (state, filename, d, base_address, error_callback, data,
- fileline_fn, found_sym, found_dwarf, 0, 1,
- debugaltlink_buildid_data, debugaltlink_buildid_size);
+ fileline_fn, found_sym, found_dwarf, NULL,
+ 0, 1, debugaltlink_buildid_data,
+ debugaltlink_buildid_size);
backtrace_release_view (state, &debugaltlink_view, error_callback,
data);
debugaltlink_view_valid = 0;
@@ -3262,7 +3265,8 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
sections[DEBUG_STR].data,
sections[DEBUG_STR].size,
ehdr.e_ident[EI_DATA] == ELFDATA2MSB,
- error_callback, data, fileline_fn))
+ error_callback, data, fileline_fn,
+ fileline_entry))
goto fail;
*found_dwarf = 1;
@@ -3352,7 +3356,7 @@ phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
if (elf_add (pd->state, filename, descriptor, info->dlpi_addr,
pd->error_callback, pd->data, &elf_fileline_fn, pd->found_sym,
- &found_dwarf, 0, 0, NULL, 0))
+ &found_dwarf, NULL, 0, 0, NULL, 0))
{
if (found_dwarf)
{
@@ -3380,7 +3384,8 @@ backtrace_initialize (struct backtrace_state *state, const char *filename,
struct phdr_data pd;
ret = elf_add (state, filename, descriptor, 0, error_callback, data,
- &elf_fileline_fn, &found_sym, &found_dwarf, 1, 0, NULL, 0);
+ &elf_fileline_fn, &found_sym, &found_dwarf, NULL, 1, 0, NULL,
+ 0);
if (!ret)
return 0;