This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix -exec-run not running asynchronously with mi-async on
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>, gdb-patches at sourceware dot org
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>
- Date: Tue, 17 May 2016 19:56:53 +0100
- Subject: Re: [PATCH] Fix -exec-run not running asynchronously with mi-async on
- Authentication-results: sourceware.org; auth=none
- References: <1462620227-1032-1-git-send-email-simon dot marchi at polymtl dot ca>
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.
> @@ -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.
>
> - 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.
> +{
> + int i;
> +
> + for (i = 0; i < 30; i++)
> + {
> + sleep (1);
> + }
> +
> + return 0;
> +}
Otherwise OK, master and 7.11.1.
Thanks,
Pedro Alves