I did not find the reference about the argument named next_cu_header_offset
(below I pasted the respective functions signatures).
Anyway, name orthography apart, what is being used in Dyninst with libdwarf is
exactly the value of what we called next_cu_off, which corresponds to the third
parameter of dwarf_nextcu(), named in libdw as next_off.
Do you have any other thoughts why the sequence of function calls is not
working, instead it is giving invalid dwarf?
// libdw
/* Read the header for the DWARF CU. */
extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
size_t *header_sizep, Dwarf_Off *abbrev_offsetp,
uint8_t *address_sizep, uint8_t *offset_sizep)
__nonnull_attribute__ (3);
// libdwarf
int
dwarf_next_cu_header_c(Dwarf_Debug dbg, Dwarf_Bool is_info, Dwarf_Unsigned
*cu_length,
Dwarf_Half *cu_version, Dwarf_Off *cu_abbrev_offset, Dwarf_Half
*cu_pointer_size,
Dwarf_Half *cu_offset_size, Dwarf_Half *cu_extension_size, Dwarf_Sig8
*type_signature,
Dwarf_Unsigned *type_offset, Dwarf_Unsigned *cu_next_offset,
Dwarf_Error *err);
De: Josh Stone <[email protected]>
Enviado: quinta-feira, 16 de março de 2017 19:29:12
Para: SASHA NICOLAS DA ROCHA PINHEIRO; [email protected]
Assunto: Re: Compilation Unit name
Stick to plain text, not HTML, if you want to reach the list.
On 03/16/2017 03:44 PM, SASHA NICOLAS DA ROCHA PINHEIRO wrote:
> I had that before, and it didn't work, then I empirically changed to
> next_cu_off because it contained the same offset I was supposed to get
> when I compared to the libdwarf execution.
What you have called cu_die_off is *not* a die offset! In libdwarf.h
that argument is called next_cu_header_offset, which is why it has the
same value as the next_cu_off you're getting from libdw.
> We already discarded the option of using dwarf_offdie_types since
> previously, with libdwarf, it was passed true to:
That's fine and correct. You shouldn't use dwarf_offdie_types now, I
was trying to preempt a future problem. Sorry for adding confusion.