public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* TARGET_SIGNAL_TRAP
@ 2003-07-17 18:29 David Carlton
  2003-07-17 18:35 ` TARGET_SIGNAL_TRAP Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: David Carlton @ 2003-07-17 18:29 UTC (permalink / raw)
  To: gdb

Some users here have noted that they have a hard time debugging
multithreaded code in GDB.  We're assuming that it's probably a bug in
our code instead of in GDB: it's just that GDB is changing the timing
of the threads in ways that expose a latent bug in our code.

Which made me curious: why does GDB change the timing of programs?  I
set a breakpoint in handle_inferior_event, and I see all these events
claiming to be TARGET_SIGNAL_TRAPs.  But I haven't set any breakpoints
or watchpoints!  So what causes all these traps to be generated?  Or
am I misunderstanding the situation?  (I'm not at all sure that this
is specific to multithreaded code - it may just be that its effects
are most pronounced for multithreaded code, because single-threaded
code doesn't have as much timing to be thrown off.)

David Carlton
carlton@kealia.com

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

* Re: TARGET_SIGNAL_TRAP
  2003-07-17 18:29 TARGET_SIGNAL_TRAP David Carlton
@ 2003-07-17 18:35 ` Daniel Jacobowitz
  2003-07-17 19:20   ` TARGET_SIGNAL_TRAP David Carlton
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-07-17 18:35 UTC (permalink / raw)
  To: David Carlton; +Cc: gdb

On Thu, Jul 17, 2003 at 11:29:44AM -0700, David Carlton wrote:
> Some users here have noted that they have a hard time debugging
> multithreaded code in GDB.  We're assuming that it's probably a bug in
> our code instead of in GDB: it's just that GDB is changing the timing
> of the threads in ways that expose a latent bug in our code.
> 
> Which made me curious: why does GDB change the timing of programs?  I
> set a breakpoint in handle_inferior_event, and I see all these events
> claiming to be TARGET_SIGNAL_TRAPs.  But I haven't set any breakpoints
> or watchpoints!  So what causes all these traps to be generated?  Or
> am I misunderstanding the situation?  (I'm not at all sure that this
> is specific to multithreaded code - it may just be that its effects
> are most pronounced for multithreaded code, because single-threaded
> code doesn't have as much timing to be thrown off.)

Every time that a breakpoint is hit, including one breakpoint set at
every shared library load/unload, thread creation, or sometimes thread
exit, all threads are stopped and restarted.  That's the usual cause.

Signals also stop the process.  If GDB isn't going to report the signal
then it doesn't stop all threads, but that does interfere with timing.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: TARGET_SIGNAL_TRAP
  2003-07-17 18:35 ` TARGET_SIGNAL_TRAP Daniel Jacobowitz
@ 2003-07-17 19:20   ` David Carlton
  2003-07-17 19:38     ` TARGET_SIGNAL_TRAP Elena Zannoni
  0 siblings, 1 reply; 4+ messages in thread
From: David Carlton @ 2003-07-17 19:20 UTC (permalink / raw)
  To: gdb

On Thu, 17 Jul 2003 14:32:14 -0400, Daniel Jacobowitz <drow@mvista.com> said:

> Every time that a breakpoint is hit, including one breakpoint set at
> every shared library load/unload, thread creation, or sometimes thread
> exit, all threads are stopped and restarted.  That's the usual cause.

> Signals also stop the process.  If GDB isn't going to report the signal
> then it doesn't stop all threads, but that does interfere with timing.

Ah, thanks for the info.  I wonder if it's the shared library loads
that we're seeing.  Hmm: we might even be able to control that one.

David Carlton
carlton@kealia.com

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

* Re: TARGET_SIGNAL_TRAP
  2003-07-17 19:20   ` TARGET_SIGNAL_TRAP David Carlton
@ 2003-07-17 19:38     ` Elena Zannoni
  0 siblings, 0 replies; 4+ messages in thread
From: Elena Zannoni @ 2003-07-17 19:38 UTC (permalink / raw)
  To: David Carlton; +Cc: gdb

David Carlton writes:
 > On Thu, 17 Jul 2003 14:32:14 -0400, Daniel Jacobowitz <drow@mvista.com> said:
 > 
 > > Every time that a breakpoint is hit, including one breakpoint set at
 > > every shared library load/unload, thread creation, or sometimes thread
 > > exit, all threads are stopped and restarted.  That's the usual cause.
 > 
 > > Signals also stop the process.  If GDB isn't going to report the signal
 > > then it doesn't stop all threads, but that does interfere with timing.
 > 
 > Ah, thanks for the info.  I wonder if it's the shared library loads
 > that we're seeing.  Hmm: we might even be able to control that one.
 > 
 > David Carlton
 > carlton@kealia.com


try 'maint info break' to see all (kind of) the hidden breakpoints.

elena

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

end of thread, other threads:[~2003-07-17 19:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-17 18:29 TARGET_SIGNAL_TRAP David Carlton
2003-07-17 18:35 ` TARGET_SIGNAL_TRAP Daniel Jacobowitz
2003-07-17 19:20   ` TARGET_SIGNAL_TRAP David Carlton
2003-07-17 19:38     ` TARGET_SIGNAL_TRAP Elena Zannoni

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).