This is the mail archive of the gdb-patches@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]

[MI] change back quoting for some commands


Per discussion in http://permalink.gmane.org/gmane.comp.gdb.devel/23483, I've
checked in the below patch that makes some MI commands be routed via CLI,
with the effect that the quoting rules for those commands are back to what
they were in gdb 6.8. Specifically, the commands are:

	-exec-run
        -exec-until
        -target-download
        -target-select

I did not do the same with -exec-return, because currently it calls CLI
function, and then prints the frame, and if I make it directly routed to
CLI function, the frame will no longer be printed. And, -exec-return is
relatively low-risk as far as quoting is concerned.

I've manually tests that before this change,

	-exec-run "foo bar" "1 2"

manages to pass two arguments, "foo" and "bar" to the inferiour, whereas
after the change, it passes "foo bar" and "1 2", as expected. Checked in.

- Volodya

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.9505
diff -u -p -r1.9505 ChangeLog
--- gdb/ChangeLog	28 Jun 2008 17:29:02 -0000	1.9505
+++ gdb/ChangeLog	29 Jun 2008 17:09:29 -0000
@@ -1,3 +1,16 @@
+2008-06-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* mi/mi-cmds.c (mi_cmds): Route -exec-run, -exec-until,
+	-target-download and -target-select via CLI, so that
+	the quoting rules are the same as they were (unfortunately)
+	in all prior gdb releases.
+	* mi/mi-cmds.h (mi_cmd_exec_run, mi_cmd_exec_until)
+	(mi_cmd_target_download, mi_cmd_target_select): Remove.
+	* mi/mi-main.c (mi_cmd_exec_run, mi_cmd_exec_until)
+	(mi_cmd_target_download, mi_cmd_target_select): Remove.
+	(mi_cmd_execute): Set current_token even for commands
+	routed via CLI.
+
 2008-06-28  Ulrich Weigand  <uweigand@de.ibm.com>
 
 	* alphafbsd-tdep.c: Update for unwinder changes.
Index: gdb/mi/mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.32
diff -u -p -r1.32 mi-cmds.c
--- gdb/mi/mi-cmds.c	24 Apr 2008 13:28:06 -0000	1.32
+++ gdb/mi/mi-cmds.c	29 Jun 2008 17:09:29 -0000
@@ -64,12 +64,12 @@ struct mi_cmd mi_cmds[] =
   { "exec-next", { NULL, 0 }, mi_cmd_exec_next},
   { "exec-next-instruction", { NULL, 0 }, mi_cmd_exec_next_instruction},
   { "exec-return", { NULL, 0 }, mi_cmd_exec_return},
-  { "exec-run", { NULL, 0 }, mi_cmd_exec_run},
+  { "exec-run", { "run", 1 }, NULL},
   { "exec-show-arguments", { NULL, 0 }, NULL },
   { "exec-signal", { NULL, 0 }, NULL },
   { "exec-step", { NULL, 0 }, mi_cmd_exec_step},
   { "exec-step-instruction", { NULL, 0 }, mi_cmd_exec_step_instruction},
-  { "exec-until", { NULL, 0 }, mi_cmd_exec_until},
+  { "exec-until", { "until", 1 }, NULL},
   { "file-clear", { NULL, 0 }, NULL },
   { "file-exec-and-symbols", { "file", 1 }, NULL },
   { "file-exec-file", { "exec-file", 1 }, NULL },
@@ -121,7 +121,7 @@ struct mi_cmd mi_cmds[] =
   { "target-compare-sections", { NULL, 0 }, NULL },
   { "target-detach", { "detach", 0 }, 0 },
   { "target-disconnect", { "disconnect", 0 }, 0 },
-  { "target-download", { NULL, 0 }, mi_cmd_target_download},
+  { "target-download", { "load", 1 }, NULL},
   { "target-exec-status", { NULL, 0 }, NULL },
   { "target-file-delete", { NULL, 0 }, mi_cmd_target_file_delete },
   { "target-file-get", { NULL, 0 }, mi_cmd_target_file_get },
@@ -129,7 +129,7 @@ struct mi_cmd mi_cmds[] =
   { "target-list-available-targets", { NULL, 0 }, NULL },
   { "target-list-current-targets", { NULL, 0 }, NULL },
   { "target-list-parameters", { NULL, 0 }, NULL },
-  { "target-select", { NULL, 0 }, mi_cmd_target_select},
+  { "target-select", { "target", 1 }, NULL},
   { "thread-info", { NULL, 0 }, mi_cmd_thread_info },
   { "thread-list-ids", { NULL, 0 }, mi_cmd_thread_list_ids},
   { "thread-select", { NULL, 0 }, mi_cmd_thread_select},
Index: gdb/mi/mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.31
diff -u -p -r1.31 mi-cmds.h
--- gdb/mi/mi-cmds.h	25 Jun 2008 15:15:42 -0000	1.31
+++ gdb/mi/mi-cmds.h	29 Jun 2008 17:09:29 -0000
@@ -56,10 +56,8 @@ extern mi_cmd_argv_ftype mi_cmd_exec_fin
 extern mi_cmd_argv_ftype mi_cmd_exec_next;
 extern mi_cmd_argv_ftype mi_cmd_exec_next_instruction;
 extern mi_cmd_argv_ftype mi_cmd_exec_return;
