gdb stack frames (was Re: page fault panic tracked down...)

From: Ian Dowse <iedowse_at_maths.tcd.ie>
Date: Mon, 05 Jan 2004 21:46:26 +0000
In message <200401051927.i05JRU7E011991_at_gw.catspoiler.org>, Don Lewis writes:
>As I've mentioned before, it appears that gdb has problems decoding
>stack frames around a trap and I've seen a lot of "can't happen" things
>in the stack frames leading up to the trap.

FYI, my most recent attempt to debug this found a few interesting
things. It seems that in a function where an argument becomes a
variable stored in a register, the debugging information is supposed
to include details about both where the argument is on the stack
and also which register is used. The gdb code apparently prefers
to use the stack version since it is less likely to be clobbered,
but in the cases I looked at, there appeared only to be a register
specification available.

So possibly the real problem is at the compiler stage... In some
examples I saw, the stack version of the argument was correct, which
explains why ddb gets it right, but I couldn't find the right value
in any registers, including those saved by the trap (though I didn't
look very hard). Maybe one of the gcc debug-related options improves
things?

Of course this doesn't explain why gdb mostly works on userland
programs, so it could just be that I didn't try hard enough to find
the right registers. Certainly as-is, gdb does not know how to
retrieve all the saved registers from a kernel trap frame itself.

Ian
Received on Mon Jan 05 2004 - 12:46:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:36 UTC