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]

Re: [PATCH] Fix -exec-run not running asynchronously with mi-async on


On 2016-05-17 14:56, Pedro Alves wrote:
On 05/07/2016 12:23 PM, Simon Marchi wrote:

diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 7cb7bf5..904cee0 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -415,6 +415,8 @@ run_one_inferior (struct inferior *inf, void *arg)
 {
   int start_p = *(int *) arg;
   const char *run_cmd = start_p ? "start" : "run";
+  struct target_ops *run_target = find_run_target ();
+  int async_p = run_target->to_can_async_p (run_target) && mi_async;

It's standard practice to put the cheap check first:

  int async_p = mi_async && run_target->to_can_async_p (run_target);

I think it reads a bit more naturally, even.

Agreed, done.

@@ -489,9 +491,11 @@ mi_cmd_exec_run (char *command, char **argv, int argc)
   else
     {
       const char *run_cmd = start_p ? "start" : "run";
+      struct target_ops *run_target = find_run_target ();
+ int async_p = run_target->to_can_async_p (run_target) && mi_async;

Ditto.

Done.


-      mi_execute_cli_command (run_cmd, mi_async_p (),
-			      mi_async_p () ? "&" : NULL);
+      mi_execute_cli_command (run_cmd, async_p,
+			      async_p ? "&" : NULL);
     }
 }


+int main ()

Line break after int.

Done.

+{
+  int i;
+
+  for (i = 0; i < 30; i++)
+    {
+      sleep (1);
+    }
+
+  return 0;
+}

Otherwise OK, master and 7.11.1.

Thanks, pushed to master and gdb-7.11-branch.

Simon


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