From: Vladimir Prus Date: Sun, 1 Apr 2007 15:27:26 +0000 (+0000) Subject: * gdb.mi/mi-var-child.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a73bafbcaa287d25ca811a4bcc01e9bde25b82e9;p=binutils-gdb.git * gdb.mi/mi-var-child.c (do_children_tests): User char[2] instead of char so that automatic printing of pointers to char don't give unpredicable result. * gdb.mi/var-cmd.c (do_locals_test): Initialize local variables. * gdb.mi/mi-var-child.exp: Step to right line of do_children_tests. * gdb.mi/mi2-var-child.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Step to right line of do_locals_tests. (do_children_tests): User char[2] instead of char so that automatic printing of pointers to char don't give unpredicable result. * gdb.mi/mi2-var-cmd.exp: Likewise. * lib/mi-support.exp (mi_continue_to_line): Pass test name to mi_wait_for_stop. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d8fa9771096..30817301f29 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2007-04-01 Vladimir Prus + + * gdb.mi/mi-var-child.c + (do_children_tests): User char[2] instead of + char so that automatic printing of pointers to char + don't give unpredicable result. + * gdb.mi/var-cmd.c (do_locals_test): Initialize + local variables. + * gdb.mi/mi-var-child.exp: Step to right line + of do_children_tests. + * gdb.mi/mi2-var-child.exp: Likewise. + * gdb.mi/mi-var-cmd.exp: Step to right line of + do_locals_tests. + (do_children_tests): User char[2] instead of + char so that automatic printing of pointers to char + don't give unpredicable result. + * gdb.mi/mi2-var-cmd.exp: Likewise. + * lib/mi-support.exp (mi_continue_to_line): + Pass test name to mi_wait_for_stop. + 2007-03-30 Daniel Jacobowitz * gdb.asm/asm-source.exp: Remove d10v case. diff --git a/gdb/testsuite/gdb.mi/mi-var-child.c b/gdb/testsuite/gdb.mi/mi-var-child.c index f871cb75d1e..21151cdc616 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.c +++ b/gdb/testsuite/gdb.mi/mi-var-child.c @@ -199,9 +199,9 @@ do_children_tests (void) weird_struct *weird; struct _struct_n_pointer *psnp; struct _struct_n_pointer snp0, snp1, snp2; - char a0, *a1, **a2, ***a3; - char b0, *b1, **b2, ***b3; - char c0, *c1, **c2, ***c3; + char a0[2] = {}, *a1, **a2, ***a3; + char b0[2] = {}, *b1, **b2, ***b3; + char c0[2] = {}, *c1, **c2, ***c3; long z0, *z1, **z2, ***z3; long y0, *y1, **y2, ***y3; long x0, *x1, **x2, ***x3; @@ -233,16 +233,16 @@ do_children_tests (void) struct_declarations.long_array[11] = 5678; /* Struct/pointer/array tests */ - a0 = '0'; - a1 = &a0; + a0[0] = '0'; + a1 = a0; a2 = &a1; a3 = &a2; - b0 = '1'; - b1 = &b0; + b0[0] = '1'; + b1 = b0; b2 = &b1; b3 = &b2; - c0 = '2'; - c1 = &c0; + c0[1] = '2'; + c1 = c0; c2 = &c1; c3 = &c2; z0 = 0xdead + 0; diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 324179fe328..12f01d489a0 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -43,17 +43,16 @@ mi_gdb_load ${binfile} mi_runto do_children_tests +set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"] +mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test" + + ##### ##### # # # children tests # # # ##### ##### -# Step past the initialization of struct_declarations. -set line_weird [gdb_get_line_number "weird = &struct_declarations;"] -mi_execute_to "exec-next" "end-stepping-range" do_children_tests {} ".*${srcfile}" \ - [expr $line_weird] {} "step \$line_weird" - # Test: c_variable-4.2 # Desc: create variable "struct_declarations" mi_gdb_test "-var-create struct_declarations * struct_declarations" \ @@ -859,7 +858,7 @@ mi_gdb_test "-var-update --no-values *" \ "update all vars struct_declarations.long_array.10 changed, don't print values." # Step over "struct_declarations.long_array[11] = 5678"; -set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"] +set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"] mi_step_to do_children_tests {} ".*${srcfile}" \ $line_dct_a0_0 "step \$line_dct_a0_0" diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index c8b3c6462aa..80041c67be8 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -71,6 +71,11 @@ mi_gdb_test "113-var-create argc * argc" \ mi_runto do_locals_tests +set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"] + +mi_continue_to_line $line_dlt_first_real "step to real start of do_locals_test" + + # Test: c_variable-1.4 # Desc: create local variables diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp index 5ea9ab02a86..4f77e4087f4 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp @@ -42,6 +42,9 @@ mi_gdb_load ${binfile} mi_runto do_children_tests +set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"] +mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test" + ##### ##### # # # children tests # @@ -836,7 +839,7 @@ mi_gdb_test "-var-update *" \ # Step over "weird->func_ptr = nothing;" -set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"] +set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"] mi_step_to do_children_tests {} {.*var-cmd.c} \ $line_dct_a0_0 "step \$line_dct_a0_0" diff --git a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp index 11b65ceb434..8905e0ccf33 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp @@ -71,6 +71,11 @@ mi_gdb_test "113-var-create argc * argc" \ mi_runto do_locals_tests +set line_dlt_first_real [gdb_get_line_number "linteger = 1234;"] + +mi_continue_to_line $line_dlt_first_real "step to real start of do_locals_test" + + # Test: c_variable-1.4 # Desc: create local variables diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c index 9d74bc6a935..a61dc885e39 100644 --- a/gdb/testsuite/gdb.mi/var-cmd.c +++ b/gdb/testsuite/gdb.mi/var-cmd.c @@ -113,16 +113,16 @@ int *array_ptr = array; void do_locals_tests () { - int linteger; - int *lpinteger; - char lcharacter; - char *lpcharacter; - long llong; - long *lplong; - float lfloat; - float *lpfloat; - double ldouble; - double *lpdouble; + int linteger = 0; + int *lpinteger = 0; + char lcharacter = 0; + char *lpcharacter = 0; + long llong = 0; + long *lplong = 0; + float lfloat = 0; + float *lpfloat = 0; + double ldouble = 0; + double *lpdouble = 0; struct _simple_struct lsimple; struct _simple_struct *lpsimple; void (*func) (void); @@ -202,9 +202,9 @@ do_children_tests (void) weird_struct *weird; struct _struct_n_pointer *psnp; struct _struct_n_pointer snp0, snp1, snp2; - char a0, *a1, **a2, ***a3; - char b0, *b1, **b2, ***b3; - char c0, *c1, **c2, ***c3; + char a0[2] = {}, *a1, **a2, ***a3; + char b0[2] = {}, *b1, **b2, ***b3; + char c0[2] = {}, *c1, **c2, ***c3; long z0, *z1, **z2, ***z3; long y0, *y1, **y2, ***y3; long x0, *x1, **x2, ***x3; @@ -233,16 +233,16 @@ do_children_tests (void) weird->func_ptr = nothing; /* Struct/pointer/array tests */ - a0 = '0'; - a1 = &a0; + a0[0] = '0'; + a1 = a0; a2 = &a1; a3 = &a2; - b0 = '1'; - b1 = &b0; + b0[0] = '1'; + b1 = b0; b2 = &b1; b3 = &b2; - c0 = '2'; - c1 = &c0; + c0[0] = '2'; + c1 = c0; c2 = &c1; c3 = &c2; z0 = 0xdead + 0; diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index d94d0d79c1b..d4236368f17 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1224,11 +1224,11 @@ proc mi_send_resuming_command {command test} { # be determined. # Does not check that the line is the same as requested. # The caller can check itself if required. -proc mi_continue_to_line {location command} { +proc mi_continue_to_line {location test} { mi_tbreak $location mi_send_resuming_command "exec-continue" "run to $location (exec-continue)" - return [mi_wait_for_stop] + return [mi_wait_for_stop $test] } # Wait until gdb prints the current line.