public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Pawel Piech <pawel.piech@windriver.com>
To: gdb@sourceware.org
Subject: Re: Non-stop multi-threaded debugging
Date: Wed, 28 Nov 2007 05:18:00 -0000	[thread overview]
Message-ID: <474CFA34.1030309@windriver.com> (raw)

Hello,
I am collaborating with Ericsson on implementing GDB support in Eclipse 
and I'm very much looking forward to seeing this functionality 
implemented in GDB.   With the Eclipse use of the MI protocol in mind I 
have a couple of comments and questions on the proposal:

> P1) Non-stop multi-threaded native debugging
<snip>
>     - The MI '-exec-interrupt' command shall stop all threads.  This
>       will always generate an 'EXEC-ASYNC-OUTPUT' record, even if all
>       threads were already stopped.  (This helps users handle the case
>       where the thread stops of its own accord just as the user sends
>       it an '-exec-interrupt' command.)
>
>     - The MI '-thread-select' command shall stop the thread selected,
>       if it is running.  The previously selected thread is left in its
>       former state, either stopped or running.  A '-thread-select'
>       command shall always generate an 'EXEC-ASYNC-OUTPUT' record,
>       even if the thread was already stopped.
I think using -thread-select to suspend a thread will have negative 
consequences to the MI-client.  The -thread-select is used to change the 
protocol state before requesting data related to that thread.  Adding 
the side-effect of suspending the thread, will force the client to add 
additional logic to avoid suspending threads accidentally as a result of 
attempting to read data.  I think it would be much safer to use an 
explicit -exec-interrupt request (after a -thread-select) to suspend a 
thread. 
Note that either way GDB will have to handle and return an errors to 
requests for data (such as stack or expressions) while a selected thread 
is running.  If a client sends a -exec-continue, I assume that whatever 
thread was selected last will still be selected.  So a 
-stack-list-frames should result in an error.

> P7) Non-stop multi-threaded multi-process native debugging
<snip>
>     - MI shall provide a command to stop all the threads in a given
>       process, and a command to resume all stopped threads in a given
>       process.

I would like to make a suggestion here.  Instead of inventing a new set 
of parallel commands and events to deal with process-wide events, it 
would be cleaner to simply assign thread IDs to processes and use 
existing commands and events to operate on them.  A -thread-select on an 
ID of a process followed by an -exec-continue would resume an entire 
process, while a -thread-select of a thread's ID followed by a continue 
would resume only that thread.  This could also be applied to all other 
commands that need to operate on a process, such as -thread-list-ids, 
-break-insert, etc.

While events could also be re-used to report without any changes to the 
event format, it would be very helpful for the client if the events 
included both the process's and thread's thread ID, as well as whether 
all threads stopped as the result of the event:
...
-thread-select 2
^done
-exec-interrupt
*stopped, thread-id="2", process-thread-id="1", all-threads="false", ....
^done
...
-thread-select 1
^done
-exec-continue
^running, thread-id="1", process-thread-id="1", all-threads="true"
...

Cheers,
Pawel

             reply	other threads:[~2007-11-28  5:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-28  5:18 Pawel Piech [this message]
2007-11-29  2:08 ` Nick Roberts
2007-11-29  6:15   ` Pawel Piech
2007-11-29  6:46     ` gdb over RNDIS to PDA Steve DeLaney
2007-11-29  8:36     ` Non-stop multi-threaded debugging Vladimir Prus
2007-11-29 16:42       ` Pawel Piech
     [not found]       ` <474EEB36.1040203@windriver.com>
2007-11-29 16:46         ` Vladimir Prus
2007-11-29 17:36           ` Pawel Piech
2007-11-29 17:51             ` Vladimir Prus
2007-11-29 18:13               ` Pawel Piech
2007-12-04 18:34 ` Jim Blandy
2007-12-04 23:05   ` Pawel Piech
2007-12-05 21:52     ` Jim Blandy
  -- strict thread matches above, loose matches on Subject: below --
2007-11-20 17:21 Nathan Sidwell
2007-11-20 19:28 ` Nick Roberts
2007-11-20 20:12   ` Jim Blandy
2007-11-21 13:53 ` Michael Snyder
2007-11-26 23:13 ` Jim Blandy
2007-11-27 16:42 ` Ulrich Weigand
2007-11-30 20:48 ` Thiago Jung Bauermann
2007-12-04 18:17   ` Jim Blandy
2007-12-05 13:41     ` Fabian Cenedese
2007-12-05 20:01 ` Nigel Stephens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=474CFA34.1030309@windriver.com \
    --to=pawel.piech@windriver.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).