diff options
author | Doug Evans <xdje42@gmail.com> | 2016-12-19 08:33:46 -0800 |
---|---|---|
committer | Doug Evans <xdje42@gmail.com> | 2016-12-22 15:37:22 -0800 |
commit | 34c41c681f4a0a0dfe0405c7d2aecf458520557a (patch) | |
tree | 7bcac83e1692f2a41ee53483350ffc59eaafd907 /gdb/testsuite | |
parent | 112e8700a6fd2fed65ca70132c9cbed4132e8bd4 (diff) | |
download | gdb-34c41c681f4a0a0dfe0405c7d2aecf458520557a.zip gdb-34c41c681f4a0a0dfe0405c7d2aecf458520557a.tar.gz gdb-34c41c681f4a0a0dfe0405c7d2aecf458520557a.tar.bz2 |
New syntax for mt print symbols,msymbols,psymbols.
gdb/ChangeLog:
* NEWS: Document new syntax for "mt print symbols", "mt print psymbols"
and "mt print msymbols" commands.
* psymtab.c (DEV_TTY): Delete.
(dump_psymtab_addrmap): Don't dump if psymtabs_addrmap is NULL.
(maintenance_print_psymbols): Rewrite for new syntax:
mt print psymbols [-objfile objfile] [-pc address] [outfile]
mt print psymbols [-objfile objfile] [-source source] [outfile]
(_initialize_psymtab): Update help text.
* symmisc.c (maintenance_print_symbols): Rewrite for new syntax:
mt print symbols [-pc address] [outfile]
mt print symbols [-objfile objfile] [-source source] [outfile]
(maintenance_print_msymbols): Rewrite for new syntax:
mt print msymbols [-objfile objfile] [outfile]
Only print symbols for the current progspace.
(_initialize_symmisc): Update help text.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Update docs for symbol printing maintenance
commands.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Update tests for maint print symbols, psymbols
and msymbols.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/maint.exp | 136 |
2 files changed, 74 insertions, 67 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 12952a5..e79226a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-22 Doug Evans <xdje42@gmail.com> + + * gdb.base/maint.exp: Update tests for maint print symbols, psymbols + and msymbols. + 2016-12-19 Yao Qi <yao.qi@linaro.org> * gdb.gdb/selftest.exp (do_steps_and_nexts): Remove. diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index c66c9ed..df5525d 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -207,57 +207,56 @@ if { ! $have_gdb_index } { } 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" - if { ! $have_gdb_index } { set psymbols_output [standard_output_file psymbols_output] set psymbols_output_re [string_to_regexp $psymbols_output] - send_gdb "maint print psymbols $psymbols_output ${srcdir}/${subdir}/${srcfile}\n" - gdb_expect { - -re "^maint print psymbols $psymbols_output_re \[^\n\]*\r\n$gdb_prompt $" { - send_gdb "shell ls $psymbols_output\n" - gdb_expect { - -re "$psymbols_output_re\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" + set test_list [list \ + "maint print psymbols -source" \ + "maint print psymbols -source ${srcdir}/${subdir}/${srcfile} $psymbols_output" \ + "maint print psymbols -pc" \ + "maint print psymbols -pc main $psymbols_output"] + foreach { test_name command } $test_list { + send_gdb "$command\n" + gdb_expect { + -re "^maint print psymbols \[^\n\]*\r\n$gdb_prompt $" { + send_gdb "shell ls $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 "$psymbols_output_re\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 "$test_name 1" + } + -re ".*main. .., function, $hex.*$gdb_prompt $" { + pass "$test_name 2" + } + -re ".*$gdb_prompt $" { fail "$test_name" } + timeout { fail "$test_name (timeout)" } + } + gdb_test "shell rm -f $psymbols_output" ".*" \ + "shell rm -f psymbols_output" } - -re ".*$gdb_prompt $" { fail "maint print psymbols" } - timeout { fail "(timeout) maint print psymbols" } + -re ".*$gdb_prompt $" { fail "$test_name" } + timeout { fail "$test_name (timeout)" } } - gdb_test "shell rm -f $psymbols_output" ".*" \ - "shell rm -f psymbols_output" } - -re ".*$gdb_prompt $" { fail "maint print psymbols" } - timeout { fail "(timeout) maint print psymbols" } + -re ".*$gdb_prompt $" { fail "$test_name" } + timeout { fail "$test_name (timeout)" } } - } - -re ".*$gdb_prompt $" { fail "maint print psymbols" } - timeout { fail "(timeout) maint print psymbols" } } } -gdb_test "maint print msymbols" \ - "print-msymbols takes an output file name and optional symbol file name" \ - "maint print msymbols w/o args" - set msymbols_output [standard_output_file msymbols_output] set msymbols_output_re [string_to_regexp $msymbols_output] -send_gdb "maint print msymbols $msymbols_output ${binfile}\n" +send_gdb "maint print msymbols -objfile ${binfile} $msymbols_output\n" gdb_expect { - -re "^maint print msymbols $msymbols_output_re \[^\n\]*\r\n$gdb_prompt $" { + -re "^maint print msymbols \[^\n\]*\r\n$gdb_prompt $" { send_gdb "shell ls $msymbols_output\n" gdb_expect { -re "$msymbols_output_re\r\n$gdb_prompt $" { @@ -266,18 +265,18 @@ gdb_expect { -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" { pass "maint print msymbols" } - -re ".*$gdb_prompt $" { fail "maint print msymbols" } - timeout { fail "(timeout) maint print msymbols" } + -re ".*$gdb_prompt $" { fail "maint print msymbols" } + timeout { fail "maint print msymbols (timeout)" } } gdb_test "shell rm -f $msymbols_output" ".*" \ "shell rm -f msymbols_output" } - -re ".*$gdb_prompt $" { fail "maint print msymbols" } - timeout { fail "(timeout) maint print msymbols" } + -re ".*$gdb_prompt $" { fail "maint print msymbols" } + timeout { fail "maint print msymbols (timeout)" } } } - -re ".*$gdb_prompt $" { fail "maint print msymbols" } - timeout { fail "(timeout) maint print msymbols" } + -re ".*$gdb_prompt $" { fail "maint print msymbols" } + timeout { fail "maint print msymbols (timeout)" } } # Check that maint print msymbols allows relative pathnames @@ -286,8 +285,8 @@ gdb_test "cd [standard_output_file {}]" \ "Working directory .*\..*" \ "cd to objdir" -gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint print msymbols" { - -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" { +gdb_test_multiple "maint print msymbols -objfile ${testfile} msymbols_output2" "maint print msymbols" { + -re "^maint print msymbols \[^\n\]*\r\n$gdb_prompt $" { gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" { -re "msymbols_output2\r\n$gdb_prompt $" { gdb_test "shell grep factorial msymbols_output2" \ @@ -302,10 +301,6 @@ gdb_test "cd ${mydir}" \ "Working directory [string_to_regexp ${mydir}]\..*" \ "cd to mydir" -gdb_test "maint print symbols" \ - "Arguments missing: an output file name and an optional symbol file name" \ - "maint print symbols w/o args" - # Request symbols for one particular source file so that we don't try to # dump the symbol information for the entire C library - over 500MB nowadays @@ -313,30 +308,37 @@ gdb_test "maint print symbols" \ set symbols_output [standard_output_file symbols_output] set symbols_output_re [string_to_regexp $symbols_output] -send_gdb "maint print symbols $symbols_output ${srcdir}/${subdir}/${srcfile}\n" -gdb_expect { - -re "^maint print symbols $symbols_output_re \[^\n\]*\r\n$gdb_prompt $" { - send_gdb "shell ls $symbols_output\n" - gdb_expect { - -re "$symbols_output_re\r\n$gdb_prompt $" { - # See comments for `maint print psymbols'. - send_gdb "shell grep 'main(.*block' $symbols_output\n" - gdb_expect { - -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" { - pass "maint print symbols" +set test_list [list \ + "maint print symbols -source" \ + "maint print symbols -source ${srcdir}/${subdir}/${srcfile} $symbols_output" \ + "maint print symbols -pc" \ + "maint print symbols -pc main $symbols_output"] +foreach { test_name command } $test_list { + send_gdb "$command\n" + gdb_expect { + -re "^maint print symbols \[^\n\]*\r\n$gdb_prompt $" { + send_gdb "shell ls $symbols_output\n" + gdb_expect { + -re "$symbols_output_re\r\n$gdb_prompt $" { + # See comments for `maint print psymbols'. + send_gdb "shell grep 'main(.*block' $symbols_output\n" + gdb_expect { + -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" { + pass "$test_name" + } + -re ".*$gdb_prompt $" { fail "$test_name" } + timeout { fail "$test_name (timeout)" } } - -re ".*$gdb_prompt $" { fail "maint print symbols" } - timeout { fail "(timeout) maint print symbols" } + gdb_test "shell rm -f $symbols_output" ".*" \ + "shell rm -f symbols_output" } - gdb_test "shell rm -f $symbols_output" ".*" \ - "shell rm -f symbols_output" + -re ".*$gdb_prompt $" { fail "$test_name" } + timeout { fail "$test_name (timeout)" } } - -re ".*$gdb_prompt $" { fail "maint print symbols" } - timeout { fail "(timeout) maint print symbols" } } + -re ".*$gdb_prompt $" { fail "$test_name" } + timeout { fail "$test_name (timeout)" } } - -re ".*$gdb_prompt $" { fail "maint print symbols" } - timeout { fail "(timeout) maint print symbols" } } set msg "maint print type" |