-extern mi_cmd_argv_ftype mi_cmd_exec_run;
 extern mi_cmd_argv_ftype mi_cmd_exec_step;
 extern mi_cmd_argv_ftype mi_cmd_exec_step_instruction;
-extern mi_cmd_argv_ftype mi_cmd_exec_until;
 extern mi_cmd_argv_ftype mi_cmd_exec_interrupt;
 extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file;
 extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_files;
@@ -75,11 +73,9 @@ extern mi_cmd_argv_ftype mi_cmd_stack_li
 extern mi_cmd_argv_ftype mi_cmd_stack_list_locals;
 extern mi_cmd_argv_ftype mi_cmd_stack_select_frame;
 extern mi_cmd_argv_ftype mi_cmd_symbol_list_lines;
-extern mi_cmd_argv_ftype mi_cmd_target_download;
 extern mi_cmd_argv_ftype mi_cmd_target_file_get;
 extern mi_cmd_argv_ftype mi_cmd_target_file_put;
 extern mi_cmd_argv_ftype mi_cmd_target_file_delete;
-extern mi_cmd_argv_ftype mi_cmd_target_select;
 extern mi_cmd_argv_ftype mi_cmd_thread_info;
 extern mi_cmd_argv_ftype mi_cmd_thread_list_ids;
 extern mi_cmd_argv_ftype mi_cmd_thread_select;
Index: gdb/mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.120
diff -u -p -r1.120 mi-main.c
--- gdb/mi/mi-main.c	28 Jun 2008 11:53:34 -0000	1.120
+++ gdb/mi/mi-main.c	29 Jun 2008 17:09:29 -0000
@@ -107,13 +107,6 @@ mi_cmd_gdb_exit (char *command, char **a
 }
 
 void
-mi_cmd_exec_run (char *command, char **argv, int argc)
-{
-  /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  return mi_execute_async_cli_command ("run", argv, argc);
-}
-
-void
 mi_cmd_exec_next (char *command, char **argv, int argc)
 {
   /* FIXME: Should call a libgdb function, not a cli wrapper.  */
@@ -149,13 +142,6 @@ mi_cmd_exec_finish (char *command, char 
 }
 
 void
-mi_cmd_exec_until (char *command, char **argv, int argc)
-{
-  /* FIXME: Should call a libgdb function, not a cli wrapper.  */
-  return mi_execute_async_cli_command ("until", argv, argc);
-}
-
-void
 mi_cmd_exec_return (char *command, char **argv, int argc)
 {
   /* This command doesn't really execute the target, it just pops the
@@ -594,56 +580,6 @@ mi_cmd_data_evaluate_expression (char *c
   do_cleanups (old_chain);
 }
 
-void
-mi_cmd_target_download (char *command, char **argv, int argc)
-{
-  char *run;
-  struct cleanup *old_cleanups = NULL;
-
-  /* There may be at most one parameter -- the name of the
-     file to download.  */
-  run = xstrprintf ("load %s", argc ? *argv : "");
-  old_cleanups = make_cleanup (xfree, run);
-  execute_command (run, 0);
-
-  do_cleanups (old_cleanups);
-}
-
-/* Connect to the remote target.  */
-void
-mi_cmd_target_select (char *command, char **argv, int argc)
-{
-  char *run = NULL;
-  struct cleanup *old_cleanups = NULL;
-  int i;
-
-  if (argc == 0)
-    error ("no target type specified");
-    
-  for (i = 0; i < argc; ++i)
-    {
-      if (i == 0)
-	run = concat ("target ", argv[0], NULL);
-      else
-	{
-	  char *prev = run;
-	  run = concat (run, " ", argv[i], NULL);
-	  xfree (prev);
-	}
-    }
-  
-  old_cleanups = make_cleanup (xfree, run);
-
-  /* target-select is always synchronous.  Once the call has returned
-     we know that we are connected.  */
-  /* NOTE: At present all targets that are connected are also
-     (implicitly) talking to a halted target.  In the future this may
-     change.  */
-  execute_command (run, 0);
-
-  do_cleanups (old_cleanups);
-}
-
 /* DATA-MEMORY-READ:
 
    ADDR: start address of data to be dumped.
@@ -1118,6 +1054,9 @@ mi_cmd_execute (struct mi_parse *parse)
   struct cleanup *cleanup;
   free_all_values ();
 
+  current_token = xstrdup (parse->token);
+  cleanup = make_cleanup (free_current_contents, &current_token);
+
   if (parse->cmd->argv_func != NULL)
     {
       if (target_executing)
@@ -1135,10 +1074,7 @@ mi_cmd_execute (struct mi_parse *parse)
 	      error_stream (stb);
 	    }
 	}
-      current_token = xstrdup (parse->token);
-      cleanup = make_cleanup (free_current_contents, &current_token);
       parse->cmd->argv_func (parse->command, parse->argv, parse->argc);
-      do_cleanups (cleanup);
     }
   else if (parse->cmd->cli.cmd != 0)
     {
@@ -1162,6 +1098,7 @@ mi_cmd_execute (struct mi_parse *parse)
       make_cleanup_ui_file_delete (stb);
       error_stream (stb);
     }
+  do_cleanups (cleanup);
 }
 
 /* FIXME: This is just a hack so we can get some extra commands going.

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