Threads Continue/Stop

Brethour, Tanya (tonic) tonic@sequent.com
Fri Jul 28 15:06:00 GMT 2000


Hello!

I found this on a web page.. so read it before you get to my questions:

--------------- http://www.lns.cornell.edu/public/COMP/info/gdb/gdb_7.html
Whenever your program stops under GDB for any reason, all threads of
execution stop, not just the current thread. This allows
you to examine the overall state of the program, including switching between
threads, without worrying that things may change
underfoot. 

   Conversely, whenever you restart the program, all threads start executing.
This is true even when single-stepping with
commands like step or next. 

In particular, GDB cannot single-step all threads in lockstep. Since thread
scheduling is up to your debugging target's operating
system (not controlled by GDB), other threads may execute more than one
statement while the current thread completes a single
step. Moreover, in general other threads stop in the middle of a statement,
rather than at a clean statement boundary, when the
program stops. 

You might even find your program stopped in another thread after continuing
or even single-stepping. This happens whenever some
other thread runs into a breakpoint, a signal, or an exception before the
first thread completes whatever you requested. 

--------------

Ok here are my questions:

1) Does the inferior_pid change to the current thread or to the thread that
hits either a break point or is created? (So for example.. if I get a
SIGNALLED wait event.. then I set inferior_pid to the thread that got a
signal? Or does inferior_pid never change and remains the first pid/thread id
that is created?)

2) When the target specific resume function is called, does -1 signal to
resume all threads? And if step is set, does that mean to step the
inferior_pid only and to resume all remaining threads?

3) Should a function be called in the child_wait target specific function
that stops ALL threads when ANY thread gets stopped?

Thanks for your help!
tanya


More information about the Gdb-patches mailing list