This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA v2] valprint.c / *-valprint.c: Don't lose `embedded_offset'


On Monday 24 January 2011 13:22:42, Pedro Alves wrote:
> Compared to the previous patch, this fixes a bug in
> array repeat repetition handling, and adds a testcase
> to cover it.  

For the archive's and future hackers doing code archaeology 's benefit,
here's the description of the problem I had tripped on:

The original patch at
<http://sourceware.org/ml/gdb-patches/2010-10/msg00108.html>
missed references to `valaddr' in val_print_array_elements that
should have been updated to take embedded_offset into account.

(I completely missed them because I'd been working with a patch
on top that replaces the memcmp check in val_print_array_elements 
with some other function, and _that_ was taking the embedded_offset
into account.)

Surprisingly or not, the testsuite did not catch this, so
I've adding the new test that fails without the fix.

With the new test, and old patch, we'd print this:

(gdb) p /x some_struct 
$2 = {a = 0x12345678, b = 0x87654321, array = {0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 
0xaa, 0xaa, 0xaa, 0xaa <repeats 12 times>}}

while we should print:

(gdb) p/x some_struct 
$2 = {a = 0x12345678, b = 0x87654321, array = {0xaa <repeats 20 times>}}


Sorry for the spam.  I'm done now.  :-)

-- 
Pedro Alves


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