[COMMITTED] readelf: Fix crash on reading loc data or range data with bad/no CUs.

2018-01-25 Thread Mark Wielaard
In print_debug_ranges_section and print_debug_loc_section we try to get the associated CU through skip_listptr_hole for the first data data. If no CU at all can be found (because the .debug_info section was bogus) this would keep the Dwarf_CU uninitialized causing a crash later on when it was compa

[COMMITTED] tests: Check symtabshdr instead of symtabndx in elfstrmerge.c.

2018-01-25 Thread Mark Wielaard
Some gcc omptimization levels (-Og in particular) didn't see that when symtabndx != 0, then symtabshdr was certain to be initialized. Change the symtabndx == 0 check to symtabshdr == NULL and initialize symtabshdr to work around that. Signed-off-by: Mark Wielaard --- tests/ChangeLog | 11 +++

[PATCH] libdw: Add dwarf_die_addr_die function.

2018-01-25 Thread Mark Wielaard
Currently storing a lot of Dwarf_Dies might be inefficient since it costs a lot of memory since the sizeof (Dwarf_Die) == 32 bytes on 64bit arches. You can try storing just the Dwarf_Off from dwarf_dieoffset. Which is just 8 bytes. But then you have to keep track of whether to call dwarf_dieoffset,

Re: [PATCH] libdw: Resolve alt file on first use.

2018-01-25 Thread Mark Wielaard
On Mon, 2018-01-22 at 12:30 +0100, Mark Wielaard wrote: > +static void > +find_debug_altlink (Dwarf *dbg) > +{ > +  const char *altname; > +  const void *build_id; > +  ssize_t build_id_len = INTUSE(dwelf_dwarf_gnu_debugaltlink) (dbg, > > +    &