Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb@sourceware.org
Subject: Re: Breakpoint commands in MI mode and "backtrace"
Date: Mon, 09 Oct 2017 12:02:00 -0000	[thread overview]
Message-ID: <fb95da6b-2390-f486-0806-291d24fbe766@simark.ca> (raw)
In-Reply-To: <83bmlgsqpm.fsf@gnu.org>

On 2017-10-09 03:52 AM, Eli Zaretskii wrote:
>> Date: Mon, 09 Oct 2017 10:27:15 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> CC: gdb@sourceware.org
>>
>>> Cc: gdb@sourceware.org
>>> From: Simon Marchi <simark@simark.ca>
>>> Date: Mon, 9 Oct 2017 00:16:28 -0400
>>>
>>> Hmm, strange.  It is a quite complex function being executed in the hookpost-backtrace.
>>> Do you have any idea what line generates the error?  It would be nice to have a
>>> reproducer without having to build emacs...
>>
>> It's this line in xgetsysm:
>>
>>     set $ptr = ((struct Lisp_Symbol *) ((char *)lispsym + $ptr))
>>
>> where $ptr is a pointer to a Lisp_Symbol object:
>>
>>   (gdb) p $ptr
>>   $2 = (struct Lisp_Symbol *) 0x17c9e38 <dumped_data+267384>
>>
>> and lispsym is an array:
>>
>>   (gdb) ptype lispsym
>>   type = struct {
>>       struct Lisp_Symbol s;
>>   } [1298]
>>
>> Let me know if I can provide more information about this.
> 
> Btw, with the patch, I get the same error if I invoke GDB in CLI mode.
> 
> Thanks.
> 

It's true that my patch seems to change how exceptions are handled, since
safe_execute_command catches and prints exceptions.  However, that expression
does indeed seem erroenous, and I'm surprised GDB doesn't complain about it
currently.  How can you add a char* and a listp_Symbol*?

Anyhow, can you try this patch here?  It changes the uiout manually instead of
going through safe_execute_command.


diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index f1db954a69..b08954132b 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,17 @@ 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);
+
+	struct interp *old_interp = interp_set_temp (INTERP_CONSOLE);
+	struct cleanup *old_chain = make_cleanup (restore_interp, old_interp);
+	scoped_restore save_uiout
+	  = make_scoped_restore (&current_uiout,
+		     current_interpreter ()->interp_ui_out ());
+
 	execute_command (&new_line[0], 0);
 	ret = cmd->control_type;
+
+	do_cleanups (old_chain);
 	break;
       }



  reply	other threads:[~2017-10-09 12:02 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
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 [this message]
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=fb95da6b-2390-f486-0806-291d24fbe766@simark.ca \
    --to=simark@simark.ca \
    --cc=eliz@gnu.org \
    --cc=gdb@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