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

Thanks for the comments, Pedro.

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

My interpretation of the clues I have been able to gather is that
the LynxOS thread library implementation does not like it when
we mess with the program's scheduling. Lynx178 is derived from
an old version of LynxOS, which can explain why newer versions
are a little more robust in that respect.

I tried to get more info directly from the people who I thought
would know about this, but never managed to make progress in that
direction, so I gave up when I found this solution.

> So does that mean scheduler locking doesn't work?
> 
> E.g.,
> 
> (gdb) thread 2
> (gdb) si
> (gdb) thread 1
> (gdb) c 
Indeed, as expected, same sort of symptom:

    (gdb) thread 1
    [Switching to thread 1 (Thread 30)]
    #0  0x1004ed94 in _trap_ ()
    (gdb) si
    0x1004ed98 in _trap_ ()
    (gdb) thread 2
    [Switching to thread 2 (Thread 36)]
    #0  task_switch.break_me () at task_switch.adb:42
    42            null;
    (gdb) cont
    Continuing.

    Program received signal SIG62, Real-time event 62.
    task_switch.break_me () at task_switch.adb:42
    42            null;

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

It's actually using a ptrace request that applies to the process
(either PTRACE_CONT or PTRACE_SINGLE_STEP).

I never tried to implement single-thread control (scheduler-locking
on), as this is not something we're interested on for this platform,
at least for now...

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

I understand... It's a bit of a hybrid between trying to deal with
thread-level execution control, and process-level execution control.

> 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?

Given the above (we resume processes, rather than threads individually),
I do not think that this is the source of the problem itself. I blame
the thread library for now liking it when you potentially alter the
program scheduling by resuming the non-active thread. This patch does
not prevent this from happening, but at least makes an effort into
avoiding it for the usual situations.

-- 
Joel


  parent reply	other threads:[~2013-05-13 13:28 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
2013-05-13 11:25   ` Pedro Alves
2013-05-13 13:28   ` Joel Brobecker [this message]
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=20130513132802.GA32222@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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