From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: sig != GDB_SIGNAL_0 failed assertion stepping program on GNU/Linux
Date: Tue, 04 Aug 2015 18:54:00 -0000 [thread overview]
Message-ID: <55C10A7B.3050405@redhat.com> (raw)
In-Reply-To: <20150804180745.GA13984@adacore.com>
On 08/04/2015 07:07 PM, Joel Brobecker wrote:
>
> Back to our program. At this point, we attempt a "next" (from thread 1),
> and here is what happens:
If the "next" is for thread 1,
> That's when we get an event from a different thread (thread 3):
>
> infrun: target_wait (-1.0.0, status) =
> infrun: 28370.28378.0 [Thread 0xb7c5aba0 (LWP 28378)],
> infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP
> infrun: TARGET_WAITKIND_STOPPED
> infrun: stop_pc = 0x80782d0
> infrun: context switch
> infrun: Switching context from Thread 0xb7ea18c0 (LWP 28370) to Thread 0xb7c5aba0 (LWP 28378)
>
> ... which we find to be at the address where we set a breakpoint
> on "the unwinder debug hook" (namely "_Unwind_DebugHook"). That's
> why GDB reports for this event that this is...
>
> infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME
Why are we getting this? longjmp/exception/step-resume breakpoints
are thread-specific.
I'd guess that the bug is in bpstat_what:
struct bpstat_what
bpstat_what (bpstat bs_head)
{
...
case bp_longjmp:
case bp_longjmp_call_dummy:
case bp_exception:
this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME;
retval.is_longjmp = bptype != bp_exception;
break;
...
This bit is not considering "if (bs->stop)" like e.g.,
the bp_step_resume case.
I've seen something like this trigger before, and have a patch
somewhere to rewrite bpstat_what differently which fixes that.
I never managed to write a testcase for it so never submitted
it. But, could you try the simpler approach? Try making that:
if (bs->stop)
{
this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME;
retval.is_longjmp = bptype != bp_exception;
}
else
this_action = BPSTAT_WHAT_SINGLE;
break;
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-08-04 18:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 18:07 Joel Brobecker
2015-08-04 18:54 ` Pedro Alves [this message]
2015-08-05 1:04 ` Joel Brobecker
2015-08-05 10:16 ` Pedro Alves
2015-08-05 17:17 ` Joel Brobecker
2015-08-05 19:14 ` Pedro Alves
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=55C10A7B.3050405@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@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).