This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Breakpoint commands in MI mode and "backtrace"


On 2017-10-08 02:26 PM, Eli Zaretskii wrote:
> This doesn't compile when applied to GDB 8.0 code.  Can the same be
> done with the scoped_restore class instead?

I don't know, maybe.  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;
       }

> 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.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]