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: [PATCH] testsuite: adjust line number in commands.exp


    > Tested in both sparc64-*-linux-gnu and x86_64-*-linux-gnu.
    > 
    > 2013-10-07  Jose E. Marchesi  <jose.marchesi@oracle.com>
    > 
    > 	* gdb.base/commands.exp (watchpoint_command_test): Adjust line
    > 	number in run.c with the end of scope of the block containing
    > 	local_var.
    
    This is PR 15986.  Could you make this use gdb_get_line_number?

Something like this?  For future patches I will search the bugzilla
first :)

2013-10-07  Jose E. Marchesi  <jose.marchesi@oracle.com>

	PR gdb/15986    
	* gdb.base/run.c (main): gdb_get_line_number tag added for
	commands.exp.
	(factorial): Likewise.

	* gdb.base/commands.exp (watchpoint_command_test): Use
	gdb_get_line_number in order to determine the locations in run.c
	where local_var is detected to go out of scope.


Index: testsuite/gdb.base/commands.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/commands.exp,v
retrieving revision 1.52
diff -u -r1.52 commands.exp
--- testsuite/gdb.base/commands.exp	27 Jun 2013 18:49:03 -0000	1.52
+++ testsuite/gdb.base/commands.exp	7 Oct 2013 17:13:47 -0000
@@ -308,6 +308,8 @@
 	"end commands on watch"
 
     set test "continue with watch"
+    set lno_1 [gdb_get_line_number "commands.exp: hw local_var out of scope" "run.c"]
+    set lno_2 [gdb_get_line_number "commands.exp: local_var out of scope"    "run.c"]
     gdb_test_multiple "continue" "$test" {
 	-re "No symbol \"value\" in current context.\r\n$gdb_prompt $" {
 	    # Happens if GDB actually runs the watchpoints commands,
@@ -315,7 +317,7 @@
 	    # scope.
 	    fail $test
 	}
-	-re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(53|77).*$gdb_prompt $" {
+	-re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:($lno_1|$lno_2).*$gdb_prompt $" {
 	    pass $test
 	}
    }
Index: testsuite/gdb.base/run.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/run.c,v
retrieving revision 1.2
diff -u -r1.2 run.c
--- testsuite/gdb.base/run.c	13 Dec 2011 17:22:08 -0000	1.2
+++ testsuite/gdb.base/run.c	7 Oct 2013 17:13:47 -0000
@@ -50,7 +50,7 @@
 #endif
 {
 #ifdef FAKEARGV
-    printf ("%d\n", factorial (1));
+    printf ("%d\n", factorial (1)); /* commands.exp: hw local_var out of scope */
 #else    
     if (argc != 2) {
 	printf ("usage:  factorial <number>\n");
@@ -75,4 +75,4 @@
     }
     local_var = value;
     return (value);
-}
+} /* commands.exp: local_var out of scope  */


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