public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] PR python/11407
Date: Thu, 24 Jun 2010 11:33:00 -0000	[thread overview]
Message-ID: <4C23426F.4020502@redhat.com> (raw)

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

             reply	other threads:[~2010-06-24 11:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24 11:33 Phil Muldoon [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C23426F.4020502@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).