This is the mail archive of the gdb-patches@sources.redhat.com 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: [PATCH] Outwit compiler dead code elimination in break.exp test


> If you're there, rather than being the second person this month to
> update the line numbers, could you convert it to gdb_get_line_number?

OK, here is an updated patch.

-Fred

2003-11-29  Fred Fish  <fnf@redhat.com>

	* gdb.base/break.c (globalvar): Add.
	(marker1, marker2, marker3, marker4): Set globalvar.
	Add additional "set breakpoint NN here" comments.
	* gdb.base/condbreak.exp: Use $bp_locationNN variables instead
	of hardcoded line numbers.  Emit bp_locationNN markers in pass
	and fail messages instead of line numbers.
	* gdb.base/break.exp: Ditto.
	* gdb.base/define.exp: Ditto.
	* gdb.base/ena-dis-br.exp: Ditto.
	* gdb.base/maint.exp: Ditto.
	* gdb.base/until.exp: Ditto.

Index: gdb.base/break.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.c,v
retrieving revision 1.3
diff -c -p -r1.3 break.c
*** gdb.base/break.c	13 Nov 2003 15:34:39 -0000	1.3
--- gdb.base/break.c	1 Dec 2003 00:37:15 -0000
*************** char *arg;
*** 37,54 ****
   * as places to try setting breakpoints at.  They are explicitly
   * "one-line functions" to verify that this case works (some versions
   * of gcc have or have had problems with this).
   */
  
  #ifdef PROTOTYPES
! int marker1 (void) { return (0); }
! int marker2 (int a) { return (1); } /* set breakpoint 8 here */
! void marker3 (char *a, char *b) {}
! void marker4 (long d) {} /* set breakpoint 14 here */
  #else
! int marker1 () { return (0); }
! int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */
! void marker3 (a, b) char *a, *b; {}
! void marker4 (d) long d; {}  /* set breakpoint 13 here */
  #endif
  
  /*
--- 37,58 ----
   * as places to try setting breakpoints at.  They are explicitly
   * "one-line functions" to verify that this case works (some versions
   * of gcc have or have had problems with this).
+  * Recent versions of gcc have gotten smart enough that they will not
+  * call functions that have no use or visible side effect, so use
+  * globalvar to outwit the compiler for a while longer.
   */
  
+ int globalvar;
  #ifdef PROTOTYPES
! gint marker1 (void) { globalvar = 1; return (0); } /* set breakpoint 15 here */
! int marker2 (int a) { globalvar = 2; return (1); } /* set breakpoint 8 here */
! void marker3 (char *a, char *b) {globalvar = 3;} /* set breakpoint 17 here */
! void marker4 (long d) {globalvar = 4;} /* set breakpoint 14 here */
  #else
! int marker1 () { globalvar = 1; return (0); } /* set breakpoint 16 here */
! int marker2 (a) int a; { globalvar = 2; return (1); } /* set breakpoint 9 here */
! void marker3 (a, b) char *a, *b; {globalvar = 3;} /* set breakpoint 18 here */
! void marker4 (d) long d; {globalvar = 4;}  /* set breakpoint 13 here */
  #endif
  
  /*
*************** char *argv[], **envp;
*** 79,86 ****
      printf ("%d\n", factorial (atoi ("6")));  /* set breakpoint 1 here */
      /* set breakpoint 12 here */
      marker1 ();  /* set breakpoint 11 here */
!     marker2 (43);
!     marker3 ("stack", "trace");
      marker4 (177601976L);
      argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
      return argc;  /* set breakpoint 10 here */
--- 83,90 ----
      printf ("%d\n", factorial (atoi ("6")));  /* set breakpoint 1 here */
      /* set breakpoint 12 here */
      marker1 ();  /* set breakpoint 11 here */
!     marker2 (43); /* set breakpoint 20 here */
!     marker3 ("stack", "trace"); /* set breakpoint 21 here */
      marker4 (177601976L);
      argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */
      return argc;  /* set breakpoint 10 here */
*************** int value;
*** 96,102 ****
    if (value > 1) {  /* set breakpoint 7 here */
  	value *= factorial (value - 1);
      }
!     return (value);
  }
  
  #ifdef PROTOTYPES
--- 100,106 ----
    if (value > 1) {  /* set breakpoint 7 here */
  	value *= factorial (value - 1);
      }
!     return (value); /* set breakpoint 19 here */
  }
  
  #ifdef PROTOTYPES
