public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Stepping through signal trampolines
@ 2004-03-25 14:47 Mark Kettenis
  2004-03-25 19:59 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2004-03-25 14:47 UTC (permalink / raw)
  To: gdb

The recent changes to the signal trampoline stuff have changed the way
we deal with stepping through signal trampolines.  I did some
experimenting with an older GDB and noticed the following differences:

* Finish from within a signal handler now makes us end up in the
  signal trampoline now, whereas an older GDB simply ran until exit.
  I guess this is a good thing.

* Stepping out of the signal handler using "stepi" makes us run until
  exit now, whereas an older GDB happily continues stepping into the
  signal trampoline.

* If I use finish to get into the signal trampoline with a current
  GDB, stepi continues until we return from the signal trampoline.
  Using stepi on the older GDB from within the signal trampoline
  happily steps through the signal trampoline.

So there still seem to be some quirks with stepping through signal
trampolines.  But before we decide what's the bug, I think we should
ask ourselves what the desired behaviour is.  In my view:

* "finish" from within a signal handler should make us return to the
  signal trampoline.

* "finish" from within a signal trampoline should make us return to
  the point where the signal interruption occured.

* "stepi" from within a signal handler should step through the signal
  handler and back into the signal trampoline.

* "stepi" from within a signal trampoline should step through the
  signal trampoline until the sigreturn system call.

I'm not sure what "next" and "step" should do exactly.  Here we must
distinguish between systems with libc-provided signal trampolines and
systems with kernel-provided signal trampolines.  For the latter we
usually won't have debug info, so "next" and "step" should probably
skip them.  For the former, we probably want to make them stop at
lines within the signal trampoline if we have debug info for those
lines.

Thoughts?

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Stepping through signal trampolines
  2004-03-25 14:47 Stepping through signal trampolines Mark Kettenis
@ 2004-03-25 19:59 ` Andrew Cagney
  2004-04-05 22:48   ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2004-03-25 19:59 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb

> So there still seem to be some quirks with stepping through signal
> trampolines.  But before we decide what's the bug, I think we should
> ask ourselves what the desired behaviour is.  In my view:
> 
> * "finish" from within a signal handler should make us return to the
>   signal trampoline.
> 
> * "finish" from within a signal trampoline should make us return to
>   the point where the signal interruption occured.
> 
> * "stepi" from within a signal handler should step through the signal
>   handler and back into the signal trampoline.
> 
> * "stepi" from within a signal trampoline should step through the
>   signal trampoline until the sigreturn system call.

* nexti in a sigtramp is like stepi

What about disassemble?  Disassemble the entire signal trampoline or the 
current instruction?

(you now know where my testcases are going :-)

Andrew


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Stepping through signal trampolines
  2004-03-25 19:59 ` Andrew Cagney
@ 2004-04-05 22:48   ` Andrew Cagney
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2004-04-05 22:48 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb

On GNU/Linux, stepi appears to work, but nexti appears to skip a frame:

(gdb) PASS: gdb.base/siginfo.exp: continue to nexti handler
bt
#0  handler (sig=26, info=0xbfffd550, context=0xbfffd5d0) at 
/home/cygnus/cagney
/PENDING/2004-03-31-sigstack/src/gdb/testsuite/gdb.base/siginfo.c:11
#1  <signal handler called>
#2  main () at 
/home/cygnus/cagney/PENDING/2004-03-31-sigstack/src/gdb/testsuite
/gdb.base/siginfo.c:46
(gdb) PASS: gdb.base/siginfo.exp: backtrace for nexti
nexti
12      } /* handler */
1: x/i $pc  0x80483f9 <handler+13>:     leave
(gdb) nexti
0x080483fa in handler (sig=1, info=0xbfffd9f4, context=0xbfffd9fc) at 
/home/cygn
us/cagney/PENDING/2004-03-31-sigstack/src/gdb/testsuite/gdb.base/siginfo.c:12
12      } /* handler */
1: x/i $pc  0x80483fa <handler+14>:     ret
(gdb) nexti
main () at 
/home/cygnus/cagney/PENDING/2004-03-31-sigstack/src/gdb/testsuite/gdb
.base/siginfo.c:46
46        while (!done);
1: x/i $pc  0x8048483 <main+136>:       mov    0x8049680,%eax
(gdb) FAIL: gdb.base/siginfo.exp: nexti out of handler (in main)

more debugging, but at least there's a test case.

Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-04-05 22:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-25 14:47 Stepping through signal trampolines Mark Kettenis
2004-03-25 19:59 ` Andrew Cagney
2004-04-05 22:48   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).