From: Nick Roberts <nickrob@snap.net.nz>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Catch errors in value_get_print_value
Date: Thu, 08 Feb 2007 22:19:00 -0000 [thread overview]
Message-ID: <17867.41420.663991.707406@kahikatea.snap.net.nz> (raw)
In-Reply-To: <20070208174131.GC13544@nevyn.them.org>
> > Currently when common_val_print throws an error from install_new_value it gets
> > caught in mi_execute_command and prints an MI error (^error,...) without
> > cleaning up. This patch catches the error in value_get_print_value so that GDB
> > can proceed normally. It could be adapted to output something like
> > "<error_reading_variable>" but I think the empty string works better.
>
> Could you explain why? I would be confused to see an empty value in
> my locals window. That's separate from this bug though.
It's much quieter than a window full of error/warning messages. If there's no
value available, the frontend doesn't show one. That seems logical to me but
perhaps only because I'm used to it.
> > ! TRY_CATCH (except, RETURN_MASK_ERROR)
> > ! {
> > ! common_val_print (value, stb, format_code[(int) format], 1, 0, 0);
> > ! }
> > !
>
> val_print, called by common_val_print, already has code to catch this
> error and prettyprint it.
Yes but I think the error is in value_contents_all. It's the only way that I can
catch it in varobj.c.
...
> So I checked this in instead. Let me know if it doesn't work for you.
>
> --
> Daniel Jacobowitz
> CodeSourcery
>
> 2007-02-08 Daniel Jacobowitz <dan@codesourcery.com>
>
> * varobj.c (install_new_value): Only call value_get_print_value
> if changeable.
>
> Index: varobj.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/varobj.c,v
> retrieving revision 1.82
> diff -u -p -r1.82 varobj.c
> --- varobj.c 24 Jan 2007 19:54:13 -0000 1.82
> +++ varobj.c 8 Feb 2007 17:38:36 -0000
> @@ -953,7 +953,7 @@ install_new_value (struct varobj *var, s
> /* If the type is changeable, compare the old and the new values.
> If this is the initial assignment, we don't have any old value
> to compare with. */
> - if (initial)
> + if (initial && changeable)
> var->print_value = value_get_print_value (value, var->format);
> else if (changeable)
> {
Thanks. This is clearly a better patch as it's much simpler. Thinking more
generally, I wonder if there are other cases where value_contents_all should
catch this error?
--
Nick http://www.inet.net.nz/~nickrob
next prev parent reply other threads:[~2007-02-08 22:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-01 20:51 Nick Roberts
2007-02-08 17:41 ` Daniel Jacobowitz
2007-02-08 22:19 ` Nick Roberts [this message]
2007-02-08 22:25 ` Daniel Jacobowitz
2007-02-09 2:21 ` Nick Roberts
2007-02-09 2:26 ` Daniel Jacobowitz
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=17867.41420.663991.707406@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=drow@false.org \
--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