From 91158a569dc571a9916dfad98c6c95ce789ad18d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 14 Jul 2010 14:13:55 +0000 Subject: [PATCH] =?utf8?q?2010-07-13=20=20Emmanuel=20Thom=C3=A9=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * c-valprint.c (c_val_print): Add embedded_offset to address in call to val_print_array_elements. 2010-07-13 Tom Tromey * gdb.python/py-prettyprint.c (struct arraystruct): New struct. (main): Use it. * gdb.python/py-prettyprint.exp (run_lang_tests): Add test. --- gdb/ChangeLog | 5 +++++ gdb/c-valprint.c | 3 ++- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.python/py-prettyprint.c | 11 +++++++++++ gdb/testsuite/gdb.python/py-prettyprint.exp | 2 ++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 36c94f9fe31..c1a31243310 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2010-07-13 Emmanuel Thomé + + * c-valprint.c (c_val_print): Add embedded_offset to address in + call to val_print_array_elements. + 2010-07-13 Tom Tromey * dwarf2read.c (dwarf2_read_index): Correctly set 'total_size'. diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 4e5a95fe062..f0895a4d9c1 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -222,7 +222,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, { i = 0; } - val_print_array_elements (type, valaddr + embedded_offset, address, stream, + val_print_array_elements (type, valaddr + embedded_offset, + address + embedded_offset, stream, recurse, original_value, options, i); fprintf_filtered (stream, "}"); } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 92fb577e7de..6b52dbbf340 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-07-13 Tom Tromey + + * gdb.python/py-prettyprint.c (struct arraystruct): New struct. + (main): Use it. + * gdb.python/py-prettyprint.exp (run_lang_tests): Add test. + 2010-07-13 Tom Tromey * gdb.base/label.exp: New file. diff --git a/gdb/testsuite/gdb.python/py-prettyprint.c b/gdb/testsuite/gdb.python/py-prettyprint.c index f461bb18452..66a90141f12 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.c +++ b/gdb/testsuite/gdb.python/py-prettyprint.c @@ -29,6 +29,12 @@ struct ss struct s b; }; +struct arraystruct +{ + int y; + struct s x[2]; +}; + struct ns { const char *null_str; int length; @@ -199,6 +205,7 @@ main () { struct ss ss; struct ss ssa[2]; + struct arraystruct arraystruct; string x = make_string ("this is x"); zzz_type c = make_container ("container"); zzz_type c2 = make_container ("container2"); @@ -214,6 +221,10 @@ main () init_ss(ssa+1, 5, 6); memset (&nullstr, 0, sizeof nullstr); + arraystruct.y = 7; + init_s (&arraystruct.x[0], 23); + init_s (&arraystruct.x[1], 24); + struct ns ns; ns.null_str = "embedded\0null\0string"; ns.length = 20; diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index f435fb76999..3b2aadd9602 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -76,6 +76,8 @@ proc run_lang_tests {lang} { gdb_test "print ssa\[1\]" " = a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>" gdb_test "print ssa" " = {a=< a=<3> b=<$hex>> b=< a=<4> b=<$hex>>, a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>}" + gdb_test "print arraystruct" " = {$nl *y = 7, *$nl *x = { a=<23> b=<$hex>, a=<24> b=<$hex>} *$nl *}" + if {$lang == "c++"} { gdb_test "print cps" "= a=<8> b=<$hex>" gdb_test "print cpss" " = {$nl *zss = 9, *$nl *s = a=<10> b=<$hex>$nl}" -- 2.30.2