From: Tom de Vries Date: Thu, 17 Jan 2019 00:07:43 +0000 (+0000) Subject: [libbacktrace] Add altlink field to struct dwarf_data X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ad458d5397ffccd419cdd4a00dd816a500ab018;p=gcc.git [libbacktrace] Add altlink field to struct dwarf_data Add an altlink field to struct dwarf_data, and initialize it with the pointer to the struct dwarf_data for the .gnu_debugaltlink. 2019-01-17 Tom de Vries * dwarf.c (struct dwarf_data): Add altlink field. (backtrace_dwarf_add): Add and handle fileline_altlink parameter. * elf.c (elf_add): Add argument to backtrace_dwarf_add call. (phdr_callback, backtrace_initialize): Add argument to elf_add calls. * internal.h (backtrace_dwarf_add): Add fileline_altlink parameter. * pecoff.c (coff_add): Add argument to backtrace_dwarf_add call. * xcoff.c (xcoff_add): Same. From-SVN: r267994 --- diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index f2d2954b1c6..dfb17f5905e 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,13 @@ +2019-01-17 Tom de Vries + + * dwarf.c (struct dwarf_data): Add altlink field. + (backtrace_dwarf_add): Add and handle fileline_altlink parameter. + * elf.c (elf_add): Add argument to backtrace_dwarf_add call. + (phdr_callback, backtrace_initialize): Add argument to elf_add calls. + * internal.h (backtrace_dwarf_add): Add fileline_altlink parameter. + * pecoff.c (coff_add): Add argument to backtrace_dwarf_add call. + * xcoff.c (xcoff_add): Same. + 2019-01-17 Tom de Vries * internal.h (backtrace_dwarf_add): Add fileline_entry parameter. diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c index 190c6fc131f..83cdb52ef26 100644 --- a/libbacktrace/dwarf.c +++ b/libbacktrace/dwarf.c @@ -343,6 +343,8 @@ struct dwarf_data { /* The data for the next file we know about. */ struct dwarf_data *next; + /* The data for .gnu_debugaltlink. */ + struct dwarf_data *altlink; /* The base address for this file. */ uintptr_t base_address; /* A sorted list of address ranges. */ @@ -3000,6 +3002,7 @@ build_dwarf_data (struct backtrace_state *state, const unsigned char *dwarf_str, size_t dwarf_str_size, int is_bigendian, + struct dwarf_data *altlink, backtrace_error_callback error_callback, void *data) { @@ -3028,6 +3031,7 @@ build_dwarf_data (struct backtrace_state *state, return NULL; fdata->next = NULL; + fdata->altlink = altlink; fdata->base_address = base_address; fdata->addrs = addrs; fdata->addrs_count = addrs_count; @@ -3063,6 +3067,7 @@ backtrace_dwarf_add (struct backtrace_state *state, const unsigned char *dwarf_str, size_t dwarf_str_size, int is_bigendian, + struct dwarf_data *fileline_altlink, backtrace_error_callback error_callback, void *data, fileline *fileline_fn, struct dwarf_data **fileline_entry) @@ -3073,7 +3078,7 @@ backtrace_dwarf_add (struct backtrace_state *state, dwarf_line, dwarf_line_size, dwarf_abbrev, dwarf_abbrev_size, dwarf_ranges, dwarf_ranges_size, dwarf_str, dwarf_str_size, is_bigendian, - error_callback, data); + fileline_altlink, error_callback, data); if (fdata == NULL) return 0; diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index a863327df10..87e7b0d361d 100644 --- a/libbacktrace/elf.c +++ b/libbacktrace/elf.c @@ -3097,6 +3097,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor, debuglink_view_valid = 0; } + struct dwarf_data *fileline_altlink = NULL; if (debugaltlink_name != NULL) { int d; @@ -3108,7 +3109,7 @@ 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, NULL, + fileline_fn, found_sym, found_dwarf, &fileline_altlink, 0, 1, debugaltlink_buildid_data, debugaltlink_buildid_size); backtrace_release_view (state, &debugaltlink_view, error_callback, @@ -3265,6 +3266,7 @@ 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, + fileline_altlink, error_callback, data, fileline_fn, fileline_entry)) goto fail; diff --git a/libbacktrace/internal.h b/libbacktrace/internal.h index d9ab401ce41..e8389779322 100644 --- a/libbacktrace/internal.h +++ b/libbacktrace/internal.h @@ -303,6 +303,7 @@ extern int backtrace_dwarf_add (struct backtrace_state *state, const unsigned char *dwarf_str, size_t dwarf_str_size, int is_bigendian, + struct dwarf_data *fileline_altlink, backtrace_error_callback error_callback, void *data, fileline *fileline_fn, struct dwarf_data **fileline_entry); diff --git a/libbacktrace/pecoff.c b/libbacktrace/pecoff.c index cd20cbe17a7..da1982fd3ca 100644 --- a/libbacktrace/pecoff.c +++ b/libbacktrace/pecoff.c @@ -867,6 +867,7 @@ coff_add (struct backtrace_state *state, int descriptor, sections[DEBUG_STR].data, sections[DEBUG_STR].size, 0, /* FIXME */ + NULL, error_callback, data, fileline_fn, NULL)) goto fail; diff --git a/libbacktrace/xcoff.c b/libbacktrace/xcoff.c index 095800b4f71..d50b5bc517e 100644 --- a/libbacktrace/xcoff.c +++ b/libbacktrace/xcoff.c @@ -1315,6 +1315,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset, dwsect[DWSECT_STR].data, dwsect[DWSECT_STR].size, 1, /* big endian */ + NULL, error_callback, data, fileline_fn, NULL)) goto fail;