From: Nick Roberts <nickrob@snap.net.nz>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: cleanup mi error message handling
Date: Mon, 24 Mar 2008 22:04:00 -0000 [thread overview]
Message-ID: <18408.9553.683746.929167@kahikatea.snap.net.nz> (raw)
In-Reply-To: <200803241830.11759.pedro@codesourcery.com>
> Notice the duplication:
> &"The program is not being run.\n"
> ^error,msg="The program is not being run."
>
> I can't find a valid reason for that.
> In fact having them display in gdb's output window in a
> frontend doesn't help anyone, especially, since ^error is supposed
> to be the error output channel. Furthermore, there are a couple
> of cases that weren't using the mechanism correctly, as they
> were already calling error.
>
> The attached patch fixes it, and fixes the testsuite to not
> expect this duplication.
>
> --
> Pedro Alves
> gdb/
> 2008-03-24 Pedro Alves <pedro@codesourcery.com>
>
> * mi/mi-cmds.h (enum mi_cmd_result): Delete MI_CMD_ERROR.
> (mi_error_message): Delete declaration.
> * mi/mi-interp.c (mi_cmd_interpreter_exec): Call error instead of
> returning MI_CMD_ERROR.
> * mi/mi-main.c (mi_error_message): Delete.
> (mi_cmd_exec_interrupt):
> (mi_cmd_thread_select, mi_cmd_thread_list_ids)
> (mi_cmd_thread_info): Call error instead of returning
> MI_CMD_ERROR.
> (mi_cmd_data_list_register_values): Call error instead of
> returning MI_CMD_ERROR. Adapt to new get_register interface.
> (get_register): Change return typo to void. Call error instead of
> returning MI_CMD_ERROR.
> (mi_cmd_data_write_register_values): Call error instead of
> returning MI_CMD_ERROR.
> (mi_cmd_list_features): Return MI_CMD_DONE.
> (captured_mi_execute_command): Remove MI_CMD_ERROR handling.
> (mi_execute_command): Always print exceptions with -error.
The error message isn't duplicated when MI_CMD_ERROR is used, but the bulk
of this patch is about removing it. Duplication comes from the single
line:
exception_print (gdb_stderr, result);
in mi_execute_command.
I think sometimes errors are just needed when debugging the frontend, e.g.,
-thread-select
^error,msg="mi_cmd_thread_select: USAGE: threadnum."
(gdb)
where one error message is sufficient. Here I think Gdb is trying to mimic
perror by giving the name of the C procedure, but I think it's not desirable as
this gets printed due to a frontend error, not a Gdb error. So I would like to
see:
-thread-select
^error,msg="USAGE: threadnum."
(gdb)
At other times duplicated error messages are desirable, e.g.,
-exec-continue
^running
(gdb)
&"The program is not being run.\n"
^error,msg="The program is not being run."
because the first goes to the console for the user to see, the second to
the frontend to be handled as appropriate.
For this reason I would not like to see this patch applied.
I have previously suggested changes to MI's error reporting.
--
Nick http://www.inet.net.nz/~nickrob
next prev parent reply other threads:[~2008-03-24 22:04 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 [this message]
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
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=18408.9553.683746.929167@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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