lkcd
[Top] [All Lists]

RE: Retrieving PC from (traversing) the stack on Alpha

To: Brian Hall <brianw.hall@xxxxxxxxxx>
Subject: RE: Retrieving PC from (traversing) the stack on Alpha
From: Matt Robinson <yakker@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Dec 1999 12:07:52 -0800 (PST)
Cc: axp-list@xxxxxxxxxx, lkcd@xxxxxxxxxxx, comp.os.linux.alpha@xxxxxxxxxxxxx, Matt Robinson <yakker@xxxxxxxxxxxxxxxxxxxx>
In-reply-to: <XFMail.19991223125517.brianw.hall@compaq.com>
Sender: owner-lkcd@xxxxxxxxxxx
On Thu, 23 Dec 1999, Brian Hall wrote:
|>Well, it's not clear to me how to get the PC and RA of interest off the stack
|>when we are in the vmdump functions. We could retreive the RA from register 26
|>in the panic() function itself, and pass that to the dump_execute function.
|>Then the dump code could at least tell where panic was called from. Is this
|>sufficient, or at least a start?

In the __dump_execute() function, just save the PC into the right
registers, and that'll be enough.  You don't have to fill the pt_regs
structure.

The big keys are the stack pointer and the PC for that process within
the __dump_execute() function.  Save the stack pointer into
dump_header.dh_esp, and the PC into dump_header.dh_eip.  That's all
'lcrash' should need in order to figure out the stack trace of the
failing process (for now).  Having the RA is nice, but not entirely
necessary.

I should have named dh_esp and dh_eip into something like dh_sp and
dh_pc, for simplicity's sake.  Next revision ...

--Matt

|>On 18-Dec-1999 Brian Hall wrote:
|>> Okay, after some research, I think I figured out how to get at the needed
|>> Alpha registers:
|>> 
|>> register unsigned long fptr __asm__("$15"); /* get frame pointer? */
|>> register unsigned long sptr __asm__("$30"); /* get stack pointer? */
|>> 
|>> Now, my understanding of the problem is that I need to go back two frames on
|>> the stack to get the PC of interest, and three for the RA of interest. How 
do
|>> I
|>> do this? I haven't had much luck yet trying to figure out how to navigate 
the
|>> kernel stack. I see the pt_regs structure, but I'm not exactly sure how to
|>> figure the frame size, since that can vary with each frame.
|>> 
|>> On 13-Dec-1999 Matt Robinson wrote:
|>>> The problem is from panic(), you don't have the registers, so you
|>>> need to grab them.  That way the 'lcrash' code has a point to start
|>>> with as far as the failing process is concerned.  Hence the "if (regs)"
|>>> stuff.
|>
|>--
|>Brian Hall <brianw.hall@xxxxxxxxxx>
|>Linux Consultant


<Prev in Thread] Current Thread [Next in Thread>