aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-08-05 15:17:59 +0000
committerPedro Alves <palves@redhat.com>2011-08-05 15:17:59 +0000
commitaf6e93b2d14b2a15c1b608aeecf95f29a8682b17 (patch)
tree6d404792f4e4361bba5692b5abc02a98f05c2250 /gdb/testsuite
parentd989b283238d3aeffa567106ec2d75d4cdf1827b (diff)
downloadbinutils-af6e93b2d14b2a15c1b608aeecf95f29a8682b17.zip
binutils-af6e93b2d14b2a15c1b608aeecf95f29a8682b17.tar.gz
binutils-af6e93b2d14b2a15c1b608aeecf95f29a8682b17.tar.bz2
gdb/
* exceptions.c (throw_exception): Don't disable the current display. * printcmd.c (disable_current_display_cleanup): New function. (do_one_display): Install a cleanup to disable the current display if doing the display throws. gdb/testsuite/ * gdb.trace/unavailable.exp (test_maybe_regvar_display): New procedure. (gdb_collect_args_test, gdb_collect_locals_test): Use it.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.exp34
2 files changed, 40 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8ee5b93..fd0c01f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-05 Pedro Alves <pedro@codesourcery.com>
+
+ * gdb.trace/unavailable.exp (test_maybe_regvar_display): New
+ procedure.
+ (gdb_collect_args_test, gdb_collect_locals_test): Use it.
+
2011-08-05 Yao Qi <yao@codesourcery.com>
* gdb.base/callfuncs.exp: Set language after main.
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 4840e2b..d10263f 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -103,6 +103,36 @@ proc run_trace_experiment { test_func } {
"tfind test frame"
}
+# Test that "display VAR" works as expected, assuming VAR is wholly
+# unavailable.
+
+proc test_maybe_regvar_display { var } {
+ global gdb_prompt
+
+ # Evaluating VAR's location description may throw an internal
+ # "unavailable" exception, if for example, the value of a register
+ # necessary for computing VAR's location is unavailable. Such an
+ # exception is caught, and should not cause automatic disablement
+ # of the current display being printed. (GDB used to disable the
+ # current display whenever any exception was thrown.)
+ set test "display $var"
+ gdb_test_multiple "$test" "$test" {
+ -re "Disabling display ? to avoid infinite recursion.*$gdb_prompt $" {
+ fail "$test"
+ }
+ -re "display ${var}\r\n1: ${var} = <unavailable>\r\n$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ gdb_test "info display" ".*1:\[ \t\]+y\[ \t\]+${var}" "display ${var} is enabled"
+
+ gdb_test "undisp" \
+ "" \
+ "delete $var display" \
+ ".*Delete all auto-display expressions.*y or n. $" \
+ "y"
+}
+
#
# Test procs
#
@@ -171,6 +201,8 @@ proc gdb_collect_args_test {} {
set r "${r}argarray = <unavailable>${cr}"
gdb_test "info args" "$r" "info args"
+ test_maybe_regvar_display "argc"
+
gdb_test "tfind none" \
"#0 end .*" \
"cease trace debugging"
@@ -226,6 +258,8 @@ proc gdb_collect_locals_test { func msg } {
set r "${r}loci = <unavailable>${cr}"
gdb_test "info locals" "$r" "info locals"
+ test_maybe_regvar_display "loci"
+
gdb_test "tfind none" \
"#0 end .*" \
"cease trace debugging"