This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: Compilation Unit name
- From: SASHA NICOLAS DA ROCHA PINHEIRO <darochapinhe at wisc dot edu>
- To: Josh Stone <jistone at redhat dot com>, "elfutils-devel at sourceware dot org" <elfutils-devel at sourceware dot org>
- Date: Fri, 17 Mar 2017 16:07:12 +0000
- Subject: Re: Compilation Unit name
- Accept-language: pt-BR, en-US
- Authentication-results: sourceware.org; auth=none
- Authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=wisc.edu;
- References: <BN3PR0601MB134557C258B4A3CCF22ABACDA6260@BN3PR0601MB1345.namprd06.prod.outlook.com> <705c6c77-fd79-004a-c744-7b534f38e4ed@redhat.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
[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 <jistone@redhat.com>
Enviado: quinta-feira, 16 de março de 2017 17:06
Para: SASHA NICOLAS DA ROCHA PINHEIRO; elfutils-devel@sourceware.org
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.