* [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets
@ 2013-08-27 14:01 Muhammad Bilal
2013-08-28 9:10 ` Yao Qi
2013-09-04 12:35 ` Muhammad Bilal
0 siblings, 2 replies; 7+ messages in thread
From: Muhammad Bilal @ 2013-08-27 14:01 UTC (permalink / raw)
To: gdb-patches
Hi,
While I was playing with non-stop thread debugging, I have observed that.
In the case of 'interrupt -a&' command gdb sends only one packet to
stop all threads as $vCont;t#b9...
But in case of 'thread apply all interrupt&' GDB issues individual
packet for each thread.I think that In non-stop mode
'interrupt -a&' and 'thread apply all interrupt&' commands are equals
but time efficiency of later command is less.
Also,
If user issues a command like 'thread apply all interrupt -a&'
GDB accepts it and GDB will stop all threads on first vcount;t packets
but due to loops iteration on all threads,
GDB sends vcount;t packet for all remaining threads although GDB has
already stop all thread so IMO it is a bug.
2013-08-28 Muhammad Bilal <mbilal@codesourcery.com>
PR gdb/15853
* thread.c (thread_apply_all_command): Lookup 'interrupt' command
using 'lookup_cmd_composition', 'find_command_name_length'
functions and execute single command for all threads.
* infcmd.c (interrupt_target_command): Issue a warning on
'thread apply all interrupt -a&' command.
(interrupt_all_threads): Define as global.
(all_threads): Removed.
* inferior.h (interrupt_all_threads): Declare.
* cli/cli-decode.c (find_cmd): Change definition from
static to global.
(lookup_cmd_composition): Check command ambiguousness
with 'nfound' instead of CMD_LIST_AMBIGUOUS.
* command.h (find_command_name_length): Declare.
---
gdb/cli/cli-decode.c | 4 ++--
gdb/command.h | 2 ++
gdb/infcmd.c | 13 +++++++++----
gdb/inferior.h | 3 +++
gdb/thread.c | 15 +++++++++++++++
5 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 2fdd9e4..a1a3510 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1232,7 +1232,7 @@ find_cmd (const char *command, int len, struct
cmd_list_element *clist,
return found;
}
-static int
+int
find_command_name_length (const char *text)
{
const char *p = text;
@@ -1729,7 +1729,7 @@ lookup_cmd_composition (const char *text,
*cmd = find_cmd (command, len, cur_list, 1, &nfound);
}
- if (*cmd == CMD_LIST_AMBIGUOUS)
+ if (nfound > 1)CMD_LIST_AMBIGUOUS
{
return 0; /* ambiguous */
}
diff --git a/gdb/command.h b/gdb/command.h
index 81edc43..83040a3 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -397,4 +397,6 @@ extern int cmd_func_p (struct cmd_list_element *cmd);
extern void cmd_func (struct cmd_list_element *cmd,
char *args, int from_tty);
+extern int find_command_name_length (const char *text);
+
#endif /* !defined (COMMAND_H) */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 154cde2..9bc0999 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2776,23 +2776,28 @@ interrupt_target_1 (int all_threads)
if the `-a' switch is used. */
/* interrupt [-a] */
+int interrupt_all_threads = 0;
static void
interrupt_target_command (char *args, int from_tty)
{
if (target_can_async_p ())
{
- int all_threads = 0;
dont_repeat (); /* Not for the faint of heart. */
if (args != NULL
&& strncmp (args, "-a", sizeof ("-a") - 1) == 0)
- all_threads = 1;
+ {
+ if (interrupt_all_threads)
+ error (_("-a is meaningless in thread apply all command."));
+ interrupt_all_threads = 1;
+ }
- if (!non_stop && all_threads)
+ if (!non_stop && interrupt_all_threads)
error (_("-a is meaningless in all-stop mode."));
- interrupt_target_1 (all_threads);
+ interrupt_target_1 (interrupt_all_threads);
+ interrupt_all_threads = 0;
}
}
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 2a5770d..464511a 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -128,6 +128,9 @@ extern int detach_fork;
system's address space randomization feature when starting an
inferior. */
extern int disable_randomization;
+/* If set, in non_stop 'interrupt' command will be apply on all
threads. */
+extern int interrupt_all_threads;
+
extern void generic_mourn_inferior (void);
extern void terminal_save_ours (void);
diff --git a/gdb/thread.c b/gdb/thread.c
index 78851e4..fea6aed 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1216,6 +1216,9 @@ thread_apply_all_command (char *cmd, int from_tty)
char *saved_cmd;
int tc;
struct thread_array_cleanup ta_cleanup;
+ struct cmd_list_element *alias = NULL;
+ struct cmd_list_element *prefix_cmd = NULL;
+ struct cmd_list_element *command = NULL;
if (cmd == NULL || *cmd == '\000')
error (_("Please specify a command following the thread ID list"));
@@ -1224,6 +1227,18 @@ thread_apply_all_command (char *cmd, int from_tty)
old_chain = make_cleanup_restore_current_thread ();
+ /* If there is 'interrupt' command in non-stop mode. */
+ if (non_stop
+ && lookup_cmd_composition (cmd, &alias, &prefix_cmd, &command)
+ && !strncmp (cmd, "interrupt", find_command_name_length(cmd)))
+ {
+ interrupt_all_threads = 1;
+ execute_command (cmd, from_tty);
+ do_cleanups (old_chain);
+ interrupt_all_threads = 0;
+ return;
+ }
+
/* Save a copy of the command in case it is clobbered by
execute_command. */
saved_cmd = xstrdup (cmd);
--
1.7.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets
2013-08-27 14:01 [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets Muhammad Bilal
@ 2013-08-28 9:10 ` Yao Qi
2013-09-17 16:46 ` Pedro Alves
2013-09-04 12:35 ` Muhammad Bilal
1 sibling, 1 reply; 7+ messages in thread
From: Yao Qi @ 2013-08-28 9:10 UTC (permalink / raw)
To: Muhammad Bilal; +Cc: gdb-patches
On 08/27/2013 10:00 PM, Muhammad Bilal wrote:
> In the case of 'interrupt -a&' command gdb sends only one packet to
> stop all threads as $vCont;t#b9...
Here is the doc on "interrupt -a",
interrupt
interrupt -a
Suspend execution of the running program. In all-stop mode, interrupt
stops the whole process, but in non-stop mode, it stops only the
current thread. To stop the whole program in non-stop mode, use
interrupt -a.
The "whole program" is ambiguous in multi-process debugging. IMO,
"whole program" means the process. That is to say, "interrupt -a" only
applies to the threads in the process. Threads in other processes are
not affected. However, that is not true. I tried "interrupt -a" in a
multi-inferior of multi-thread program, it stops *all* threads in *all*
inferiors.
The comments are clear,
/* Stop the execution of the target while running in async mode, in
the backgound. In all-stop, stop the whole process. In non-stop
mode, stop the current thread only by default, or stop all threads
if the `-a' switch is used. */
/* interrupt [-a] */
static void
interrupt_target_command (char *args, int from_tty)
What is the expect scope of "interrupt -a"? current process or all
processes?
>
> But in case of 'thread apply all interrupt&' GDB issues individual
> packet for each thread.I think that In non-stop mode
> 'interrupt -a&' and 'thread apply all interrupt&' commands are equals
> but time efficiency of later command is less.
>
> Also,
>
> If user issues a command like 'thread apply all interrupt -a&'
> GDB accepts it and GDB will stop all threads on first vcount;t packets
> but due to loops iteration on all threads,
> GDB sends vcount;t packet for all remaining threads although GDB has
> already stop all thread so IMO it is a bug.
It is less efficient, but not a bug me. Optimization to this special
case looks not good to me. It adds extra complexities, but the gain is
limited AFAICS.
IMO, the real program here is that we need ITSET to describe a
set of arbitrary processes and thread to the remote target through
protocol.
$vCont;t:[t7786-7788] // stop thread 7786 to thread 7788.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets
2013-08-27 14:01 [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets Muhammad Bilal
2013-08-28 9:10 ` Yao Qi
@ 2013-09-04 12:35 ` Muhammad Bilal
2013-09-10 10:32 ` Muhammad Bilal
1 sibling, 1 reply; 7+ messages in thread
From: Muhammad Bilal @ 2013-09-04 12:35 UTC (permalink / raw)
To: gdb-patches
On 08/27/2013 07:00 PM, Muhammad Bilal wrote:
> Hi,
> While I was playing with non-stop thread debugging, I have observed that.
>
> In the case of 'interrupt -a&' command gdb sends only one packet to
> stop all threads as $vCont;t#b9...
>
> But in case of 'thread apply all interrupt&' GDB issues individual
> packet for each thread.I think that In non-stop mode
> 'interrupt -a&' and 'thread apply all interrupt&' commands are equals
> but time efficiency of later command is less.
>
> Also,
>
> If user issues a command like 'thread apply all interrupt -a&'
> GDB accepts it and GDB will stop all threads on first vcount;t
> packets but due to loops iteration on all threads,
> GDB sends vcount;t packet for all remaining threads although GDB has
> already stop all thread so IMO it is a bug.
>
>
> 2013-08-28 Muhammad Bilal <mbilal@codesourcery.com>
>
> PR gdb/15853
> * thread.c (thread_apply_all_command): Lookup 'interrupt' command
> using 'lookup_cmd_composition', 'find_command_name_length'
> functions and execute single command for all threads.
> * infcmd.c (interrupt_target_command): Issue a warning on
> 'thread apply all interrupt -a&' command.
> (interrupt_all_threads): Define as global.
> (all_threads): Removed.
> * inferior.h (interrupt_all_threads): Declare.
> * cli/cli-decode.c (find_cmd): Change definition from
> static to global.
> (lookup_cmd_composition): Check command ambiguousness
> with 'nfound' instead of CMD_LIST_AMBIGUOUS.
> * command.h (find_command_name_length): Declare.
> ---
> gdb/cli/cli-decode.c | 4 ++--
> gdb/command.h | 2 ++
> gdb/infcmd.c | 13 +++++++++----
> gdb/inferior.h | 3 +++
> gdb/thread.c | 15 +++++++++++++++
> 5 files changed, 31 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
> index 2fdd9e4..a1a3510 100644
> --- a/gdb/cli/cli-decode.c
> +++ b/gdb/cli/cli-decode.c
> @@ -1232,7 +1232,7 @@ find_cmd (const char *command, int len, struct
> cmd_list_element *clist,
> return found;
> }
>
> -static int
> +int
> find_command_name_length (const char *text)
> {
> const char *p = text;
> @@ -1729,7 +1729,7 @@ lookup_cmd_composition (const char *text,
> *cmd = find_cmd (command, len, cur_list, 1, &nfound);
> }
>
> - if (*cmd == CMD_LIST_AMBIGUOUS)
> + if (nfound > 1)CMD_LIST_AMBIGUOUS
> {
> return 0; /* ambiguous */
> }
> diff --git a/gdb/command.h b/gdb/command.h
> index 81edc43..83040a3 100644
> --- a/gdb/command.h
> +++ b/gdb/command.h
> @@ -397,4 +397,6 @@ extern int cmd_func_p (struct cmd_list_element *cmd);
> extern void cmd_func (struct cmd_list_element *cmd,
> char *args, int from_tty);
>
> +extern int find_command_name_length (const char *text);
> +
> #endif /* !defined (COMMAND_H) */
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index 154cde2..9bc0999 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -2776,23 +2776,28 @@ interrupt_target_1 (int all_threads)
> if the `-a' switch is used. */
>
> /* interrupt [-a] */
> +int interrupt_all_threads = 0;
> static void
> interrupt_target_command (char *args, int from_tty)
> {
> if (target_can_async_p ())
> {
> - int all_threads = 0;
>
> dont_repeat (); /* Not for the faint of heart. */
>
> if (args != NULL
> && strncmp (args, "-a", sizeof ("-a") - 1) == 0)
> - all_threads = 1;
> + {
> + if (interrupt_all_threads)
> + error (_("-a is meaningless in thread apply all command."));
> + interrupt_all_threads = 1;
> + }
>
> - if (!non_stop && all_threads)
> + if (!non_stop && interrupt_all_threads)
> error (_("-a is meaningless in all-stop mode."));
>
> - interrupt_target_1 (all_threads);
> + interrupt_target_1 (interrupt_all_threads);
> + interrupt_all_threads = 0;
> }
> }
>
> diff --git a/gdb/inferior.h b/gdb/inferior.h
> index 2a5770d..464511a 100644
> --- a/gdb/inferior.h
> +++ b/gdb/inferior.h
> @@ -128,6 +128,9 @@ extern int detach_fork;
> system's address space randomization feature when starting an
> inferior. */
> extern int disable_randomization;
>
> +/* If set, in non_stop 'interrupt' command will be apply on all
> threads. */
> +extern int interrupt_all_threads;
> +
> extern void generic_mourn_inferior (void);
>
> extern void terminal_save_ours (void);
> diff --git a/gdb/thread.c b/gdb/thread.c
> index 78851e4..fea6aed 100644
> --- a/gdb/thread.c
> +++ b/gdb/thread.c
> @@ -1216,6 +1216,9 @@ thread_apply_all_command (char *cmd, int from_tty)
> char *saved_cmd;
> int tc;
> struct thread_array_cleanup ta_cleanup;
> + struct cmd_list_element *alias = NULL;
> + struct cmd_list_element *prefix_cmd = NULL;
> + struct cmd_list_element *command = NULL;
>
> if (cmd == NULL || *cmd == '\000')
> error (_("Please specify a command following the thread ID list"));
> @@ -1224,6 +1227,18 @@ thread_apply_all_command (char *cmd, int from_tty)
>
> old_chain = make_cleanup_restore_current_thread ();
>
> + /* If there is 'interrupt' command in non-stop mode. */
> + if (non_stop
> + && lookup_cmd_composition (cmd, &alias, &prefix_cmd, &command)
> + && !strncmp (cmd, "interrupt", find_command_name_length(cmd)))
> + {
> + interrupt_all_threads = 1;
> + execute_command (cmd, from_tty);
> + do_cleanups (old_chain);
> + interrupt_all_threads = 0;
> + return;
> + }
> +
> /* Save a copy of the command in case it is clobbered by
> execute_command. */
> saved_cmd = xstrdup (cmd);
ping
Thanks,
-Bilal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets
2013-09-04 12:35 ` Muhammad Bilal
@ 2013-09-10 10:32 ` Muhammad Bilal
2013-09-17 16:30 ` Muhammad Bilal
0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Bilal @ 2013-09-10 10:32 UTC (permalink / raw)
To: gdb-patches
ping ^ 2
On 09/04/2013 05:34 PM, Muhammad Bilal wrote:
> On 08/27/2013 07:00 PM, Muhammad Bilal wrote:
>> Hi,
>> While I was playing with non-stop thread debugging, I have observed
>> that.
>>
>> In the case of 'interrupt -a&' command gdb sends only one packet to
>> stop all threads as $vCont;t#b9...
>>
>> But in case of 'thread apply all interrupt&' GDB issues individual
>> packet for each thread.I think that In non-stop mode
>> 'interrupt -a&' and 'thread apply all interrupt&' commands are equals
>> but time efficiency of later command is less.
>>
>> Also,
>>
>> If user issues a command like 'thread apply all interrupt -a&'
>> GDB accepts it and GDB will stop all threads on first vcount;t
>> packets but due to loops iteration on all threads,
>> GDB sends vcount;t packet for all remaining threads although GDB has
>> already stop all thread so IMO it is a bug.
>>
>>
>> 2013-08-28 Muhammad Bilal <mbilal@codesourcery.com>
>>
>> PR gdb/15853
>> * thread.c (thread_apply_all_command): Lookup 'interrupt' command
>> using 'lookup_cmd_composition', 'find_command_name_length'
>> functions and execute single command for all threads.
>> * infcmd.c (interrupt_target_command): Issue a warning on
>> 'thread apply all interrupt -a&' command.
>> (interrupt_all_threads): Define as global.
>> (all_threads): Removed.
>> * inferior.h (interrupt_all_threads): Declare.
>> * cli/cli-decode.c (find_cmd): Change definition from
>> static to global.
>> (lookup_cmd_composition): Check command ambiguousness
>> with 'nfound' instead of CMD_LIST_AMBIGUOUS.
>> * command.h (find_command_name_length): Declare.
>> ---
>> gdb/cli/cli-decode.c | 4 ++--
>> gdb/command.h | 2 ++
>> gdb/infcmd.c | 13 +++++++++----
>> gdb/inferior.h | 3 +++
>> gdb/thread.c | 15 +++++++++++++++
>> 5 files changed, 31 insertions(+), 6 deletions(-)
>>
>> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
>> index 2fdd9e4..a1a3510 100644
>> --- a/gdb/cli/cli-decode.c
>> +++ b/gdb/cli/cli-decode.c
>> @@ -1232,7 +1232,7 @@ find_cmd (const char *command, int len, struct
>> cmd_list_element *clist,
>> return found;
>> }
>>
>> -static int
>> +int
>> find_command_name_length (const char *text)
>> {
>> const char *p = text;
>> @@ -1729,7 +1729,7 @@ lookup_cmd_composition (const char *text,
>> *cmd = find_cmd (command, len, cur_list, 1, &nfound);
>> }
>>
>> - if (*cmd == CMD_LIST_AMBIGUOUS)
>> + if (nfound > 1)CMD_LIST_AMBIGUOUS
>> {
>> return 0; /* ambiguous */
>> }
>> diff --git a/gdb/command.h b/gdb/command.h
>> index 81edc43..83040a3 100644
>> --- a/gdb/command.h
>> +++ b/gdb/command.h
>> @@ -397,4 +397,6 @@ extern int cmd_func_p (struct cmd_list_element
>> *cmd);
>> extern void cmd_func (struct cmd_list_element *cmd,
>> char *args, int from_tty);
>>
>> +extern int find_command_name_length (const char *text);
>> +
>> #endif /* !defined (COMMAND_H) */
>> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
>> index 154cde2..9bc0999 100644
>> --- a/gdb/infcmd.c
>> +++ b/gdb/infcmd.c
>> @@ -2776,23 +2776,28 @@ interrupt_target_1 (int all_threads)
>> if the `-a' switch is used. */
>>
>> /* interrupt [-a] */
>> +int interrupt_all_threads = 0;
>> static void
>> interrupt_target_command (char *args, int from_tty)
>> {
>> if (target_can_async_p ())
>> {
>> - int all_threads = 0;
>>
>> dont_repeat (); /* Not for the faint of heart. */
>>
>> if (args != NULL
>> && strncmp (args, "-a", sizeof ("-a") - 1) == 0)
>> - all_threads = 1;
>> + {
>> + if (interrupt_all_threads)
>> + error (_("-a is meaningless in thread apply all command."));
>> + interrupt_all_threads = 1;
>> + }
>>
>> - if (!non_stop && all_threads)
>> + if (!non_stop && interrupt_all_threads)
>> error (_("-a is meaningless in all-stop mode."));
>>
>> - interrupt_target_1 (all_threads);
>> + interrupt_target_1 (interrupt_all_threads);
>> + interrupt_all_threads = 0;
>> }
>> }
>>
>> diff --git a/gdb/inferior.h b/gdb/inferior.h
>> index 2a5770d..464511a 100644
>> --- a/gdb/inferior.h
>> +++ b/gdb/inferior.h
>> @@ -128,6 +128,9 @@ extern int detach_fork;
>> system's address space randomization feature when starting an
>> inferior. */
>> extern int disable_randomization;
>>
>> +/* If set, in non_stop 'interrupt' command will be apply on all
>> threads. */
>> +extern int interrupt_all_threads;
>> +
>> extern void generic_mourn_inferior (void);
>>
>> extern void terminal_save_ours (void);
>> diff --git a/gdb/thread.c b/gdb/thread.c
>> index 78851e4..fea6aed 100644
>> --- a/gdb/thread.c
>> +++ b/gdb/thread.c
>> @@ -1216,6 +1216,9 @@ thread_apply_all_command (char *cmd, int from_tty)
>> char *saved_cmd;
>> int tc;
>> struct thread_array_cleanup ta_cleanup;
>> + struct cmd_list_element *alias = NULL;
>> + struct cmd_list_element *prefix_cmd = NULL;
>> + struct cmd_list_element *command = NULL;
>>
>> if (cmd == NULL || *cmd == '\000')
>> error (_("Please specify a command following the thread ID list"));
>> @@ -1224,6 +1227,18 @@ thread_apply_all_command (char *cmd, int
>> from_tty)
>>
>> old_chain = make_cleanup_restore_current_thread ();
>>
>> + /* If there is 'interrupt' command in non-stop mode. */
>> + if (non_stop
>> + && lookup_cmd_composition (cmd, &alias, &prefix_cmd, &command)
>> + && !strncmp (cmd, "interrupt", find_command_name_length(cmd)))
>> + {
>> + interrupt_all_threads = 1;
>> + execute_command (cmd, from_tty);
>> + do_cleanups (old_chain);
>> + interrupt_all_threads = 0;
>> + return;
>> + }
>> +
>> /* Save a copy of the command in case it is clobbered by
>> execute_command. */
>> saved_cmd = xstrdup (cmd);
> ping
>
>
> Thanks,
> -Bilal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets
2013-09-10 10:32 ` Muhammad Bilal
@ 2013-09-17 16:30 ` Muhammad Bilal
2013-09-17 16:48 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Muhammad Bilal @ 2013-09-17 16:30 UTC (permalink / raw)
To: gdb-patches
ping ^ 3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets
2013-08-28 9:10 ` Yao Qi
@ 2013-09-17 16:46 ` Pedro Alves
0 siblings, 0 replies; 7+ messages in thread
From: Pedro Alves @ 2013-09-17 16:46 UTC (permalink / raw)
To: Yao Qi; +Cc: Muhammad Bilal, gdb-patches
On 08/28/2013 10:09 AM, Yao Qi wrote:
> On 08/27/2013 10:00 PM, Muhammad Bilal wrote:
>> In the case of 'interrupt -a&' command gdb sends only one packet to
>> stop all threads as $vCont;t#b9...
>
> Here is the doc on "interrupt -a",
>
> interrupt
> interrupt -a
> Suspend execution of the running program. In all-stop mode, interrupt
> stops the whole process, but in non-stop mode, it stops only the
> current thread. To stop the whole program in non-stop mode, use
> interrupt -a.
>
> The "whole program" is ambiguous in multi-process debugging. IMO,
> "whole program" means the process. That is to say, "interrupt -a" only
> applies to the threads in the process. Threads in other processes are
> not affected. However, that is not true. I tried "interrupt -a" in a
> multi-inferior of multi-thread program, it stops *all* threads in *all*
> inferiors.
Yeah. IIRC, we taught GDB about non-stop before multi-inferior, and
when the latter was added, those bits of the docs weren't adjusted.
"-a" means all threads of all processes, everything.
> The comments are clear,
>
> /* Stop the execution of the target while running in async mode, in
> the backgound. In all-stop, stop the whole process. In non-stop
> mode, stop the current thread only by default, or stop all threads
> if the `-a' switch is used. */
>
> /* interrupt [-a] */
> static void
> interrupt_target_command (char *args, int from_tty)
>
> What is the expect scope of "interrupt -a"? current process or all
> processes?
All processes.
>> But in case of 'thread apply all interrupt&' GDB issues individual
>> packet for each thread.I think that In non-stop mode
>> 'interrupt -a&' and 'thread apply all interrupt&' commands are equals
>> but time efficiency of later command is less.
>>
>> Also,
>>
>> If user issues a command like 'thread apply all interrupt -a&'
>> GDB accepts it and GDB will stop all threads on first vcount;t packets
>> but due to loops iteration on all threads,
>> GDB sends vcount;t packet for all remaining threads although GDB has
>> already stop all thread so IMO it is a bug.
>
> It is less efficient, but not a bug me. Optimization to this special
> case looks not good to me. It adds extra complexities, but the gain is
> limited AFAICS.
Agreed.
> IMO, the real program here is that we need ITSET to describe a
> set of arbitrary processes and thread to the remote target through
> protocol.
>
> $vCont;t:[t7786-7788] // stop thread 7786 to thread 7788.
Not clear to me at this point how the protocol should exactly look
like, but agreed in principle.
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets
2013-09-17 16:30 ` Muhammad Bilal
@ 2013-09-17 16:48 ` Pedro Alves
0 siblings, 0 replies; 7+ messages in thread
From: Pedro Alves @ 2013-09-17 16:48 UTC (permalink / raw)
To: Muhammad Bilal; +Cc: gdb-patches
On 09/17/2013 05:30 PM, Muhammad Bilal wrote:
> ping ^ 3
Yao had replied a while ago, but you never refuted his
review. I agree with him.
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-17 16:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-27 14:01 [PATCH][fix for gdb/15853] 'thread apply all inetrrupt&' shows inefficiency on remote targets Muhammad Bilal
2013-08-28 9:10 ` Yao Qi
2013-09-17 16:46 ` Pedro Alves
2013-09-04 12:35 ` Muhammad Bilal
2013-09-10 10:32 ` Muhammad Bilal
2013-09-17 16:30 ` Muhammad Bilal
2013-09-17 16:48 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).