From 27210e125838a89133680ce2e87c0b9ae4844601 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 20 Dec 2012 05:05:49 +0000 Subject: * gdb.base/maint.exp: Handle testing with .gdb_index. --- gdb/testsuite/ChangeLog | 4 +++ gdb/testsuite/gdb.base/maint.exp | 70 +++++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 29 deletions(-) (limited to 'gdb') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8843e54..5e9ce9a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-12-19 Doug Evans + + * gdb.base/maint.exp: Handle testing with .gdb_index. + 2012-12-19 Joel Brobecker * gdb.arch/mips-octeon-bbit.exp: Fix copyright header from diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 2dc25f4..984f54e 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -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 - 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 + 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" \ -- cgit v1.1