From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: Eli Zaretskii <eliz@gnu.org>, gdb@sourceware.org
Subject: Re: Complex DWARF expressions
Date: Mon, 22 Sep 2014 06:17:00 -0000 [thread overview]
Message-ID: <20140922061654.GA15537@host2.jankratochvil.net> (raw)
In-Reply-To: <87a95sxkjr.fsf@codesourcery.com>
On Mon, 22 Sep 2014 07:59:20 +0200, Yao Qi wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Range 0x100aaf7-0x100ad4c: a complex DWARF expression:
> > 0: DW_OP_GNU_entry_value
> > 2: DW_OP_reg2 [$edx]
> > 3: DW_OP_stack_value
> >
> > "A variable in $edx" I understand, but what about the "complex DWARF
> > expression" parts? Is there any way a mere mortal such as myself can
> > decipher this to the effect of understanding in which register or at
> > what address can I look up the value, assuming that I know at which PC
> > address the program stopped?
> >
> > (Yes, I've looked at the DWARF Standard, but couldn't understand from
> > the description of these location descriptors how to convert them to
> > either a register or a memory address.)
>
> DW_OP_GNU_entry_value isn't in DWARF Standard and it is documented here
> http://www.dwarfstd.org/ShowIssue.php?issue=100909.1
>
> If I understand the doc above correctly, the entry above means if PC is
> within range 0x100aaf7-0x100ad4c, the value of new_width is the value of
> $edx at the moment entering this function. IOW, to get value of
> new_width, needs to unwind frame and read $edx.
But $edx at the caller would be usually callee-clobbered so one would not be
able to read the value. This is why the caller's call instruction is described
by:
<8><1663ca>: Abbrev Number: 24 (DW_TAG_GNU_call_site)
<1663cb> DW_AT_low_pc : 0x814d44f
<1663cf> DW_AT_abstract_origin: <0x15e7bc>
<9><1663d8>: Abbrev Number: 3 (DW_TAG_GNU_call_site_parameter)
<1663d9> DW_AT_location : 1 byte block: 52 (DW_OP_reg2 (edx))
<1663db> DW_AT_GNU_call_site_value: 1 byte block: 30 (DW_OP_lit0)
So one finds matching DW_TAG_GNU_call_site and then one finds
DW_TAG_GNU_call_site_parameter with matching DW_AT_location there.
These rules have to be applied recursively, as in many cases there is for
example:
<6><1669c2>: Abbrev Number: 3 (DW_TAG_GNU_call_site_parameter)
<1669c3> DW_AT_location : 1 byte block: 51 (DW_OP_reg1 (ecx))
<1669c5> DW_AT_GNU_call_site_value: 7 byte block: f3 1 51 a ff ff 1a (DW_OP_GNU_entry_value: (DW_OP_reg1 (ecx)); DW_OP_const2u: 65535; DW_OP_and)
Jan
next prev parent reply other threads:[~2014-09-22 6:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-21 19:33 Eli Zaretskii
2014-09-22 6:03 ` Yao Qi
2014-09-22 6:17 ` Jan Kratochvil [this message]
2014-09-22 18:21 ` Eli Zaretskii
2014-09-22 18:44 ` Jan Kratochvil
2014-09-22 19:06 ` Eli Zaretskii
2014-09-22 19:21 ` Jan Kratochvil
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=20140922061654.GA15537@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb@sourceware.org \
--cc=yao@codesourcery.com \
/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