public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* catch signal does not appear multi-inferior safe
@ 2014-07-11 10:56 Chris January
  2014-08-19 15:37 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Chris January @ 2014-07-11 10:56 UTC (permalink / raw)
  To: gdb

Hello,

It appears to me that the 'catch signal' support in GDB is not
multi-inferior safe. Combining the 'catch signal' command with the
'checkpoint' command, for example, results in an internal error:

break-catch-sig.c:152: internal-error:
signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter]
> 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

see the end of this e-mail for reproducer.

When checkpointing / catching a fork signal_catchpoint_remove_location
may be called twice in a row - once for the parent and once for the
child. This causes signal_catch_counts to go below 0. I would like some
advice on how to fix this problem as I am not sure what the correct fix
is.

Regards,
Chris January - VP Engineering - Allinea Software Ltd.


The problem can be reproduced using the following GDB commands - run GDB
from gdb/testsuite/gdb.base:

file checkpoint
break main
run
catch signal SIGSEGV
break 48
continue
checkpoint


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

* Re: catch signal does not appear multi-inferior safe
  2014-07-11 10:56 catch signal does not appear multi-inferior safe Chris January
@ 2014-08-19 15:37 ` Pedro Alves
  2014-08-28 10:58   ` Chris January
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2014-08-19 15:37 UTC (permalink / raw)
  To: Chris January, gdb

On 07/11/2014 11:56 AM, Chris January wrote:
> Hello,
> 
> It appears to me that the 'catch signal' support in GDB is not
> multi-inferior safe. Combining the 'catch signal' command with the
> 'checkpoint' command, for example, results in an internal error:
> 
> break-catch-sig.c:152: internal-error:
> signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter]
>> 0' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n)
> 
> see the end of this e-mail for reproducer.
> 
> When checkpointing / catching a fork signal_catchpoint_remove_location
> may be called twice in a row - once for the parent and once for the
> child. 

Signal catchpoint locations aren't really per-process; they're
global.  GDB shouldn't be trying to detach them from the child.
Where is this happening?  Is this from detach_breakpoint ?  That's
odd, since that skips bp_loc_other locations?

> This causes signal_catch_counts to go below 0. I would like some
> advice on how to fix this problem as I am not sure what the correct fix
> is.


-- 
Thanks,
Pedro Alves

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

* Re: catch signal does not appear multi-inferior safe
  2014-08-19 15:37 ` Pedro Alves
@ 2014-08-28 10:58   ` Chris January
  0 siblings, 0 replies; 3+ messages in thread
From: Chris January @ 2014-08-28 10:58 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb

Hello Pedro,

On Tue, 2014-08-19 at 16:37 +0100, Pedro Alves wrote:
> On 07/11/2014 11:56 AM, Chris January wrote:
> > It appears to me that the 'catch signal' support in GDB is not
> > multi-inferior safe. Combining the 'catch signal' command with the
> > 'checkpoint' command, for example, results in an internal error:
> > 
> > break-catch-sig.c:152: internal-error:
> > signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter]
> >> 0' failed.
> > A problem internal to GDB has been detected,
> > further debugging may prove unreliable.
> > Quit this debugging session? (y or n)
> > 
> > see the end of this e-mail for reproducer.
> > 
> > When checkpointing / catching a fork signal_catchpoint_remove_location
> > may be called twice in a row - once for the parent and once for the
> > child. 
> 
> Signal catchpoint locations aren't really per-process; they're
> global.  GDB shouldn't be trying to detach them from the child.
> Where is this happening?  Is this from detach_breakpoint ?  That's
> odd, since that skips bp_loc_other locations?

You are right. I was testing with an old version of GDB (7.6.2). It is
fixed in recent versions by this commit:

commit bd9673a4ded96ea5c108601501c8e59003ea1be6
Author: Philippe Waroquiers <philippe@sourceware.org>
Date:   Tue May 21 18:47:05 2013 +0000

    Fix internal error caused by interaction between catch signal and
fork

Sorry for the noise!

Regards,
Chris


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

end of thread, other threads:[~2014-08-28 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-11 10:56 catch signal does not appear multi-inferior safe Chris January
2014-08-19 15:37 ` Pedro Alves
2014-08-28 10:58   ` Chris January

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