Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: tromey@redhat.com (Tom Tromey)
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: implement typed DWARF stack
Date: Thu, 12 May 2011 00:03:00 -0000	[thread overview]
Message-ID: <201105120003.p4C03V9u022585@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <m3ipthp9kr.fsf@fleche.redhat.com> from "Tom Tromey" at May 11, 2011 08:59:16 AM

Tom Tromey wrote:
> >>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:
> Ulrich> Huh, interesting approach.  In a sense, that might be OK, since
> Ulrich> it mirrors what we're doing in dwarf_expr_read_reg by calling
> Ulrich> address_from_register.  On the other hand, I'm not sure
> Ulrich> value_cast always does the right thing if the size of a pointer
> Ulrich> type differs from the size of the DWARF address type ...
> 
> I had not considered that as a possibility.  I think the most obviously
> safe thing to do is just revert dwarf_expr_fetch_address to (mostly)
> resemble its pre-patch state.  I will do that and test it.

Yes, I agree your latest version of dwarf_expr_fetch_address should
be obviously safe, that is, getting the same result as prior to the
change.  I've tested your patch on Cell/B.E. with no regressions
(using both -m32 and -m64 for the PowerPC side).

Another option that occurred to me in the meantime would be to ensure
that untyped "old-style" DWARF values are represented by an *unsigned*
type (either always, and converted to signed for operations that need
it, or else just converted to unsigned in dwarf_expr_fetch_address),
so that calling value_as_address will then do the right thing ...

> Ulrich> Another issue that just occurred to me: your patch creates
> Ulrich> possibly many temporary struct value objects.  I'm wondering
> Ulrich> whether those ought to be released from the value chain at some
> Ulrich> point ...
> 
> I considered this but talked myself out of it using the following
> reasoning:
> 
> 1. Most DWARF expressions are simple, so in practice not many values
>    will be released;
> 2. The unwinder code is value based but does not seem to call
>    value_free_to_mark, so it must not be significant there;

But it does call release_value; see frame.c:frame_register_unwind:

  /* Dispose of the new value.  This prevents watchpoints from
     trying to watch the saved frame pointer.  */
  release_value (value);
  value_free (value);

> 3. In other (expression-evaluation) contexts, some caller is going to
>    free the values anyway;
> 4. The watchpoint code looks at the value stack to determine what
>    intermediate values to watch, and perhaps the values from the DWARF
>    expression are relevant (though ... it occurs to me just now that
>    this approach must be pretty broken in the presence of location
>    lists).
> 
> I am actually not sure if #4 is an argument for or against.  Maybe those
> intermediate values confuse things; there is a comment in
> value_fetch_lazy indicating that this may be the case.

Yes, that is my concern -- that there could be intermediate values that
are *not* actually appropriate to watch ...


I noticed one more minor buglet in the latest patch:

@@ -576,7 +590,7 @@ read_pieced_value (struct value *v)
 	case DWARF_VALUE_REGISTER:
 	  {
 	    struct gdbarch *arch = get_frame_arch (frame);
-	    int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.value);
+	    int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.regno);
 	    int reg_offset = source_offset;
 
 	    if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
@@ -609,7 +623,7 @@ read_pieced_value (struct value *v)
 	    else
 	      {
 		error (_("Unable to access DWARF register number %s"),
-		       paddress (arch, p->v.value));
+		       paddress (arch, value_as_long (p->v.value)));

That should be p->v.regno here (and at another place a bit farther down).

Otherwise this looks good to me.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  parent reply	other threads:[~2011-05-12  0:03 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
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 [this message]
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=201105120003.p4C03V9u022585@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.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