Index: gdb.base/break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.exp,v
retrieving revision 1.18
diff -c -p -r1.18 break.exp
*** gdb.base/break.exp	13 Nov 2003 15:34:39 -0000	1.18
--- gdb.base/break.exp	1 Dec 2003 00:37:16 -0000
*************** gdb_expect {
*** 393,399 ****
  # Run to the desired default location. If not positioned here, the
  # tests below don't work.
  #
! gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until $bp_location1"
  
  
  # Verify that GDB allows one to just say "break", which is treated
--- 393,399 ----
  # Run to the desired default location. If not positioned here, the
  # tests below don't work.
  #
! gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1"
  
  
  # Verify that GDB allows one to just say "break", which is treated
*************** if ![runto_main] then { fail "break test
*** 445,454 ****
  send_gdb "break $bp_location1\n"
  gdb_expect {
    -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\
!           {pass "set to-be-silent break $bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "set to-be-silent break $bp_location1"}
!   timeout {fail "(timeout) set to-be-silent break $bp_location1"}
  }
  
  send_gdb "commands $expect_out(1,string)\n"
--- 445,454 ----
  send_gdb "break $bp_location1\n"
  gdb_expect {
    -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\
!           {pass "set to-be-silent break bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "set to-be-silent break bp_location1"}
!   timeout {fail "(timeout) set to-be-silent break bp_location1"}
  }
  
  send_gdb "commands $expect_out(1,string)\n"
*************** send_gdb "silent\n"
*** 456,488 ****
  send_gdb "end\n"
  gdb_expect {
    -re ".*$gdb_prompt $"\
!           {pass "set silent break $bp_location1"}
!   timeout {fail "(timeout) set silent break $bp_location1"}
  }
  
  send_gdb "info break $expect_out(1,string)\n"
  gdb_expect {
    -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\
!           {pass "info silent break $bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "info silent break $bp_location1"}
!   timeout {fail "(timeout) info silent break $bp_location1"}
  }
  send_gdb "continue\n"
  gdb_expect {
    -re "Continuing.\r\n$gdb_prompt $"\
!           {pass "hit silent break $bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "hit silent break $bp_location1"}
!   timeout {fail "(timeout) hit silent break $bp_location1"}
  }
  send_gdb "bt\n"
  gdb_expect {
    -re "#0  main .* at .*:$bp_location1.*$gdb_prompt $"\
!           {pass "stopped for silent break $bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "stopped for silent break $bp_location1"}
!   timeout {fail "(timeout) stopped for silent break $bp_location1"}
  }
  
  # Verify that GDB can at least parse a breakpoint with the
--- 456,488 ----
  send_gdb "end\n"
  gdb_expect {
    -re ".*$gdb_prompt $"\
!           {pass "set silent break bp_location1"}
!   timeout {fail "(timeout) set silent break bp_location1"}
  }
  
  send_gdb "info break $expect_out(1,string)\n"
  gdb_expect {
    -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\
!           {pass "info silent break bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "info silent break bp_location1"}
!   timeout {fail "(timeout) info silent break bp_location1"}
  }
  send_gdb "continue\n"
  gdb_expect {
    -re "Continuing.\r\n$gdb_prompt $"\
!           {pass "hit silent break bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "hit silent break bp_location1"}
!   timeout {fail "(timeout) hit silent break bp_location1"}
  }
  send_gdb "bt\n"
  gdb_expect {
    -re "#0  main .* at .*:$bp_location1.*$gdb_prompt $"\
!           {pass "stopped for silent break bp_location1"}
    -re "$gdb_prompt $"\
!           {fail "stopped for silent break bp_location1"}
!   timeout {fail "(timeout) stopped for silent break bp_location1"}
  }
  
  # Verify that GDB can at least parse a breakpoint with the
*************** gdb_test "clear marker3" {Deleted breakp
*** 561,568 ****
  send_gdb "set \$foo=$bp_location11\n"
  gdb_expect {
    -re "$gdb_prompt $"\
!           {pass "set convenience variable \$foo to $bp_location11"}
!   timeout {fail "(timeout) set convenience variable \$foo to $bp_location11"}
  }
  send_gdb "break \$foo\n"
  gdb_expect {
--- 561,568 ----
  send_gdb "set \$foo=$bp_location11\n"
  gdb_expect {
    -re "$gdb_prompt $"\
!           {pass "set convenience variable \$foo to bp_location11"}
!   timeout {fail "(timeout) set convenience variable \$foo to bp_location11"}
  }
  send_gdb "break \$foo\n"
  gdb_expect {
*************** gdb_expect {
*** 934,940 ****
      }
      -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" {
          # marker4() is defined at line 46 when compiled with -DPROTOTYPES
! 	pass "run until breakpoint set at small function, optimized file (line $bp_location14)"
      }
      -re ".*$gdb_prompt " {
  	fail "run until breakpoint set at small function, optimized file"
--- 934,940 ----
      }
      -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" {
          # marker4() is defined at line 46 when compiled with -DPROTOTYPES
! 	pass "run until breakpoint set at small function, optimized file (line bp_location14)"
      }
      -re ".*$gdb_prompt " {
  	fail "run until breakpoint set at small function, optimized file"
Index: gdb.base/condbreak.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/condbreak.exp,v
retrieving revision 1.3
diff -c -p -r1.3 condbreak.exp
*** gdb.base/condbreak.exp	23 May 2001 19:04:13 -0000	1.3
--- gdb.base/condbreak.exp	1 Dec 2003 00:37:16 -0000
*************** if [target_info exists gdb_stub] {
*** 55,60 ****
--- 55,67 ----
      gdb_step_for_stub;
  }
  
+ set bp_location1  [gdb_get_line_number "set breakpoint 1 here"]
+ set bp_location6  [gdb_get_line_number "set breakpoint 6 here"]
+ set bp_location8  [gdb_get_line_number "set breakpoint 8 here"]
+ set bp_location9  [gdb_get_line_number "set breakpoint 9 here"]
+ set bp_location15 [gdb_get_line_number "set breakpoint 15 here"]
+ set bp_location16 [gdb_get_line_number "set breakpoint 16 here"]
+ 
  #
  # test break at function
  #
*************** gdb_test "delete 2" ""
*** 73,80 ****
  #
  # test conditional break at line number
  #
! gdb_test "break 79 if 1==1" \
!     "Breakpoint.*at.* file .*$srcfile, line 79\\."
  
  gdb_test "delete 3" ""
  
--- 80,87 ----
  #
  # test conditional break at line number
  #
! gdb_test "break $bp_location1 if 1==1" \
!     "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\."
  
  gdb_test "delete 3" ""
  
*************** gdb_test "break marker1 if (1==1)" \
*** 87,94 ****
  #
  # test conditional break at line number
  #
! gdb_test "break 79 if (1==1)" \
!     "Breakpoint.*at.* file .*$srcfile, line 79\\."
  
  gdb_test "break marker2 if (a==43)" \
      "Breakpoint.*at.* file .*$srcfile, line.*"
--- 94,101 ----
  #
  # test conditional break at line number
  #
! gdb_test "break $bp_location1 if (1==1)" \
!     "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\."
  
  gdb_test "break marker2 if (a==43)" \
      "Breakpoint.*at.* file .*$srcfile, line.*"
*************** if {$hp_aCC_compiler} {
*** 105,119 ****
      set marker2_proto ""
  }
  
- set main_line 75
  gdb_test "info break" \
      "Num Type\[ \]+Disp Enb Address\[ \]+What.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$main_line.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in marker1$marker1_proto at .*$srcfile:4\[38\].*
  \[\t \]+stop only if 1 == 1.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:79.*
  \[\t \]+stop only if 1 == 1.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in marker2$marker2_proto at .*$srcfile:4\[49\].*
  \[\t \]+stop only if a == 43.*" \
      "breakpoint info"
  
--- 112,125 ----
      set marker2_proto ""
  }
  
  gdb_test "info break" \
      "Num Type\[ \]+Disp Enb Address\[ \]+What.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$bp_location6.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in marker1$marker1_proto at .*$srcfile:($bp_location15|$bp_location16).*
  \[\t \]+stop only if 1 == 1.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$bp_location1.*
  \[\t \]+stop only if 1 == 1.*
! \[0-9\]+\[\t \]+breakpoint     keep y.* in marker2$marker2_proto at .*$srcfile:($bp_location8|$bp_location9).*
  \[\t \]+stop only if a == 43.*" \
      "breakpoint info"
  
*************** rerun_to_main
*** 128,134 ****
  #
  # run until the breakpoint at a line number
  #
! gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \
  			"run until breakpoint set at a line number"
  
  #
--- 134,140 ----
  #
  # run until the breakpoint at a line number
  #
! gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \
  			"run until breakpoint set at a line number"
  
  #
*************** gdb_test "continue" "Continuing\\..*Brea
*** 173,182 ****
  # Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior.
  send_gdb "continue\n"
  gdb_expect {
!     -re  "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" {
  	pass "run until breakpoint at marker1"
      }
!     -re  "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*$gdb_prompt $" {
  	xfail "run until breakpoint at marker1"
      }
      -re "$gdb_prompt $" {
--- 179,188 ----
  # Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior.
  send_gdb "continue\n"
  gdb_expect {
!     -re  "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
  	pass "run until breakpoint at marker1"
      }
!     -re  "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
  	xfail "run until breakpoint at marker1"
      }
      -re "$gdb_prompt $" {
*************** gdb_expect {
*** 192,201 ****
  setup_xfail hppa2.0w-*-* 11512CLLbs
  send_gdb "continue\n"
  gdb_expect {
!     -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" {
  	pass "run until breakpoint at marker2"
      }
!     -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" {
  	xfail "run until breakpoint at marker2"
      }
      -re "$gdb_prompt $" {
--- 198,207 ----
  setup_xfail hppa2.0w-*-* 11512CLLbs
  send_gdb "continue\n"
  gdb_expect {
!     -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
  	pass "run until breakpoint at marker2"
      }
!     -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
  	xfail "run until breakpoint at marker2"
      }
      -re "$gdb_prompt $" {
Index: gdb.base/define.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/define.exp,v
retrieving revision 1.3
diff -c -p -r1.3 define.exp
*** gdb.base/define.exp	23 May 2001 19:04:13 -0000	1.3
--- gdb.base/define.exp	1 Dec 2003 00:37:16 -0000
*************** gdb_start
*** 45,50 ****
--- 45,53 ----
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load ${binfile}
  
+ set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
+ set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
+ 
  if ![runto_main] then { fail "define tests suppressed" }
  
  # Verify that GDB allows a user to define their very own commands.
*************** gdb_expect {
*** 68,74 ****
  #
  send_gdb "nextwhere\n"
  gdb_expect {
!   -re ".*79\[ \t\]*printf.*#0\[ \t\]*main.*:79.*$gdb_prompt $"\
            {pass "use user command: nextwhere"}
    -re "$gdb_prompt $"\
            {fail "use user command: nextwhere"}
--- 71,77 ----
  #
  send_gdb "nextwhere\n"
  gdb_expect {
!   -re ".*$bp_location1\[ \t\]*printf.*#0\[ \t\]*main.*:$bp_location1.*$gdb_prompt $"\
            {pass "use user command: nextwhere"}
    -re "$gdb_prompt $"\
            {fail "use user command: nextwhere"}
*************** gdb_expect {
*** 224,230 ****
  
  send_gdb "next\n"
  gdb_expect {
!   -re "#0\[ \t\]*main.*:81.*$gdb_prompt $"\
            {pass "use hook-stop command"}
    -re "$gdb_prompt $"\
            {fail "use hook-stop command"}
--- 227,233 ----
  
  send_gdb "next\n"
  gdb_expect {
!   -re "#0\[ \t\]*main.*:$bp_location11.*$gdb_prompt $"\
            {pass "use hook-stop command"}
    -re "$gdb_prompt $"\
            {fail "use hook-stop command"}
Index: gdb.base/ena-dis-br.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ena-dis-br.exp,v
retrieving revision 1.3
diff -c -p -r1.3 ena-dis-br.exp
*** gdb.base/ena-dis-br.exp	18 Sep 2002 15:34:10 -0000	1.3
--- gdb.base/ena-dis-br.exp	1 Dec 2003 00:37:17 -0000
*************** gdb_start
*** 43,48 ****
--- 43,59 ----
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load ${binfile}
  
+ set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
+ set bp_location8 [gdb_get_line_number "set breakpoint 8 here"]
+ set bp_location9 [gdb_get_line_number "set breakpoint 9 here"]
+ set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
+ set bp_location13 [gdb_get_line_number "set breakpoint 13 here"]
+ set bp_location14 [gdb_get_line_number "set breakpoint 14 here"]
+ set bp_location15 [gdb_get_line_number "set breakpoint 15 here"]
+ set bp_location16 [gdb_get_line_number "set breakpoint 16 here"]
+ set bp_location17 [gdb_get_line_number "set breakpoint 17 here"]
+ set bp_location18 [gdb_get_line_number "set breakpoint 18 here"]
+ 
  if ![runto_main] then { fail "enable/disable break tests suppressed" }
  
  # Verify that we can set a breakpoint (the location is irrelevant),
*************** if ![runto_main] then { fail "enable/dis
*** 50,56 ****
  #
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
--- 61,67 ----
  #
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
*************** gdb_expect {
*** 98,104 ****
  #
  send_gdb "break marker2\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\
            {pass "break marker2"}
    -re "$gdb_prompt $"\
            {fail "break marker2"}
--- 109,115 ----
  #
  send_gdb "break marker2\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\
            {pass "break marker2"}
    -re "$gdb_prompt $"\
            {fail "break marker2"}
*************** if ![runto_main] then { fail "enable/dis
*** 156,162 ****
  
  send_gdb "break marker3\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line (45|50).*$gdb_prompt $"\
            {pass "break marker3"}
    -re "$gdb_prompt $"\
            {fail "break marker3"}
--- 167,173 ----
  
  send_gdb "break marker3\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location17|$bp_location18).*$gdb_prompt $"\
            {pass "break marker3"}
    -re "$gdb_prompt $"\
            {fail "break marker3"}
*************** gdb_expect {
*** 181,187 ****
  
  send_gdb "continue\n"
  gdb_expect {
!   -re ".*marker3 .*:(45|50).*$gdb_prompt $"\
            {pass "continue to auto-deleted break marker3"}
    -re "Breakpoint \[0-9\]*, marker3.*$gdb_prompt $"\
            {fail "continue to auto-deleted break marker3"}
--- 192,198 ----
  
  send_gdb "continue\n"
  gdb_expect {
!   -re ".*marker3 .*:($bp_location17|$bp_location18).*$gdb_prompt $"\
            {pass "continue to auto-deleted break marker3"}
    -re "Breakpoint \[0-9\]*, marker3.*$gdb_prompt $"\
            {fail "continue to auto-deleted break marker3"}
*************** gdb_expect {
*** 206,212 ****
  #
  send_gdb "break marker4\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line (46|51).*$gdb_prompt $"\
            {pass "break marker4"}
    -re "$gdb_prompt $"\
            {fail "break marker4"}
--- 217,223 ----
  #
  send_gdb "break marker4\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location14|$bp_location13).*$gdb_prompt $"\
            {pass "break marker4"}
    -re "$gdb_prompt $"\
            {fail "break marker4"}
*************** if ![runto_main] then { fail "enable/dis
*** 237,243 ****
  
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
--- 248,254 ----
  
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
*************** if ![runto_main] then { fail "enable/dis
*** 328,334 ****
  
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
--- 339,345 ----
  
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
*************** rerun_to_main
*** 365,371 ****
  
  send_gdb "continue\n"
  gdb_expect {
!   -re ".*marker1 .*:4\[38\].*$gdb_prompt $"\
            {pass "continue to ignored & auto-deleted break marker1"}
    -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\
            {fail "continue to ignored & auto-deleted break marker1"}
--- 376,382 ----
  
  send_gdb "continue\n"
  gdb_expect {
!   -re ".*marker1 .*:($bp_location15|$bp_location16).*$gdb_prompt $"\
            {pass "continue to ignored & auto-deleted break marker1"}
    -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\
            {fail "continue to ignored & auto-deleted break marker1"}
*************** if ![runto_main] then { fail "enable/dis
*** 381,387 ****
  
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
--- 392,398 ----
  
  send_gdb "break marker1\n"
  gdb_expect {
!   -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
            {pass "break marker1"}
    -re "$gdb_prompt $"\
            {fail "break marker1"}
*************** gdb_expect {
*** 423,431 ****
  #
  if ![runto_main] then { fail "enable/disable break tests suppressed" }
  
! send_gdb "break 79\n"
  gdb_expect {
!   -re "Breakpoint \[0-9\]*.*, line 79.*$gdb_prompt $"\
            {pass "prepare to continue with ignore count"}
    -re "$gdb_prompt $"\
            {fail "prepare to continue with ignore count"}
--- 434,442 ----
  #
  if ![runto_main] then { fail "enable/disable break tests suppressed" }
  
! send_gdb "break $bp_location1\n"
  gdb_expect {
!   -re "Breakpoint \[0-9\]*.*, line $bp_location1.*$gdb_prompt $"\
            {pass "prepare to continue with ignore count"}
    -re "$gdb_prompt $"\
            {fail "prepare to continue with ignore count"}
*************** gdb_expect {
*** 442,448 ****
  
  send_gdb "next\n"
  gdb_expect {
!   -re ".*81\[ \t\]*marker1.*$gdb_prompt $"\
            {pass "step after continue with ignore count"}
    -re "$gdb_prompt $"\
            {fail "step after continue with ignore count"}
--- 453,459 ----
  
  send_gdb "next\n"
  gdb_expect {
!   -re ".*$bp_location11\[ \t\]*marker1.*$gdb_prompt $"\
            {pass "step after continue with ignore count"}
    -re "$gdb_prompt $"\
            {fail "step after continue with ignore count"}
Index: gdb.base/maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.20
diff -c -p -r1.20 maint.exp
*** gdb.base/maint.exp	20 Nov 2003 15:36:34 -0000	1.20
--- gdb.base/maint.exp	1 Dec 2003 00:37:19 -0000
*************** gdb_expect {
*** 412,422 ****
      timeout              { fail "(timeout) maint info sections DATA" }
  }
  
  send_gdb "maint info breakpoints\n"
  gdb_expect {
!     -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\
  		{ pass "maint info breakpoints" }
! 	-re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\
  		{ pass "maint info breakpoints (with shlib events)" }
  	-re ".*$gdb_prompt $"       { fail "maint info breakpoints" }
  	timeout         { fail "(timeout) maint info breakpoints" }
--- 412,424 ----
      timeout              { fail "(timeout) maint info sections DATA" }
  }
  
+ set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
+ 
  send_gdb "maint info breakpoints\n"
  gdb_expect {
!     -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\
  		{ pass "maint info breakpoints" }
! 	-re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\
  		{ pass "maint info breakpoints (with shlib events)" }
  	-re ".*$gdb_prompt $"       { fail "maint info breakpoints" }
  	timeout         { fail "(timeout) maint info breakpoints" }
Index: gdb.base/until.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/until.exp,v
retrieving revision 1.3
diff -c -p -r1.3 until.exp
*** gdb.base/until.exp	3 Feb 2003 16:04:18 -0000	1.3
--- gdb.base/until.exp	1 Dec 2003 00:37:19 -0000
*************** gdb_start
*** 37,42 ****
--- 37,47 ----
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load ${binfile}
  
+ set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
+ set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
+ set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
+ set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
+ 
  if ![runto_main] then {
      fail "Can't run to main"
      return 0
*************** if ![runto_main] then {
*** 45,52 ****
  # Verify that "until <location>" works.  (This is really just syntactic
  # sugar for "tbreak <location>; continue".)
  #
! gdb_test "until 79" \
! 	"main .* at .*:79.*" \
  	"until line number"
  
  # Verify that a malformed "advance" is gracefully caught.
--- 50,57 ----
  # Verify that "until <location>" works.  (This is really just syntactic
  # sugar for "tbreak <location>; continue".)
  #
! gdb_test "until $bp_location1" \
! 	"main .* at .*:$bp_location1.*" \
  	"until line number"
  
  # Verify that a malformed "advance" is gracefully caught.
*************** delete_breakpoints
*** 62,69 ****
  # inner invocations of factorial() are completed and we are back at this
  # frame.
  #
! gdb_test "until 99" \
! 	"factorial.*value=720.*at.*${srcfile}:99.*return \\(value\\)." \
  	"until factorial, recursive function"
  
  # Run to a function called by main
--- 67,74 ----
  # inner invocations of factorial() are completed and we are back at this
  # frame.
  #
! gdb_test "until $bp_location19" \
! 	"factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\).*" \
  	"until factorial, recursive function"
  
  # Run to a function called by main
*************** delete_breakpoints
*** 76,81 ****
  # stop at main, the caller, where we put the 'guard' breakpoint.
  #
  gdb_test "until marker3" \
! 	"($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:(82.*marker2 \\(43\\)|83.*marker3 \\(.stack., .trace.\\))." \
  	"until func, not called by current frame"
  
--- 81,86 ----
  # stop at main, the caller, where we put the 'guard' breakpoint.
  #
  gdb_test "until marker3" \
! 	"($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*marker2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \
  	"until func, not called by current frame"
  


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