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.
This commit is contained in:
parent
d989b28323
commit
af6e93b2d1
5 changed files with 59 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2011-08-05 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2011-08-05 Eli Zaretskii <eliz@gnu.org>
|
2011-08-05 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Move the
|
* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Move the
|
||||||
|
|
|
@ -223,7 +223,6 @@ throw_exception (struct gdb_exception exception)
|
||||||
bpstat_clear_actions (tp->control.stop_bpstat);
|
bpstat_clear_actions (tp->control.stop_bpstat);
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_current_display ();
|
|
||||||
do_cleanups (ALL_CLEANUPS);
|
do_cleanups (ALL_CLEANUPS);
|
||||||
|
|
||||||
/* Jump to the containing catch_errors() call, communicating REASON
|
/* Jump to the containing catch_errors() call, communicating REASON
|
||||||
|
|
|
@ -1656,6 +1656,14 @@ undisplay_command (char *args, int from_tty)
|
||||||
dont_repeat ();
|
dont_repeat ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cleanup that just disables the current display. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
disable_current_display_cleanup (void *arg)
|
||||||
|
{
|
||||||
|
disable_current_display ();
|
||||||
|
}
|
||||||
|
|
||||||
/* Display a single auto-display.
|
/* Display a single auto-display.
|
||||||
Do nothing if the display cannot be printed in the current context,
|
Do nothing if the display cannot be printed in the current context,
|
||||||
or if the display is disabled. */
|
or if the display is disabled. */
|
||||||
|
@ -1663,6 +1671,7 @@ undisplay_command (char *args, int from_tty)
|
||||||
static void
|
static void
|
||||||
do_one_display (struct display *d)
|
do_one_display (struct display *d)
|
||||||
{
|
{
|
||||||
|
struct cleanup *old_chain;
|
||||||
int within_current_scope;
|
int within_current_scope;
|
||||||
|
|
||||||
if (d->enabled_p == 0)
|
if (d->enabled_p == 0)
|
||||||
|
@ -1715,6 +1724,7 @@ do_one_display (struct display *d)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current_display_number = d->number;
|
current_display_number = d->number;
|
||||||
|
old_chain = make_cleanup (disable_current_display_cleanup, NULL);
|
||||||
|
|
||||||
annotate_display_begin ();
|
annotate_display_begin ();
|
||||||
printf_filtered ("%d", d->number);
|
printf_filtered ("%d", d->number);
|
||||||
|
@ -1782,6 +1792,7 @@ do_one_display (struct display *d)
|
||||||
annotate_display_end ();
|
annotate_display_end ();
|
||||||
|
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
|
discard_cleanups (old_chain);
|
||||||
current_display_number = -1;
|
current_display_number = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>
|
2011-08-05 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
* gdb.base/callfuncs.exp: Set language after main.
|
* gdb.base/callfuncs.exp: Set language after main.
|
||||||
|
|
|
@ -103,6 +103,36 @@ proc run_trace_experiment { test_func } {
|
||||||
"tfind test frame"
|
"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
|
# Test procs
|
||||||
#
|
#
|
||||||
|
@ -171,6 +201,8 @@ proc gdb_collect_args_test {} {
|
||||||
set r "${r}argarray = <unavailable>${cr}"
|
set r "${r}argarray = <unavailable>${cr}"
|
||||||
gdb_test "info args" "$r" "info args"
|
gdb_test "info args" "$r" "info args"
|
||||||
|
|
||||||
|
test_maybe_regvar_display "argc"
|
||||||
|
|
||||||
gdb_test "tfind none" \
|
gdb_test "tfind none" \
|
||||||
"#0 end .*" \
|
"#0 end .*" \
|
||||||
"cease trace debugging"
|
"cease trace debugging"
|
||||||
|
@ -226,6 +258,8 @@ proc gdb_collect_locals_test { func msg } {
|
||||||
set r "${r}loci = <unavailable>${cr}"
|
set r "${r}loci = <unavailable>${cr}"
|
||||||
gdb_test "info locals" "$r" "info locals"
|
gdb_test "info locals" "$r" "info locals"
|
||||||
|
|
||||||
|
test_maybe_regvar_display "loci"
|
||||||
|
|
||||||
gdb_test "tfind none" \
|
gdb_test "tfind none" \
|
||||||
"#0 end .*" \
|
"#0 end .*" \
|
||||||
"cease trace debugging"
|
"cease trace debugging"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue