This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] PR python/11407


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

[patch 2/2] testsuite: dw2-ref-missing-frame for PR python/11407

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

Test on X8664 with no regressions.



Phil Muldoon


2010-06-24  Phil Muldoon  <>

	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);
+    {
+      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");

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]