public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Sasha Da Rocha Pinheiro <darochapinhe@wisc.edu>,
		"elfutils-devel@sourceware.org"	 <elfutils-devel@sourceware.org>
Subject: Re: dwarf_begin_elf() won't create handle without .debug_* sections
Date: Fri, 01 Jun 2018 11:10:00 -0000	[thread overview]
Message-ID: <1527851437.12946.35.camel@klomp.org> (raw)
In-Reply-To: <BN6PR06MB293237A6F4E88363011B1EF4A66C0@BN6PR06MB2932.namprd06.prod.outlook.com>

On Wed, 2018-05-30 at 17:32 +0000, Sasha Da Rocha Pinheiro wrote:
> I just fixed something interesting in Dyninst. We were assuming that
> the FDEs were following the CIE in the eh_frame section, but this is
> not correct. I found them mixed in an ARM binary and this caused
> wrong parsing. 
> So we I did dwarf_next_cfi() in the loop to go through the FDE's, and
> I had to use it again in the loop to get the corresponding CIE. I
> don't think it's a problem, just kinda not intuitive, for who wants
> to understand after me.

dwarf_next_cfi () is a very low level interface. Other cfi related
interfaces that work with a Dwarf_CFI handle (dwarf_getcfi () and
dwarf_getcfi_elf ()) and don't make any assumptions about the order. 

But they do build up a cache of all entries. In return for some extra
memory usage you can use them without caring about the order in which
they appear with dwarf_cfi_addrframe () by just giving an address you
are interested in and using dwarf_frame_info (), dwarf_frame_cfa () and
 dwarf_frame_register () to extract the information (which might be
less/different than what you would get from the "raw" Dwarf_CFI_Entry).

Cheers,

Mark

      reply	other threads:[~2018-06-01 11:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 20:09 Sasha Da Rocha Pinheiro
2018-05-24 16:28 ` Mark Wielaard
2018-05-30 17:32   ` Sasha Da Rocha Pinheiro
2018-06-01 11:10     ` Mark Wielaard [this message]

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=1527851437.12946.35.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=darochapinhe@wisc.edu \
    --cc=elfutils-devel@sourceware.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).