This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: Compilation Unit name
- From: Josh Stone <jistone at redhat dot com>
- To: SASHA NICOLAS DA ROCHA PINHEIRO <darochapinhe at wisc dot edu>, "elfutils-devel at sourceware dot org" <elfutils-devel at sourceware dot org>
- Date: Thu, 16 Mar 2017 15:06:38 -0700
- Subject: Re: Compilation Unit name
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jistone at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 81DD9804ED
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 81DD9804ED
- References: <BN3PR0601MB134557C258B4A3CCF22ABACDA6260@BN3PR0601MB1345.namprd06.prod.outlook.com>
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.