[no HTML]
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.
We already discarded the option of using dwarf_offdie_types since previously,
with libdwarf, it was passed true to:
dwarf_next_cu_header_c(dbg, Dwarf_Bool(true),
NULL,NULL,NULL,NULL,NULL,NULL,NULL,
&cu_die_off, NULL) == DW_DLV_OK )
and to:
int status = dwarf_siblingof_b(dbg, NULL, Dwarf_Bool(true), &cu_die, NULL);
De: Josh Stone <[email protected]>
Enviado: quinta-feira, 16 de março de 2017 17:06
Para: SASHA NICOLAS DA ROCHA PINHEIRO; [email protected]
Assunto: Re: Compilation Unit name
On 03/16/2017 03:03 PM, SASHA NICOLAS DA ROCHA PINHEIRO wrote:
> /* Iterate over the compilation-unit headers. */
> size_t cu_header_size;
> for(Dwarf_Off cu_off = 0, next_cu_off;
> dwarf_nextcu(dbg, cu_off, &next_cu_off, &cu_header_size,
> NULL, NULL, NULL) == 0;
> cu_off = next_cu_off)
> {
> cerr << "Error message:" << dwarf_errmsg(-1) << endl;
> Dwarf_Die cu_die, *cu_die_p;
> cu_die_p = dwarf_offdie(dbg, next_cu_off /*cu_die_off*/, &cu_die);
I don't understand why you're using next_cu_off here.
The die offset is cu_off + cu_header_size.
Also, when you get around to it, note there's a different
dwarf_offdie_types when you're parsing .debug_types.