From: Elena Zannoni Date: Tue, 14 Mar 2000 17:01:05 +0000 (+0000) Subject: 2000-03-14 Elena Zannoni X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=751a959bb828352de7d12339268c363a0773af5f;p=binutils-gdb.git 2000-03-14 Elena Zannoni * eval.c (evaluate_subexp_with_coercion): Add call to check_typedef, to handle typedeffed vars correctly. * gdb.base/printcmds.c: Add typedeffed arrays. * gdb.base/printcmds.exp (test_print_typedef_arrays): New procedure to test arrays that are typedef'd. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3580442f8d7..cdfe0d5e6cf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2000-03-14 Elena Zannoni + + * eval.c (evaluate_subexp_with_coercion): Add call to + check_typedef, to handle typedeffed vars correctly. + Mon Mar 13 21:21:41 2000 Andrew Cagney * defs.h (STREQ, STRCMP, STREQN): Document that these macros are diff --git a/gdb/eval.c b/gdb/eval.c index d054ac7ffbd..5a86a3409ff 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1875,7 +1875,7 @@ evaluate_subexp_with_coercion (exp, pos, noside) val = locate_var_value (var, block_innermost_frame (exp->elts[pc + 1].block)); - return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (SYMBOL_TYPE (var))), + return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (check_typedef (SYMBOL_TYPE (var)))), val); } /* FALLTHROUGH */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 101cb6912e3..e4e51d0ed0f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2000-03-14 Elena Zannoni + + * gdb.base/printcmds.c: Add typedeffed arrays. + + * gdb.base/printcmds.exp (test_print_typedef_arrays): New + procedure to test arrays that are typedef'd. + 2000-03-13 James Ingham * lib/gdb.exp: Fix the gdbtk_start routine to correctly find all diff --git a/gdb/testsuite/gdb.base/printcmds.c b/gdb/testsuite/gdb.base/printcmds.c index 27080741a3b..f49c3ebf1b7 100644 --- a/gdb/testsuite/gdb.base/printcmds.c +++ b/gdb/testsuite/gdb.base/printcmds.c @@ -59,6 +59,12 @@ unsigned char ctable2[] = { /* Single and multidimensional arrays to test access and printing of array members. */ +typedef int ArrayInt [10]; +ArrayInt a1 = {2,4,6,8,10,12,14,16,18,20}; + +typedef char ArrayChar [5]; +ArrayChar a2 = {'a','b','c','d','\0'}; + int int1dim[12] = {0,1,2,3,4,5,6,7,8,9,10,11}; int int2dim[3][4] = {{0,1,2,3},{4,5,6,7},{8,9,10,11}}; int int3dim[2][3][2] = {{{0,1},{2,3},{4,5}},{{6,7},{8,9},{10,11}}}; @@ -97,5 +103,5 @@ int main () /* Prevent AIX linker from removing variables. */ return ctable1[0] + ctable2[0] + int1dim[0] + int2dim[0][0] + int3dim[0][0][0] + int4dim[0][0][0][0] + teststring[0] + - *parrays -> array1; + *parrays -> array1 + a1[0] + a2[0]; } diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 79c6bc68940..3ea3b90b262 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -552,6 +552,22 @@ proc test_print_int_arrays {} { " = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}" } +proc test_print_typedef_arrays {} { + global gdb_prompt + + gdb_test "set print elements 24" "" + + gdb_test "p a1" \ + " = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}" + gdb_test "p a1\[0\]" " = 2" + gdb_test "p a1\[9\]" " = 20" + + gdb_test "p a2" \ + " = \"abcd\"" + gdb_test "p a2\[0\]" " = 97 'a'" + gdb_test "p a2\[3\]" " = 100 'd'" +} + proc test_artificial_arrays {} { # Send \026@ instead of just @ in case the kill character is @. gdb_test "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2} @@ -691,6 +707,7 @@ if [set_lang_c] then { test_print_repeats_10 test_print_strings test_print_int_arrays + test_print_typedef_arrays test_artificial_arrays test_print_char_arrays # We used to do the runto main here.