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.