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: Thu, 16 May 2013 12:24:00 -0000	[thread overview]
Message-ID: <20130516122443.GA4017@adacore.com> (raw)
In-Reply-To: <5190F869.3090408@redhat.com>

> Old lynx-nat.c did:
> 
> http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/Attic/lynx-nat.c?rev=1.23&content-type=text/x-cvsweb-markup&cvsroot=src
> 
>   /* If pid == -1, then we want to step/continue all threads, else
>      we only want to step/continue a single thread.  */
>   if (pid == -1)
>     {
>       pid = PIDGET (inferior_ptid);
>       func = step ? PTRACE_SINGLESTEP : PTRACE_CONT;
>     }
>   else
>     func = step ? PTRACE_SINGLESTEP_ONE : PTRACE_CONT_ONE;
> 
> 
> I'd like to believe that just doing that in gdbserver too
> would fix the scheduler-locking example.  :-)

I just tried that, and I am not sure yet how well this is going to
work. It'll at least require a change in the "wait" routine which
resumes the execution after a "new-thread" event, because do not want
to resume the execution using the thread's ptid, because we'd switch
to a PTRACE_CONT_ONE request. I tried to see if I could make it work
quickly, but got inconclusive results (process hanging), so I am
leaving that for another day :-).

> For the SIG61 issue, I wonder whether for PTRACE_CONT,
> it's "continue main pid process" that we should always use
> instead of "last reported thread id" (and that's what the old
> lynx-nat.c did too).  Did you try that?

Yes, I did that a while ago. Looking at the man page for
PTRACE_CONT:

        This request is always directed to an individual
        thread specified by pid, while all the threads in
        the traced process are also to be resumed.

The man page also says a bit earlier:

        Per-thread, but effective on the entire process.

Based on the above, I think that using the currently "active"
thread (the thread that caused the process to stop) helps
avoid having the debugger influence the program's behavior
by influencing its scheduling.

Nevertheless, I tried that again today, and that is not sufficient
to prevent the SIG61 signal from being raised.

So I think that the patch as I proposed it still makes sense.
I know you pre-approved it, but I want to make sure that I answered
all your questions properly before going ahead with the commit.

> Sorry to be picky.  IMO, it's good to have all these
> experimentation results archived, for when somebody proposes
> removing/changing the "make sure to resume last reported" code
> at some point...

Not at all, I think this makes sense.

-- 
Joel


  reply	other threads:[~2013-05-16 12:24 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
2013-05-13 14:28     ` Pedro Alves
2013-05-16 12:24       ` Joel Brobecker [this message]
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=20130516122443.GA4017@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