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]

[RFA, Patch, testsuite] gdb.base/list.exp: initial state test for stub targets.


Hi,

At present, gdb.base/list.exp behaves differently for targets that use a stub and those that are native, simulator or gdbserver.

For the latter cases, the test does not cause an inferior to be created, and the default list lines around main works 'as expected'.

For the stub case, an inferior is created and this will generally be stopped in some start-up or exception code.  At present, this is handled by running to main and then skipping the default listing, unsupport-ing the 'default list lines around main' test.

I was asked to look into removing that 'unsupported'.

One way to make things consistent would be to avoid creating the inferior for the stub case - since the listing tests only require host-side actions.  This could be achieved by replacing the gdb_load in the test with a gdb_file_cmd, in the test; Patch (a) below.

An alternative, is to recognise that there is an expected state from the inferior after run_tomain - and to check for this state;  Patch (b) below.

comments/OK for (a) or (b)?
Iain

gdb/testsuite:

	* gdb.base/list.exp (test_listsize): Adjust to allow testing of default
	lines on targets using stubs.

====

(a)

Index: gdb/testsuite/gdb.base/list.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/list.exp,v
retrieving revision 1.29
diff -u -p -r1.29 list.exp
--- gdb/testsuite/gdb.base/list.exp	16 Jan 2012 16:21:44 -0000	1.29
+++ gdb/testsuite/gdb.base/list.exp	13 Jun 2012 11:58:11 -0000
@@ -77,7 +77,7 @@ proc set_listsize { arg } {
 #
 
 proc test_listsize {} {
-    global gdb_prompt use_gdb_stub
+    global gdb_prompt
     global hp_cc_compiler
     global hp_aCC_compiler
 
@@ -86,16 +86,8 @@ proc test_listsize {} {
     gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
     
     # Show the default lines
-    # Note that remote targets that have debugging info for _start available will
-    # list the lines there instead of main, so we skip this test for remote targets.
-    # The second case is for optimized code, it is still correct.
-    
-    if $use_gdb_stub {
-	runto_main;
-	unsupported "list default lines around main";
-    } else {
-	gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
-    }
+
+    gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
 
     # Ensure we can limit printouts to one line
 
@@ -518,7 +510,7 @@ proc test_forward_search {} {
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+gdb_file_cmd ${binfile}
 
 gdb_test_no_output "set width 0"
 

====

(b)

Index: gdb/testsuite/gdb.base/list.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/list.exp,v
retrieving revision 1.29
diff -u -p -r1.29 list.exp
--- gdb/testsuite/gdb.base/list.exp	16 Jan 2012 16:21:44 -0000	1.29
+++ gdb/testsuite/gdb.base/list.exp	13 Jun 2012 12:22:18 -0000
@@ -86,13 +86,14 @@ proc test_listsize {} {
     gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
     
     # Show the default lines
-    # Note that remote targets that have debugging info for _start available will
-    # list the lines there instead of main, so we skip this test for remote targets.
+    # Note that remote targets that have debugging info for _start available
+    # would list the lines there instead of main, so we run to main and then
+    # look for the expected output at that stage.
     # The second case is for optimized code, it is still correct.
     
     if $use_gdb_stub {
 	runto_main;
-	unsupported "list default lines around main";
+	gdb_test "list" "(2.*\[ \t\]+int x;.*7\[ \t\]+x = 0;\r\n.*11\[ \t\]+foo .x\[+)\]+;)" "list default lines after running to main"
     } else {
 	gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
     }


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