Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* How to switch threads in gdb while a thread is being blocked
@ 2011-03-28 20:45 Alexandru Sutii
  2011-03-29 15:05 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandru Sutii @ 2011-03-28 20:45 UTC (permalink / raw)
  To: gdb

Hello!

I am developing a GUI application that uses gdb. The purpose of the
application is
to give the user the chance to graphically see what happens when processes
communicate using IPC, or when a process blocks when taking a mutex, and so on.

I have a problem with processes that block waiting for another process
to take an action.
For instance, say I have the following situation: A process P creates
a child process C.
The child and the parent communicate through a pipe. After fork() the
parent waits for the
child to write something in the pipe. If debugging this in gdb the
parent blocks when waiting
for the child to write in the pipe. As a result gdb freezes and I
cannot switch to the child
process in order to make it write in the pipe, so the parent could
continue. I mention that
I set detach-on-fork off.

Is there a way to switch threads in gdb after the current
thread/process blocks? I have also
thought of setting detach-on-fork on and try to attache to the newly
created process with
another gdb instance, but I didn't manage to accomplish this. Any
advices are welcome.

Thanks in advance.
--Alex.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to switch threads in gdb while a thread is being blocked
  2011-03-28 20:45 How to switch threads in gdb while a thread is being blocked Alexandru Sutii
@ 2011-03-29 15:05 ` Tom Tromey
  2011-03-29 21:59   ` Alexandru Sutii
  2011-03-30  0:03   ` chris.hall.list
  0 siblings, 2 replies; 6+ messages in thread
From: Tom Tromey @ 2011-03-29 15:05 UTC (permalink / raw)
  To: Alexandru Sutii; +Cc: gdb

>>>>> "Alexandru" == Alexandru Sutii <sutii.alex@gmail.com> writes:

Alexandru> Is there a way to switch threads in gdb after the current
Alexandru> thread/process blocks?

You want target-async.  See the "Background Execution" node in the
manual; there are corresponding MI commands (and docs) too.  You may
also want non-stop.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to switch threads in gdb while a thread is being blocked
  2011-03-29 15:05 ` Tom Tromey
@ 2011-03-29 21:59   ` Alexandru Sutii
  2011-03-30  0:03   ` chris.hall.list
  1 sibling, 0 replies; 6+ messages in thread
From: Alexandru Sutii @ 2011-03-29 21:59 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb

Hello, Tom!

Thanks a lot for your answer. With target-async on I have managed to
step the processes even when one of them blocks.

Thank you.
-- Alex.

On Tue, Mar 29, 2011 at 6:04 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Alexandru" == Alexandru Sutii <sutii.alex@gmail.com> writes:
>
> Alexandru> Is there a way to switch threads in gdb after the current
> Alexandru> thread/process blocks?
>
> You want target-async.  See the "Background Execution" node in the
> manual; there are corresponding MI commands (and docs) too.  You may
> also want non-stop.
>
> Tom
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: How to switch threads in gdb while a thread is being blocked
  2011-03-29 15:05 ` Tom Tromey
  2011-03-29 21:59   ` Alexandru Sutii
@ 2011-03-30  0:03   ` chris.hall.list
  2011-03-30 13:58     ` Tom Tromey
  1 sibling, 1 reply; 6+ messages in thread
From: chris.hall.list @ 2011-03-30  0:03 UTC (permalink / raw)
  To: gdb

Tom Tromey wrote (on Tue 29-Mar-2011 at 16:05):
....
> >>>>> "Alexandru" == Alexandru Sutii <sutii.alex@gmail.com> writes:
> 
> Alexandru> Is there a way to switch threads in gdb after the current
> Alexandru> thread/process blocks?
> 
> You want target-async.  See the "Background Execution" node in the
> manual; there are corresponding MI commands (and docs) too.  You may
> also want non-stop.

Though my experience with non-stop is that it crashes and burns when
you single step through the end of some functions :-(

Chris


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to switch threads in gdb while a thread is being blocked
  2011-03-30  0:03   ` chris.hall.list
@ 2011-03-30 13:58     ` Tom Tromey
  2011-03-30 15:16       ` 'Chris Hall'
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2011-03-30 13:58 UTC (permalink / raw)
  To: chris.hall.list; +Cc: gdb

>>>>> "Chris" ==   <chris.hall.list@highwayman.com> writes:

Chris> Though my experience with non-stop is that it crashes and burns when
Chris> you single step through the end of some functions :-(

If you haven't filed bug reports about this, please do so.

If you have filed bug reports, could you mention the PR numbers here?
I am curious.

thanks,
Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: How to switch threads in gdb while a thread is being blocked
  2011-03-30 13:58     ` Tom Tromey
@ 2011-03-30 15:16       ` 'Chris Hall'
  0 siblings, 0 replies; 6+ messages in thread
From: 'Chris Hall' @ 2011-03-30 15:16 UTC (permalink / raw)
  To: gdb; +Cc: 'Tom Tromey'

Tom Tromey wrote (on Wed 30-Mar-2011 at 14:58):
> >>>>> "Chris" ==   <chris.hall.list@highwayman.com> writes:
> 
> Chris> Though my experience with non-stop is that it crashes and
> Chris> burns when you single step through the end of some
> Chris> functions :-(

> If you haven't filed bug reports about this, please do so.

OK. Bug 12623 Submitted...

....
> I am curious.

Me too.  (See my posting of Mon 07-Mar-2011 " SIGSEGV on exit from
subroutines -- problem with non-stop ?")

I used non-stop earlier this year...  but that was on a previous
machine and probably an earlier version of gdb !

Chris


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-30 15:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-28 20:45 How to switch threads in gdb while a thread is being blocked Alexandru Sutii
2011-03-29 15:05 ` Tom Tromey
2011-03-29 21:59   ` Alexandru Sutii
2011-03-30  0:03   ` chris.hall.list
2011-03-30 13:58     ` Tom Tromey
2011-03-30 15:16       ` 'Chris Hall'

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox