Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] gdbserver/lynx178: spurious SIG61 signal when resuming inferior.
Date: Mon, 13 May 2013 11:22:00 -0000	[thread overview]
Message-ID: <5190CCF9.3020004@redhat.com> (raw)
In-Reply-To: <1368441986-14478-1-git-send-email-brobecker@adacore.com>

Hi Joel,

On 05/13/2013 11:46 AM, Joel Brobecker wrote:

> On ppc-lynx178, resuming the execution of a program after hitting
> a breakpoint sometimes triggers a spurious SIG61 event:

I'd like to understand this a little better.

Could that mean the thread that gdbserver used for ptrace hadn't
been ptrace stopped, or doesn't exist at all?  "sometimes" makes
me wonder about the latter.

>     (gdb) cont
>     Continuing.
> 
>     Program received signal SIG61, Real-time event 61.
>     [Switching to Thread 39]
>     0x10002324 in a_test.task1 (<_task>=0x3ffff774) at a_test.adb:30
>     30          select  -- Task 1
> 
> From this point on, continuing again lets the signal kill the program.
> Using "signal 0" or configuring GDB to discard the signal does not
> help either, as the program immediately reports the same signal again.
> 
> What happens is the following:
> 
>   - GDB sends a single-step order to gdbserver: $vCont;s:31
>     This tells GDBserver to do a step using thread 0x31=49.
>     GDBserver does the step, and thread 49 receives the SIGTRAP
>     indicating that the step has finished.
> 
>   - GDB then sends a "continue", but this time does not specify
>     which thread to continue: $vCont;c
>     GDBserver uses an arbitrary thread's ptid to resume the program's
>     execution (the current_inferior's ptid was chosen for that).
>     See lynx-low.c:lynx_resume:

Urgh.

So does that mean scheduler locking doesn't work?

E.g.,

(gdb) thread 2
(gdb) si
(gdb) thread 1
(gdb) c

That'll single-step thread 2, and then continue just thread 1, supposedly
triggering this issue too?  If not, why not?

BTW, vCont;c means "resume all threads", why is the current code just
resuming one?

This:

lynx_wait_1 ()
...
  if (ptid_equal (ptid, minus_one_ptid))
    pid = lynx_ptid_get_pid (thread_to_gdb_id (current_inferior));
  else
    pid = BUILDPID (lynx_ptid_get_pid (ptid), lynx_ptid_get_tid (ptid));

retry:

  ret = lynx_waitpid (pid, &wstat);


is suspicious also.  Doesn't that mean we're doing a waitpid on
a possibly not-resumed current_inferior (that may not be the main task,
if that matters)?  Could _that_ be reason for that magic signal 61?

-- 
Pedro Alves


  reply	other threads:[~2013-05-13 11:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 10:46 Joel Brobecker
2013-05-13 11:22 ` Pedro Alves [this message]
2013-05-13 11:25   ` Pedro Alves
2013-05-13 13:28   ` Joel Brobecker
2013-05-13 14:28     ` Pedro Alves
2013-05-16 12:24       ` Joel Brobecker
2013-05-16 13:14         ` Pedro Alves
2013-05-13 14:36 ` Pedro Alves
2013-05-17  6:57   ` Joel Brobecker
2013-05-17  6:48 ` Checked in: " Joel Brobecker

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=5190CCF9.3020004@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