Re: [PATCH 0/3] UTRACE_DETACH fixes

2010-09-06 Thread Oleg Nesterov
On 09/03, Roland McGrath wrote:

   So, it is technically kosher enough to use UTRACE_INTERRUPT without
   UTRACE_EVENT(QUIESCE) set, if you really know the situation and are sure
   about all those caveats above.
 
  How? see below.

 I mentioned the examples.

I misunderstood the UTRACE_INTERRUPT without UTRACE_EVENT(QUIESCE) above
as if you mean it is possible to get UTRACE_SIGNAL_REPORT without QUIESCE.

   But, it's only UTRACE_EVENT(QUIESCE) that
   gives you any expectation of an extra callback for no event from 
   either
   UTRACE_REPORT or UTRACE_INTERRUPT.
 
  Yes, this is clear too.

 Apparently not. ;-)

Perhaps ;) At least I certainly missed your point.

 QUIESCE is the only event type for no event.  If you only asked for
 signal events, then you only get a callback when there is an actual signal
 event.  If you want an extra callback before dequeuing any signal, then
 that is what QUIESCE is for.

OK. This means ugdb should set QUIESCE, just to ensure its -report_signal()
will be called.

  Once again, I am not asking to change utrace now, but could you explain
  what is wrong with the patch below?

 That gives an extra unrequested report_signal callback to every engine that
 is only interested in some signal event.  Consider a crash-catcher
 engine.  It would only track UTRACE_EVENT(SIGNAL_CORE) (and perhaps CLONE
 for its bookkeeping).  This engine never asked for a callback before each
 and every attempt to dequeue any signal,

I see your point (I hope).

 which is what you would give it
 with your change.

No ;) My change was wrong. event == 0 in this case, and then later
utrace_get_signal() checks

if ((want  (event | UTRACE_EVENT(QUIESCE))) == 0)
continue;



OK, please forget. I must admit, this still looks a bit, well, unnatural
to me. May be it makes sense to add

_UTRACE_EVENT_SIGNAL_REPORT,
_UTRACE_EVENT_SIGNAL_HANDLER,

into utrace_events. Then ugdb could ask for UTRACE_SIGNAL_REPORT and
avoid the unnecessary -report_quiesce() calls.

But at least I can see the logic now, thanks.



Roland, could you also comment this patch?

https://www.redhat.com/archives/utrace-devel/2010-August/msg00108.html

Again, this looks like a bug to me, but I won't insist if it is not.

Oleg.



Re: gdbstub initial code, v8

2010-09-06 Thread Oleg Nesterov
On 09/05, Jan Kratochvil wrote:

 On Sat, 04 Sep 2010 00:40:47 +0200, Oleg Nesterov wrote:
  - implement qXfer:siginfo:read
 
  - implement continue with signal.

 OK, thanks, just it was a bit premature to ask for it I see.  I miss at least
 memory writes

Yes. This is simple.

 (also to put in breakpoints):

And this is not clear to me, I need your help ;)

What should ugdb know about breakpoints? I played with the real
gdbserver, and afaics gdb just changes the tracee's memory and
inserts 0xcc (int 3). But gdb.info mentions Z TYPE,ADDR,KIND
packets.

So, what should ugdb do? Just implement memory write (M or X)
and then report SIGTRAP like gdbserver does?

Oleg.



Re: gdbstub initial code, v8

2010-09-06 Thread Oleg Nesterov
On 09/06, Jan Kratochvil wrote:

 On Mon, 06 Sep 2010 20:18:08 +0200, Oleg Nesterov wrote:
  On 09/05, Jan Kratochvil wrote:
 
   (also to put in breakpoints):
 
  And this is not clear to me, I need your help ;)

 Sorry, I just meant that by implementing the memory writes breakpoints
 automatically start to work.


  What should ugdb know about breakpoints? I played with the real
  gdbserver, and afaics gdb just changes the tracee's memory and
  inserts 0xcc (int 3). But gdb.info mentions Z TYPE,ADDR,KIND
  packets.

 I believe it is described by:
   /* If GDB wanted this thread to single step, we always want to
  report the SIGTRAP, and let GDB handle it.  Watchpoints should
  always be reported.  So should signals we can't explain.  A
  SIGTRAP we can't explain could be a GDB breakpoint --- we may or
  not support Z0 breakpoints.  If we do, we're be able to handle
  GDB breakpoints on top of internal breakpoints, by handling the
  internal breakpoint and still reporting the event to GDB.  If we
  don't, we're out of luck, GDB won't see the breakpoint hit.  */


  So, what should ugdb do? Just implement memory write (M or X)
  and then report SIGTRAP like gdbserver does?

 Therefore until you track some ugdb-specific software(*) breakpoints ugdb does
 not need to support Z0 IMO.  I guess ugdb will never have to support these:
 thread-related(?) and tracepoint ones.

Good! I thought ugdb should somehow handle this all transparently
for gdb. I thought (I don't know why) that writing int 3 from gdb
side should be avoided in favour of some better method unknown to me.

Thanks Jan.

Oleg.