This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: bokenness of nested pretty printers
- From: "Paul Pluzhnikov" <ppluzhnikov at google dot com>
- To: "Tom Tromey" <tromey at redhat dot com>
- Cc: archer at sourceware dot org
- Date: Fri, 17 Oct 2008 11:51:02 -0700
- Subject: Re: bokenness of nested pretty printers
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1224269465; bh=us3xYFRp8ev9HmW4aMKACFVms1k=;h=DomainKey-Signature:Message-ID:Date:From:To:Subject:Cc: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-Disposition:References; b=b9Q44c9RfF+5MmD9UYWJLeoI9Mgm1pbIJ709QX8mEu2ksBCntrtBSxwZu5hwUaXK/KIs4uLa3Ka88n310cY5rg==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;b=thz2gjGbA7s79JaZTaUthzuO7YoT3XFLfnK31Exp8LyjRXDoN5d5E1hqp2KsizQLl0OFfs4+U/CQaJCZVq/PLQ==
- References: <20081016184635.E2BF03A6AF6@localhost> <m3iqrs73pm.fsf@fleche.redhat.com> <8ac60eac0810161333u54740f2exed4dafc72f67e6ab@mail.gmail.com> <m3y70n411c.fsf@fleche.redhat.com>
On Fri, Oct 17, 2008 at 9:52 AM, Tom Tromey <tromey@redhat.com> wrote:
> Paul> If 'offset' is really necessary, then I think VALUE_ADDRESS()
> Paul> or something similar ought to add 'offset' automatically.
>
> I pushed a change to this effect.
>
> It is hard to be 100% certain that this does not break something.
> However, it does make it through the test suite with no regressions,
Really?
I have many internal failures (Linux/x86_64) which I didn't see
before. For example:
FAIL: gdb.base/commands.exp: stray_arg0_test #1 (GDB internal error)
FAIL: gdb.base/commands.exp: stray_arg0_test #2 (GDB internal error)
FAIL: gdb.base/commands.exp: stray_arg0_test #4 (GDB internal error)
FAIL: gdb.base/find.exp: $_ (GDB internal error)
FAIL: gdb.base/find.exp: $numfound (GDB internal error)
FAIL: gdb.base/freebpcmd.exp: run program with breakpoint commands
(GDB internal error)
FAIL: gdb.base/gdbvars.exp: Print contents of new convenience variable
(GDB internal error)
All of the above seem to be related to this assert:
../../gdb/value.c:491: internal-error: value_address: Assertion
`value->lval != lval_internalvar && value->lval !=
lval_internalvar_component' failed.
> and it does fix your test case.
It doesn't fix the array test case (print ssa). Below is proposed
patch to fix that.
Thanks,
--
Paul Pluzhnikov
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 45bfe33..f49e5ab 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1117,6 +1117,7 @@ val_print_array_elements (struct type *type,
const gdb_byte *valaddr,
for (; i < len && things_printed < print_max; i++)
{
+ size_t elt_offset = i * eltlen;
if (i != 0)
{
if (prettyprint_arrays)
@@ -1136,7 +1137,7 @@ val_print_array_elements (struct type *type,
const gdb_byte *valaddr,
rep1 = i + 1;
reps = 1;
while ((rep1 < len) &&
- !memcmp (valaddr + i * eltlen, valaddr + rep1 * eltlen, eltlen))
+ !memcmp (valaddr + elt_offset, valaddr + rep1 * eltlen, eltlen))
{
++reps;
++rep1;
@@ -1144,7 +1145,8 @@ val_print_array_elements (struct type *type,
const gdb_byte *valaddr,
if (reps > repeat_count_threshold)
{
- val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
+ val_print (elttype, valaddr + elt_offset, 0,
+ address + elt_offset, stream, format,
deref_ref, recurse + 1, pretty, current_language);
annotate_elt_rep (reps);
fprintf_filtered (stream, " <repeats %u times>", reps);
@@ -1155,7 +1157,8 @@ val_print_array_elements (struct type *type,
const gdb_byte *valaddr,
}
else
{
- val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
+ val_print (elttype, valaddr + elt_offset, 0,
+ address + elt_offset, stream, format,
deref_ref, recurse + 1, pretty, current_language);
annotate_elt ();
things_printed++;