public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] PR python/11407
@ 2010-06-24 11:33 Phil Muldoon
  2010-06-24 15:10 ` Jan Kratochvil
  2010-06-24 18:10 ` Tom Tromey
  0 siblings, 2 replies; 16+ messages in thread
From: Phil Muldoon @ 2010-06-24 11:33 UTC (permalink / raw)
  To: gdb-patches

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");
 }
 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-09-08 18:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-24 11:33 [patch] PR python/11407 Phil Muldoon
2010-06-24 15:10 ` Jan Kratochvil
2010-06-24 18:10 ` Tom Tromey
2010-06-24 22:01   ` Phil Muldoon
2010-06-25  6:56     ` Phil Muldoon
2010-06-25 14:27       ` Phil Muldoon
2010-06-25 18:25     ` Tom Tromey
2010-06-25 21:20       ` Phil Muldoon
2010-07-07 17:02         ` Phil Muldoon
2010-08-09 19:41           ` Phil Muldoon
2010-08-31 18:42             ` Phil Muldoon
2010-09-08 19:25         ` Tom Tromey
2010-06-26 17:10       ` Doug Evans
2010-06-28  6:26       ` André Pönitz
2010-06-28 16:52         ` Tom Tromey
2010-06-29  7:43           ` André Pönitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).