This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: gdbstub initial code, v8 && ptrace
- From: Oleg Nesterov <oleg at redhat dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: archer at sourceware dot org, utrace-devel at redhat dot com
- Date: Fri, 15 Oct 2010 15:53:27 +0200
- Subject: Re: gdbstub initial code, v8 && ptrace
- References: <20100903224047.GA8917@redhat.com> <20100906182359.GB22839@redhat.com> <20100906194229.GA27405@redhat.com> <20100906205927.GA30471@redhat.com> <20100910100948.C0254405D5@magilla.sf.frob.com> <20100910190725.GC27699@redhat.com> <20101013071359.A789A401B2@magilla.sf.frob.com>
On 10/13, Roland McGrath wrote:
>
> > But. Suppose we have to attached engines. The first engine gets
> > UTRACE_SIGNAL_REPORT and returns "UTRACE_STOP | UTRACE_SIGNAL_IGN".
>
> Right, that's what it would do. I see, you're saying that the
> report.result passed on to the next engine would appear like it had
> been a real signal that the previous engine decided to ignore (or
> whose sa_handler==SIG_IGN or default action was to ignore). Hmm.
>
> Well, it's also distinguished by having orig_ka==NULL in the callback.
> Any real signal has a non-null orig_ka argument.
Yes, this is what ugdb does.
ptrace doesn't, I didn't realize this problem when I was writing
that code.
> > or yes, it returns UTRACE_SIGNAL_DELIVER after gdb does "signal XX".
> >
> > Now. The second engine gets UTRACE_SIGNAL_DELIVER or UTRACE_SIGNAL_IGN,
> > not UTRACE_SIGNAL_REPORT.
>
> At least in the UTRACE_SIGNAL_DELIVER case, that's really the true
> thing for it to see. The previous engine decided to do a signal
> delivery (as directed by return_ka), so the next engine needs to see
> this to know what the prevailing state of play is now.
Agreed. Currently ugdb doesn't report a signal injected by another
engine.
> > > I'm not really sure what you mean here.
> >
> > If ->report_signal(orig_ka) was calles with orig_ka == NULL, then,
> > whatever utrace_signal_action(action) we see, originally it was
> > either UTRACE_SIGNAL_HANDLER or UTRACE_SIGNAL_REPORT but another engine
> > returned, say, UTRACE_SIGNAL_DELIVER/UTRACE_SIGNAL_IGN to deliver/stop.
>
> Right. But this is in fact just the same for either
> UTRACE_SIGNAL_REPORT or UTRACE_SIGNAL_HANDLER.
Now I am not sure what you mean...
Yes, if the callback returns UTRACE_SIGNAL_REPORT then the next
callback will see "orig_ka == NULL" too, sure. But I guess you meant
something else.
> > > > Not sure about UTRACE_SIGNAL_HOLD, but this is very unlikely race.
> > >
> > > You probably don't want to use that, but I'm not entirely sure. ptrace
> > > doesn't use it, and the signal interception model is pretty much the same.
> >
> > Yes, agreed. But there is one corner case. Until we generalize
> > utrace_stop()->ptrace_notify_stop() hook, the tracee can be reported as
> > stopped to gdb, but before it actually stops it can recieve a signal.
>
> I don't follow this. If we're stopping, then we don't "receive"
> (dequeue) any other signal until we get resumed. That should be fine
> from gdb's point of view. The next signal is just pending for later.
Hmm. Yes.
If a callback ever returned UTRACE_STOP, utrace_get_signal() should
notice utrace->resume <= UTRACE_REPORT. OK, so ugdb doesn't need
this hack.
Thanks.
Now I am wondering how I managed to test this UTRACE_SIGNAL_HOLD code.
I recall, initially it returned "UTRACE_STOP | UTRACE_SIGNAL_HOLD",
then the testing showed it doesn't work and I added UTRACE_SIGNAL_REPORT.
Probably I added some hacks to simulate the problem which, as you showed,
doesn't exist.
Oleg.