This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bokenness of nested pretty printers


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++;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]