From: Eli Zaretskii <eliz@gnu.org>
To: Simon Marchi <simark@simark.ca>
Cc: gdb@sourceware.org
Subject: Re: Breakpoint commands in MI mode and "backtrace"
Date: Sun, 08 Oct 2017 20:03:00 -0000 [thread overview]
Message-ID: <83o9phs8zw.fsf@gnu.org> (raw)
In-Reply-To: <e65519d3-37e8-06f0-cd5a-d7e6b7aaf31d@simark.ca> (message from Simon Marchi on Sun, 8 Oct 2017 15:24:21 -0400)
> Cc: gdb@sourceware.org
> From: Simon Marchi <simark@simark.ca>
> Date: Sun, 8 Oct 2017 15:24:21 -0400
>
> But here's the equivalent version with the corresponding cleanup,
> that applies on the 8.0 branch:
>
> diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
> index f1db954a69..34ae4966de 100644
> --- a/gdb/cli/cli-script.c
> +++ b/gdb/cli/cli-script.c
> @@ -472,6 +472,8 @@ print_command_trace (const char *cmd)
> printf_filtered ("%s\n", cmd);
> }
>
> +static void restore_interp (void *arg);
> +
> enum command_control_type
> execute_control_command (struct command_line *cmd)
> {
> @@ -491,8 +493,14 @@ execute_control_command (struct command_line *cmd)
> {
> /* A simple command, execute it and return. */
> std::string new_line = insert_user_defined_cmd_args (cmd->line);
> - execute_command (&new_line[0], 0);
> +
> + struct interp *old_interp = interp_set_temp (INTERP_CONSOLE);
> + struct cleanup *old_chain = make_cleanup (restore_interp, old_interp);
> +
> + current_interpreter ()->exec (&new_line[0]);
> ret = cmd->control_type;
> +
> + do_cleanups (old_chain);
> break;
> }
Thanks, this works, but it seems to fail hookpost hooks. The Emacs
.gdbinit file defines a hookpost-backtrace command to produce a
Lisp-level backtrace, and with this change that fails:
~"Lisp Backtrace:\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
&"Argument to arithmetic operation not a number or boolean.\n"
Whereas without the patch, the C-level backtrace is not shown, but the
Lisp-level backtrace is shown correctly:
~"Lisp Backtrace:\n"
~"\"redraw-display\""
~" (0x82de90)\n"
~"\"funcall-interactively\""
~" (0x82de88)\n"
~"\"call-interactively\""
~" (0x82e1e0)\n"
~"\"command-execute\""
~" (0x82e738)\n"
~"\"execute-extended-command\""
~" (0x82ee20)\n"
~"\"funcall-interactively\""
~" (0x82ee18)\n"
~"\"call-interactively\""
~" (0x82f220)\n"
~"\"command-execute\""
~" (0x82f748)\n"
> > In any case, there are more instances of calls to execute_command in
> > that function, and I guess they all need to be changed like that?
>
> I don't see any other call.
You are right, sorry.
Thanks.
next prev parent reply other threads:[~2017-10-08 20:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-08 10:08 Eli Zaretskii
[not found] ` <8a3d7153-7486-032f-aabc-6c3453f96459@simark.ca>
2017-10-08 18:27 ` Eli Zaretskii
2017-10-08 19:24 ` Simon Marchi
2017-10-08 20:03 ` Eli Zaretskii [this message]
2017-10-09 4:16 ` Simon Marchi
2017-10-09 7:27 ` Eli Zaretskii
2017-10-09 7:52 ` Eli Zaretskii
2017-10-09 12:02 ` Simon Marchi
2017-10-09 12:59 ` Eli Zaretskii
2017-10-21 8:26 ` Eli Zaretskii
2017-10-21 14:13 ` Simon Marchi
2017-10-21 16:27 ` Eli Zaretskii
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=83o9phs8zw.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb@sourceware.org \
--cc=simark@simark.ca \
/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