[patch] gdb.base/maint.exp: Handle .gdb_index.

Doug Evans dje@google.com
Wed Dec 19 08:18:00 GMT 2012


Hi.
This testcase has a few failures if tested with .gdb_index.
This patch fixes that.

Note: The size of the patch is mostly due to whitespace change
due to indentation changes.

I will check this in in a few days if there are no objections.

2012-12-19  Doug Evans  <dje@google.com>

	* gdb.base/maint.exp: Handle testing with .gdb_index.

Index: maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v
retrieving revision 1.59
diff -u -p -r1.59 maint.exp
--- maint.exp	22 Aug 2012 16:01:09 -0000	1.59
+++ maint.exp	19 Dec 2012 08:15:20 -0000
@@ -92,6 +92,16 @@ if ![runto_main] then {
         perror "tests suppressed"
 }
 
+# If we're using .gdb_index there will be no psymtabs.
+set have_gdb_index 0
+gdb_test_multiple "maint info sections .gdb_index" "check for .gdb_index" {
+    -re ": .gdb_index.*$gdb_prompt $" {
+	set have_gdb_index 1
+    }
+    -re ".*$gdb_prompt $" {
+	;# Nothing to do, present to avoid a FAIL.
+    }
+}
 
 #
 # this command does not produce any output
@@ -150,7 +160,7 @@ if [istarget "*-*-cygwin*"] {
 
 send_gdb "maint print statistics\n"
 gdb_expect  {
-    -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n  Number of \"minimal\" symbols read: $decimal\r\n  Number of \"partial\" symbols read: $decimal\r\n  Number of \"full\" symbols read: $decimal\r\n  Number of \"types\" defined: $decimal\r\n  Number of psym tables \\(not yet expanded\\): $decimal\r\n  Number of symbol tables: $decimal\r\n  Number of symbol tables with line tables: $decimal\r\n  Number of symbol tables with blockvectors: $decimal\r\n  Total memory used for objfile obstack: $decimal\r\n  Total memory used for BFD obstack: $decimal\r\n  Total memory used for psymbol cache: $decimal\r\n  Total memory used for macro cache: $decimal\r\n  Total memory used for file name cache: $decimal\r\n" {
+    -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n  Number of \"minimal\" symbols read: $decimal\r\n(  Number of \"partial\" symbols read: $decimal\r\n)?  Number of \"full\" symbols read: $decimal\r\n  Number of \"types\" defined: $decimal\r\n(  Number of psym tables \\(not yet expanded\\): $decimal\r\n)?(  Number of unread CUs: $decimal\r\n)?  Number of symbol tables: $decimal\r\n  Number of symbol tables with line tables: $decimal\r\n  Number of symbol tables with blockvectors: $decimal\r\n  Total memory used for objfile obstack: $decimal\r\n  Total memory used for BFD obstack: $decimal\r\n  Total memory used for psymbol cache: $decimal\r\n  Total memory used for macro cache: $decimal\r\n  Total memory used for file name cache: $decimal\r\n" {
 	gdb_expect {
 	    -re "$gdb_prompt $" {
 		pass "maint print statistics"
@@ -198,45 +208,47 @@ proc maint_pass_if {val name} {
 }
 
 maint_pass_if $header   "maint print objfiles: header"
-maint_pass_if $psymtabs "maint print objfiles: psymtabs"
+if { ! $have_gdb_index } {
+    maint_pass_if $psymtabs "maint print objfiles: psymtabs"
+}
 maint_pass_if $symtabs  "maint print objfiles: symtabs"
 
 gdb_test "maint print psymbols" \
     "print-psymbols takes an output file name and optional symbol file name" \
     "maint print psymbols w/o args"
 
-
-
-send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
-gdb_expect  {
-    -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $" {
-	send_gdb "shell ls psymbols_output\n"
-	gdb_expect {
-	    -re "psymbols_output\r\n$gdb_prompt $" {
-		# We want this grep to be as specific as possible,
-		# so it's less likely to match symbol file names in
-		# psymbols_output.  Yes, this actually happened;
-		# poor expect got tons of output, and timed out
-		# trying to match it.   --- Jim Blandy <jimb@cygnus.com>
-		send_gdb "shell grep 'main.*function' psymbols_output\n"
-		gdb_expect {
-		    -re ".main., function, $hex.*$gdb_prompt $" {
-			pass "maint print psymbols 1"
-		    }
-		    -re ".*main.  .., function, $hex.*$gdb_prompt $" {
-			pass "maint print psymbols 2"
+if { ! $have_gdb_index } {
+    send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
+    gdb_expect  {
+	-re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $" {
+	    send_gdb "shell ls psymbols_output\n"
+	    gdb_expect {
+		-re "psymbols_output\r\n$gdb_prompt $" {
+		    # We want this grep to be as specific as possible,
+		    # so it's less likely to match symbol file names in
+		    # psymbols_output.  Yes, this actually happened;
+		    # poor expect got tons of output, and timed out
+		    # trying to match it.   --- Jim Blandy <jimb@cygnus.com>
+		    send_gdb "shell grep 'main.*function' psymbols_output\n"
+		    gdb_expect {
+			-re ".main., function, $hex.*$gdb_prompt $" {
+			    pass "maint print psymbols 1"
+			}
+			-re ".*main.  .., function, $hex.*$gdb_prompt $" {
+			    pass "maint print psymbols 2"
+			}
+			-re ".*$gdb_prompt $" { fail "maint print psymbols" }
+			timeout     { fail "(timeout) maint print psymbols" }
 		    }
-		    -re ".*$gdb_prompt $" { fail "maint print psymbols" }
-		    timeout     { fail "(timeout) maint print psymbols" }
+		    gdb_test "shell rm -f psymbols_output" ".*"
 		}
-		gdb_test "shell rm -f psymbols_output" ".*"
+		-re ".*$gdb_prompt $"       { fail "maint print psymbols" }
+		timeout           { fail "(timeout) maint print psymbols" }
 	    }
-	    -re ".*$gdb_prompt $"       { fail "maint print psymbols" }
-	    timeout           { fail "(timeout) maint print psymbols" }
 	}
+	-re ".*$gdb_prompt $"       { fail "maint print psymbols" }
+	timeout           { fail "(timeout) maint print psymbols" }
     }
-    -re ".*$gdb_prompt $"       { fail "maint print psymbols" }
-    timeout           { fail "(timeout) maint print psymbols" }
 }
 
 gdb_test "maint print msymbols" \



More information about the Gdb-patches mailing list