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: Wed, 11 May 2011 00:15:00 -0000	[thread overview]
Message-ID: <201105110015.p4B0FPSB032445@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <m3hb92skvb.fsf@fleche.redhat.com> from "Tom Tromey" at May 10, 2011 08:14:48 AM

Tom Tromey wrote:

> Ulrich> I ran a test on Cell, and interestingly it turns out that while
> Ulrich> Cell mixed-architecture debugging appears to be OK, just plain
> Ulrich> ppc32 debugging on a ppc64 host is now broken.  When the
> Ulrich> (32-bit) address of a stack variable has its high bit set,
> Ulrich> dwarf2_evaluate_loc_desc_full now returns a value with a
> Ulrich> sign-extended 64-bit CORE_ADDR address (0xffffffff....).  This
> Ulrich> address later on causes a memory_error when accessed.
> 
> Can you send me your test case?
> I have a PPC64 gdb now; I built one on gcc40, on the GCC compile farm.

The specific test case I was looking at was one of the Cell test cases
(gdb.cell/bt.exp), which failed already in a PowerPC-only part.

However, you don't really need to look specifically into Cell tests;
with your patch applied, I'm seeing a whole bunch of test suite
regressions in an -m32 test on ppc64.

Typical errors look like:

#0  0x0fd65e40 in raise () from /home/uweigand/fsf/gdb-head-build-rhel5/gdb/testsuite/gdb.base/break-interp-BINprelinkNOdebugNOpieNO.d/libc.so.6^M
#1  0x0ffd16f4 in libfunc (action=Cannot access memory at address 0xfffae1c8^M
) at ../../../gdb-head/gdb/testsuite/gdb.base/break-interp-lib.c:33^M
#2  0x100016ac in main ()^M
(gdb) FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugNO: BINprelinkNOdebugNOpieNO: core: core main bt

Note the "Cannot access memory ..." because the address (internally,
not visible in the output) is sign-extended to 64-bit.

Likewise, a bunch of tests fail with

Could not insert hardware watchpoint 11.^M
Could not insert hardware breakpoints:^M
You may have requested too many hardware breakpoints/watchpoints.^M

which seems to be caused by attempting to set a hardware watchpoint
at an address that is sign-extended to 64-bit.

> Ulrich> B.t.w. your patch always performs an unsigned shift for
> Ulrich> DW_OP_shr, even on signed operands.  However, for DW_OP_shra,
> Ulrich> your patch respects the sign of the operands and might actually
> Ulrich> perform an unsigned shift (even though the opcode explicitly
> Ulrich> says "arithmetic right shift" ...)  This looks like another of
> Ulrich> those signed/unsigned inconsistencies with the proposal to me.
> 
> Yes.  My understanding is that for new-style typed values, DW_OP_shr and
> DW_OP_shra are actually the same -- the type indicates the operation to
> perform.  But, for old-style values, we must cast to unsigned for
> DW_OP_shr.

I see.  However, the code as implemented casts *all* signed values to
unsigned for DW_OP_shr, not just old-style values.  That's what got
me confused ...

> Ulrich> Looking into that, your code does run through value_as_address, but
> Ulrich> since the platform does not define gdbarch_integer_to_address, this
> Ulrich> falls through to unpack_long, and since the underlying type is a
> Ulrich> TYPE_CODE_INT and not a pointer type, this in turn now respects
> Ulrich> the TYPE_UNSIGNED flag and does a signed conversion ...
> 
> What if we add a cast to dwarf_expr_fetch_address, like the appended?
> I am not really sure whether this is ok.

Huh, interesting approach.  In a sense, that might be OK, since it mirrors
what we're doing in dwarf_expr_read_reg by calling address_from_register.
On the other hand, I'm not sure value_cast always does the right thing if
the size of a pointer type differs from the size of the DWARF address type ...

In any case, that patch does fix the regressions I'm seeing on PowerPC.


Another issue that just occurred to me: your patch creates possibly many
temporary struct value objects.  I'm wondering whether those ought to be
released from the value chain at some point ...


Bye,
Ulrich

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


  reply	other threads:[~2011-05-11  0:15 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 [this message]
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=201105110015.p4B0FPSB032445@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