[ros-kernel] RE: CVS Update: reactos

Ge van Geldorp ge at gse.nl
Tue Mar 30 03:07:30 CEST 2004


> From: David Welch
> 
> On Mon, Mar 29, 2004 at 02:29:35PM +0000, Ge van Geldorp wrote:
> > CVSROOT:	/CVS/ReactOS
> > Module name:	reactos
> > Repository:	reactos/ntoskrnl/ke/i386/
> > Changes by:	gvg at mok.osexperts.com.(none)	04/03/29 14:29:35
> > 
> > Modified files:
> > 	reactos/ntoskrnl/ke/i386/: syscall.S
> > 
> > Log message:
> > 	Allow GDB 6 to backtrace over a syscall
> > 
> The existing code already sets up a stack frame to allow 
> backtracing into user space - in fact the new code is worse 
> since it doesn't allow you to see the arguments to the 
> function that did the int2e. Why does gdb 6 need 
> this change?

GDB 6 is more picky and gets really confused with the old code. To be
honest, I'm not 100% sure about what it's trying to do, but I do know
that with the old code it ends up reading one of the NULLs created with
"push $0" as a return address and then stops the backtrace. The last
thing I see in the backtrace with the old code is
new_shadowServiceInRange (or new_serviceInRange). The new code also
shows the usermode location from where the syscall stub was called.

You are right that it doesn't show the stub itself, but since the kernel
routine is called with the same arguments as that stub I didn't see that
as a big loss.

Stock GDB 6 will only show the usermode location from where the syscall
stub was called, not any callers of that. This is because it detects
what it considers a strange change in stack addresses. Normally stack
addresses increase as you unwind the stack, but since we're unwinding
from a kernelmode stack to a usermode stack over the syscall the stack
address will decrease, making GDB 6 think something is wrong and it will
terminate the backtrace. But at least it gives us one usermode location,
it's easy to set a breakpoint on the return from the syscall after which
you can find a backtrace of the usermode callers. Personally I've
patched my gdb to skip the check for increasing stack addresses so I can
get a full backtrace from kernelmode right up to the CreateProcess().

If you really think this change is bad I will revert it and keep it in
my private tree only but in my opinion it will make GDB 6 less useable
for everyone (I still kept a GDB 5 copy around just to be able to do
backtraces).

Ge van Geldorp.



More information about the Ros-kernel mailing list