This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] PR python/11407
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 24 Jun 2010 12:33:03 +0100
- Subject: [patch] PR python/11407
Hi,
This patch is for PR 11407. It also cures the ills in Jan's
test-case from last night:
[patch 1/2] testsuite: dw2-ref-missing-frame cleanup
http://sourceware.org/ml/gdb-patches/2010-06/msg00516.html
[patch 2/2] testsuite: dw2-ref-missing-frame for PR python/11407
http://sourceware.org/ml/gdb-patches/2010-06/msg00515.html
As the source between the Python issues and Jan's are similar, Jan's
patch will form the test-case for this patch.
There are many functions/commands in GDB that iterate over
variables to produce output of one type or another. bt full, info
locals, -stack-list-locals are just a few of many different sources that
rely on this functionality. In the current GDB, if during this recursion an
error is raised at any point from the request down (and some of these
calls result in very deep calls stacks), the whole recursion is
terminated (as the exception reached the top level). This is
undesirable -- we should cope with the error and continue to recurse
the other data.
This patch fixes this issue in the last common denominator in each
of the commands before they diverge. This patch catches the
exception at the print level and prints a message with the exception
message.
Test on X8664 with no regressions.
OK?
Cheers,
Phil Muldoon
--
2010-06-24 Phil Muldoon <pmuldoon@redhat.com>
PR python/11407
* printcmd.c (print_variable_and_value): Print error message on
caught exception.
--
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 430ccee..07abc2d 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1944,15 +1944,21 @@ print_variable_and_value (const char *name, struct symbol *var,
{
struct value *val;
struct value_print_options opts;
+ volatile struct gdb_exception except;
if (!name)
name = SYMBOL_PRINT_NAME (var);
fprintf_filtered (stream, "%s%s = ", n_spaces (2 * indent), name);
-
- val = read_var_value (var, frame);
- get_user_print_options (&opts);
- common_val_print (val, stream, indent, &opts, current_language);
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ val = read_var_value (var, frame);
+ get_user_print_options (&opts);
+ common_val_print (val, stream, indent, &opts, current_language);
+ }
+ if (except.reason < 0)
+ fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
+ except.message);
fprintf_filtered (stream, "\n");
}