[patch v9 5/5] Test 'info files' after 'add-symbol-file' and 'remove-symbol-file'.

Nicolas Blanc
2013-06-18T14:47:45Z

2013-17-06 Nicolas Blanc <nicolas.blanc@intel.com>

gdb/testsuite
* gdb.base/sym-file.exp: Test 'info files'.

Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
---
gdb/testsuite/gdb.base/sym-file.exp | 44 ++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.base/sym-file.exp b/gdb/testsuite/gdb.base/sym-file.exp
index 873e488..9387b95 100644
--- a/gdb/testsuite/gdb.base/sym-file.exp
+++ b/gdb/testsuite/gdb.base/sym-file.exp
@@ -17,14 +17,16 @@
# 1) Run to gdb_add_symbol_file in $srcfile.
# 2) Set a pending breakpoint at bar in $libsrc.
# 3) Load $shlib_name using 'add-symbol-file'.
-# 4) Continue to bar in $libsrc.
-# 5) Set a breakpoint at foo in $librc.
-# 6) Continue to foo in $libsrc.
-# 7) Set a breakpoint at gdb_remove_symbol_file.
-# 8) Continue to gdb_remove_symbol_file in $srcfile.
-# 9) Remove $shlib_name using 'remove-symbol-file'.
-# 10) Check that the breakpoints at foo and bar are pending.
-# 11) Check that the execution can continue without error.
+# 4) 'info files' must display $libname.
+# 5) Continue to bar in $libsrc.
+# 6) Set a breakpoint at foo in $librc.
+# 7) Continue to foo in $libsrc.
+# 8) Set a breakpoint at gdb_remove_symbol_file.
+# 9) Continue to gdb_remove_symbol_file in $srcfile.
+# 10) Remove $shlib_name using 'remove-symbol-file'.
+# 11) 'info files' must not display $libname, anymore.
+# 12) Check that the breakpoints at foo and bar are pending.
+# 13) Check that the execution can continue without error.

if [skip_shlib_tests] {
return 0
@@ -91,33 +93,38 @@ if { $result != 0 } then {
return
}

-# 4) Continue to bar in $libsrc to ensure that the breakpoint
+# 4) 'info files' must display $libname.
+gdb_test "info files" \
+ "^(?=(.*${libname})).*" \
+ "info files must display $libname"
+
+# 5) Continue to bar in $libsrc to ensure that the breakpoint
# was bound correctly after adding $shilb_name.
set lnum_bar [gdb_get_line_number "break at bar" ${libfile}.c]
gdb_continue_to_breakpoint bar ".*$libfile\\.c:$lnum_bar.*"

-# 5) Set a breakpoint at foo in $libsrc.
+# 6) Set a breakpoint at foo in $libsrc.
set result [gdb_breakpoint foo]
if { !$result } then {
return
}

-# 6) Continue to foo in $libsrc to ensure that the breakpoint
+# 7) Continue to foo in $libsrc to ensure that the breakpoint
# was bound correctly.
set lnum_foo [gdb_get_line_number "break at foo" ${libfile}.c]
gdb_continue_to_breakpoint foo ".*$libfile\\.c:$lnum_foo.*"

-# 7) Set a breakpoint at gdb_remove_symbol_file in $srcfile for
+# 8) Set a breakpoint at gdb_remove_symbol_file in $srcfile for
# removing $shlib_name.
set result [gdb_breakpoint gdb_remove_symbol_file]
if { !$result } then {
return
}

-# 8) Continue to gdb_remove_symbol_file in $srcfile.
+# 9) Continue to gdb_remove_symbol_file in $srcfile.
gdb_continue_to_breakpoint gdb_remove_symbol_file

-# 9) Remove $shlib_name using 'remove-symbol-file'.
+# 10) Remove $shlib_name using 'remove-symbol-file'.
set result [gdb_test "remove-symbol-file -a addr" \
""\
"remove-symbol-file -a addr" \
@@ -128,7 +135,12 @@ if { $result != 0 } then {
return
}

-# 10) Check that the breakpoints at foo and bar are pending after removing
+# 11) 'info files' must not display $libname, anymore.
+gdb_test "info files" \
+ "^(?!(.*${libname})).*" \
+ "info files must not display ${libname}"
+
+# 12) Check that the breakpoints at foo and bar are pending after removing
# $shlib_name.
gdb_test "info breakpoints 2" \
".*PENDING.*" \
@@ -138,6 +150,6 @@ gdb_test "info breakpoints 3" \
".*PENDING.*" \
"check if Breakpoint 3 is pending."

-# 11) Check that the execution can continue without error.
+# 13) Check that the execution can continue without error.
gdb_continue_to_end

--
1.7.6.5