public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Sasha Da Rocha Pinheiro <darochapinhe@wisc.edu>
To: Mark Wielaard <mark@klomp.org>
Cc: "elfutils-devel@sourceware.org" <elfutils-devel@sourceware.org>
Subject: Re: Dwarf_FDE (libdw)
Date: Mon, 17 Jul 2017 17:16:00 -0000	[thread overview]
Message-ID: <BN6PR06MB30904594E2F51A751CB51C23A6A00@BN6PR06MB3090.namprd06.prod.outlook.com> (raw)
In-Reply-To: <1500298136.14595.368.camel@klomp.org>

So you're saying that the augmentation data of a FDE is the augmentation data of its CIE?
https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html says differently.

The thing is I need to get catch blocks, and eh_frame is not exactly Dwarf format. That's why I need FDE augmentation data also.
Libdw doesn't do this, am I correct?
   
  
From: Mark Wielaard <mark@klomp.org>
Sent: Monday, July 17, 2017 8:28:56 AM
To: Sasha Da Rocha Pinheiro
Cc: elfutils-devel@sourceware.org
Subject: Re: Dwarf_FDE (libdw)
    
On Mon, 2017-07-17 at 04:12 +0000, Sasha Da Rocha Pinheiro wrote:
> So how do you get the augmentation data out of a Dwarf_Frame?

You don't. You can only get the actual information relevant for the
frame through the augmentation data from the Dwarf_Frame. Is there
information missing you need?

> Or how do you "simulate" the two next functions as libdwarf do?
> 
> dwarf_get_cie_augmentation_data
> dwarf_get_fde_augmentation_data

I don't know what those functions do precisely. But if you really want
to do something low level like get the CIE augmentation data you could
do it through dwarf_next_cfi and DWarf_CFI_entry:

Dwarf_CFI_Entry entry;
dwarf_next_cfi (e_ident, d, true|false, off, &next, &entry);

if (dwarf_cfi_cie_p (&entry))
  {
     cie_aug = entry.cie.augmentation_data;
     cie_aug_size = entry.cie.augmentation_data_size;
  }
else
  {
    Dwarf_Off off = entry.fde.CIE_pointer;
    dwarf_next_cfi (e_ident, d, true|false, off, &next, &entry);
    assert (dwarf_cfi_cie_p (&entry));
    cie_aug = entry.cie.augmentation_data;
    cie_aug_size = entry.cie.augmentation_data_size;
  }

Plus some error handling. If you then also want to get the FDE
augmentation data it is a bit more work since you'll have to decode the
FDE data yourself (based on the CIE augmentation data you now got).

But instead of trying to extract the exact encoding of the low level
data it is probably better to see how we can make all the information
you need available through Dwarf_Frames.

Cheers,

Mark
    

  reply	other threads:[~2017-07-17 17:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-15  1:01 Sasha Da Rocha Pinheiro
2017-07-15 21:30 ` Mark Wielaard
2017-07-17  4:13   ` Sasha Da Rocha Pinheiro
2017-07-17 13:29     ` Mark Wielaard
2017-07-17 17:16       ` Sasha Da Rocha Pinheiro [this message]
2017-07-17 17:48         ` Mark Wielaard
2017-07-17 17:53           ` Sasha Da Rocha Pinheiro
     [not found]           ` <BN6PR06MB30906C0218E8B06135F18B87A6A10@BN6PR06MB3090.namprd06.prod.outlook.com>
2017-07-21 19:39             ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN6PR06MB30904594E2F51A751CB51C23A6A00@BN6PR06MB3090.namprd06.prod.outlook.com \
    --to=darochapinhe@wisc.edu \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).