From: Tom Tromey <tromey@redhat.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: implement typed DWARF stack
Date: Thu, 05 May 2011 18:38:00 -0000 [thread overview]
Message-ID: <m339ktxab6.fsf@fleche.redhat.com> (raw)
In-Reply-To: <201105051807.p45I7F7C009704@d06av02.portsmouth.uk.ibm.com> (Ulrich Weigand's message of "Thu, 5 May 2011 20:07:15 +0200 (CEST)")
>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:
Tom> This patch converts the DWARF expression evaluator to use GDB's value
Tom> types. This approach made it easy to support floating point and also
Tom> decimal floating point; and also paves the way for any future
Tom> improvements.
Ulrich> Huh, so value_binop is back after I eliminated it :-)
Ulrich> http://sourceware.org/ml/gdb-patches/2010-06/msg00514.html
Yeah, I actually referred back to this while writing the patch :)
Ulrich> Due to the use of value_as_address in dwarf_expr_fetch_address, this
Ulrich> patch actually ought to still work on the SPU ... I'll do a test.
Thank you.
Tom> There is some ugliness involving signed and unsigned types; this arises
Tom> because "old-style" untyped DWARF values don't have a consistent type.
Tom> Also I needed a little bit of special code to handle logical right
Tom> shifts.
Ulrich> Yes, I'm wondering whether old-style values are handled correctly. We
Ulrich> used to make sure all arithmetic is performed in ctx->addr_size bits
Ulrich> (which is taken from the DWARF section headers). With your patch,
Ulrich> we now always use gdbarch_dwarf2_addr_size -- I'm not sure this is
Ulrich> always the same.
Good point; I am not sure either. Another option would be to use
ctx->addr_size to choose an arch type (e.g., builtin_uint32), and then
also carry along a flag indicating whether the value is "untyped".
I think this is needed because these untyped values must be treated
differently in a couple spots :-(
Yet another idea would be to lazily instantiate these special-to-DWARF
types and make struct dwarf_gdbarch_types a little bigger. I think I
like this idea the best. I think in practice we only need to support 3
such types (and if we run into more in the wild we can easily add them).
Ulrich> Also, what is the reason for handling the conversion to unsigned so
Ulrich> differently in the DW_OP_mod vs. DW_OP_shr cases?
There's no reason, I will clean this up.
Ulrich> [ In fact, maybe we don't need the whole value_cast business and
Ulrich> we could just operate on ULONGEST without involving value_binop,
Ulrich> since both cases only support integers anyway ... ]
I agree, for DW_OP_shr. I will do that. Unfortunately I think
DW_OP_mod still needs special magic.
Ulrich> I'd rather see a dwarf_expr_push_address to keep the
Ulrich> address-type abstraction local to dwarf2expr.c ...
Will do.
Ulrich> Does DW_OP_bra really require an integral type on the stack?
Ulrich> The standard wording isn't 100% clear to me here ...
A couple of oddities were clarified in this thread:
http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00333.html
There, Cary said that DW_OP_bra should require an integral type and this
was just an oversight in the spec.
Ulrich> I guess a non_lval value would still seem cleaner here (just as done
Ulrich> below for DW_OP_GNU_reinterpret --- maybe this could be abstracted
Ulrich> into a new value_from_contents helper).
Will do.
Tom> @@ -182,7 +189,7 @@ struct dwarf_expr_piece
Tom>
Tom> /* The piece's register number or literal value, for
Tom> DWARF_VALUE_REGISTER or DWARF_VALUE_STACK pieces. */
Tom> - ULONGEST value;
Tom> + struct value *value;
Ulrich> Maybe now it would be cleaner to split this into two union members,
Ulrich> a plain "int regnum" for DWARF_VALUE_REGISTER, and the struct value
Ulrich> for DWARF_VALUE_STACK ...
That does seem better, I will do that too.
Ulrich> Otherwise this looks good to me.
Thanks very much for the review. I'll post a new patch when I've made
the needed changes.
Tom
next prev parent reply other threads:[~2011-05-05 18:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 20:48 Tom Tromey
2011-05-05 16:47 ` Tom Tromey
2011-05-05 18:07 ` Ulrich Weigand
2011-05-05 18:38 ` Tom Tromey [this message]
2011-05-05 20:15 ` Tom Tromey
2011-05-09 22:02 ` Ulrich Weigand
2011-05-10 14:15 ` Tom Tromey
2011-05-11 0:15 ` Ulrich Weigand
2011-05-11 14:59 ` Tom Tromey
2011-05-11 19:44 ` Tom Tromey
2011-05-12 0:03 ` Ulrich Weigand
2011-05-12 16:33 ` Tom Tromey
2011-05-13 7:52 ` Regression: " Jan Kratochvil
2011-05-13 15:44 ` Tom Tromey
2011-05-15 8:26 ` gdbindex crash: " Jan Kratochvil
2011-05-16 17:37 ` Tom Tromey
2011-05-17 17:01 ` Tom Tromey
2011-05-13 17:17 ` Tom Tromey
2011-05-13 17:34 ` Jan Kratochvil
2011-05-12 19:32 ` Tom Tromey
2011-05-16 15:50 ` Ulrich Weigand
2011-05-16 18:09 ` Tom Tromey
2011-05-17 8:35 ` Jakub Jelinek
2011-06-03 13:52 ` Tom Tromey
2011-05-10 16:39 ` Tom Tromey
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=m339ktxab6.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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