On Wed, Jan 16, 2019 at 2:20 PM Tom de Vries <tdevr...@suse.de> wrote: > > On 16-01-19 17:34, Tom de Vries wrote: > > On 16-01-19 17:33, Tom de Vries wrote: > >> On 16-01-19 02:02, Ian Lance Taylor wrote: > >>> On Tue, Dec 11, 2018 at 2:14 AM Tom de Vries <tdevr...@suse.de> wrote: > >>>> > >>>> Add an altlink field to struct dwarf_data, and initialize it with the > >>>> pointer > >>>> to the struct dwarf_data for the .gnu_debugaltlink. > >>>> > >>>> 2018-11-11 Tom de Vries <tdevr...@suse.de> > >>>> > >>>> * dwarf.c (struct dwarf_data): Add altlink field. > >>>> (backtrace_dwarf_add): Add and handle fileline_entry and > >>>> fileline_altlink parameters. > >>>> * elf.c (elf_add): Add and handle fileline_entry parameter. Add > >>>> args to > >>>> backtrace_dwarf_add call. > >>>> (phdr_callback, backtrace_initialize): Add arguments to elf_add > >>>> calls. > >>>> * internal.h (backtrace_dwarf_add): Add fileline_entry and > >>>> fileline_altlink parameters. > >>>> * pecoff.c (coff_add): Add args to backtrace_dwarf_add call. > >>>> * xcoff.c (xcoff_add): Same. > >>> > >>> > >>>> @@ -2968,7 +2970,7 @@ build_dwarf_data (struct backtrace_state *state, > >>>> size_t dwarf_str_size, > >>>> int is_bigendian, > >>>> backtrace_error_callback error_callback, > >>>> - void *data) > >>>> + void *data, struct dwarf_data *altlink) > >>>> { > >>> > >>> error_callback and data should remain the last two parameters, as they > >>> are for many of the functions in this file. > >>> > >>> > >> > >> Done. > >> > >>>> @@ -3031,7 +3034,8 @@ backtrace_dwarf_add (struct backtrace_state > >>>> *state, > >>>> size_t dwarf_str_size, > >>>> int is_bigendian, > >>>> backtrace_error_callback error_callback, > >>>> - void *data, fileline *fileline_fn) > >>>> + void *data, fileline *fileline_fn, void > >>>> **fileline_entry, > >>>> + void *fileline_altlink) > >>> > >>> The new fileline_altlink parameter should come before error_callback, > >>> as it is not error_callback/data and is not a result parameter. > >>> > >> > >> Done. > >> > >>> What is fileline_entry for? > >> > >> There are two bits to this patch: > >> - add fileline_entry parameter to elf_add. This allows the callers of > >> elf_add access to the struct dwarf_data pointer corresponding to the > >> added elf. > >> - add an altlink field to struct dwarf_data, and initialize it with the > >> pointer to the struct dwarf_data for the .gnu_debugaltlink. > >> > >> I've split the patch up this way now, hoping it will make things clearer > >> and/or easier to review. > >> > >>> Why is it void**? > >> > >> It's really struct dwarf_data *, but struct dwarf_data is a type > >> declared in dwarf.c, so it's not known in other files. > >> > >> Thanks, > >> - Tom > >> > >> Here's the first part. > >> > > > > And here's the second part. > > Updated to use 'struct dwarf_data' instead of 'void'.
I think you need to explicitly add a standalone line struct dwarf_data; in internal.h before the declaration of backtrace_dwarf_add to avoid compiler warnings in some cases. (Like the declaration of backtrace_state in backtrace.h.) This is OK with that change. Thanks. Ian