[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  <tdevries@suse.de>

	* 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
This commit is contained in:
Tom de Vries 2019-01-17 00:07:43 +00:00 committed by Tom de Vries
parent e6f00c83f4
commit 9ad458d539
6 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2019-01-17 Tom de Vries <tdevries@suse.de>
* 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 <tdevries@suse.de>
* internal.h (backtrace_dwarf_add): Add fileline_entry parameter.

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;