From: Vladimir Prus <ghost@cs.msu.su>
To: gdb-patches@sources.redhat.com
Subject: Re: cleanup mi error message handling
Date: Fri, 04 Apr 2008 13:33:00 -0000 [thread overview]
Message-ID: <ft577v$9cg$1@ger.gmane.org> (raw)
In-Reply-To: <200803241830.11759.pedro@codesourcery.com>
Pedro Alves wrote:
> Index: src/gdb/mi/mi-main.c
> ===================================================================
> --- src.orig/gdb/mi/mi-main.c   2008-03-23 19:56:34.000000000 +0000
> +++ src/gdb/mi/mi-main.c        2008-03-23 20:00:02.000000000 +0000
> @@ -96,7 +96,6 @@ static int do_timings = 0;
> Â /* The token of the last asynchronous command. Â */
> Â static char *last_async_command;
> Â static char *previous_async_command;
> -char *mi_error_message;
> Â
> Â extern void _initialize_mi_main (void);
> Â static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse);
> @@ -109,7 +108,7 @@ static void mi_exec_async_cli_cmd_contin
> Â
> Â static int register_changed_p (int regnum, struct regcache *,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct regcache *);
> -static int get_register (int regnum, int format);
> +static void get_register (int regnum, int format);
> Â
> Â /* Command implementations. Â FIXME: Is this libgdb? Â No. Â This is the MI
> Â Â layer that calls libgdb. Â Any operation used in the below should be
> @@ -219,10 +218,8 @@ enum mi_cmd_result
> Â mi_cmd_exec_interrupt (char *args, int from_tty)
> Â {
> Â Â if (!target_executing)
> - Â Â {
> - Â Â Â mi_error_message = xstrprintf ("mi_cmd_exec_interrupt: Inferior not executing.");
> - Â Â Â return MI_CMD_ERROR;
> - Â Â }
> + Â Â error ("mi_cmd_exec_interrupt: Inferior not executing.");
> +
> Â Â interrupt_target_command (args, from_tty);
> Â Â if (last_async_command)
> Â Â Â fputs_unfiltered (last_async_command, raw_stdout);
> @@ -242,38 +239,40 @@ enum mi_cmd_result
> Â mi_cmd_thread_select (char *command, char **argv, int argc)
> Â {
> Â Â enum gdb_rc rc;
> + Â char *mi_error_message;
> Â
> Â Â if (argc != 1)
> + Â Â error ("mi_cmd_thread_select: USAGE: threadnum.");
> +
> + Â rc = gdb_thread_select (uiout, argv[0], &mi_error_message);
> +
> + Â if (rc == GDB_RC_FAIL)
> Â Â Â {
> - Â Â Â mi_error_message = xstrprintf ("mi_cmd_thread_select: USAGE: threadnum.");
> - Â Â Â return MI_CMD_ERROR;
> + Â Â Â make_cleanup (xfree, mi_error_message);
> + Â Â Â error ("%s", mi_error_message);
Oh, so first gdb_thread_select catches exception and converts it to string,
and then we throw that string again? Eek, but guess we can fix that with
a separate patch.
This patch is OK. Please be sure to re-run the MI testsuite before checking in,
though, as there were various testsuite changes recently.
Thanks,
Volodya
next prev parent reply other threads:[~2008-04-04 12:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-24 18:30 Pedro Alves
2008-03-24 19:08 ` Pedro Alves
2008-03-24 22:04 ` Nick Roberts
2008-03-24 22:39 ` Daniel Jacobowitz
2008-03-24 23:37 ` Nick Roberts
2008-03-25 1:00 ` Daniel Jacobowitz
2008-03-25 1:29 ` Nick Roberts
2008-03-25 2:12 ` Daniel Jacobowitz
2008-03-29 14:22 ` Vladimir Prus
2008-03-30 5:13 ` Nick Roberts
2008-03-30 6:06 ` Vladimir Prus
2008-03-31 0:46 ` Nick Roberts
2008-03-31 1:59 ` Daniel Jacobowitz
2008-03-31 2:23 ` Nick Roberts
2008-03-31 5:07 ` Vladimir Prus
2008-03-31 6:36 ` Nick Roberts
2008-03-31 7:10 ` Vladimir Prus
2008-03-31 15:17 ` Pedro Alves
2008-03-31 11:24 ` Pedro Alves
2008-04-01 2:00 ` Pedro Alves
2008-04-01 0:18 ` Pedro Alves
2008-04-01 13:17 ` Nick Roberts
2008-04-01 3:28 ` Nick Roberts
2008-03-25 3:52 ` Pedro Alves
2008-04-04 13:33 ` Vladimir Prus [this message]
2008-04-04 23:08 ` Pedro Alves
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='ft577v$9cg$1@ger.gmane.org' \
--to=ghost@cs.msu.su \
--cc=gdb-patches@sources.redhat.com \
/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