1752579 Members
4157 Online
108788 Solutions
New Discussion юеВ

Issue with uwx_step

 
SOLVED
Go to solution

Issue with uwx_step

Hi,
My application in HP Itanium is throwing some exception.

I am trying to unwind the stack from the top till down and storing the values for each context. I am using uwx_step for this. When i reach frame 16, i can see a signal handler. After this frame i am unable to step to the next frame. uwx_step is returning UWX_ABI_FRAME and is not stepping further. I need to get the information for the remaining stacks also. How can i get this.
My code is something like this :
for (i=0;i < STAK_CNT ;i++)
{
get RP using uwx_get_reg;
if(curr frame is UWX_ABI_FRAME)
{
uwx_step ;
continue;
}
get SP,PSP using uwx_get_reg;
uwx_step ;
get SP,PSP using uwx_get_reg;
}

Eventhough i step when i get a UWX_ABI_FRAME, i am not getting the next frames.

Thanks,
Suchitra
10 REPLIES 10
Dennis Handly
Acclaimed Contributor
Solution

Re: Issue with uwx_step

uwx(3X) says:
3. When a signal context frame is reached, the client may call uwx_self_do_context_frame() to provide a new starting point for unwinding based on the context at the point of interruption.

Re: Issue with uwx_step

Thanks Dennis.

i am able to step to the remaining frames now. But from the signal frame when i try to get the Return Pointer i am getting some different value than the one i see in gdb Call stak. The value(RP) at the function which raised the signal is different. From there down i can see the correct values. Is there a different API to get the return pointer for a signal frame ?


Thanks,
Suchitra
Dennis Handly
Acclaimed Contributor

Re: Issue with uwx_step

>But from the signal frame when I try to get the Return Pointer I am getting some different value than the one I see in gdb Call stack.

The return pointer for a signal frame is a magic cookie that says it is a signal frame. There is no need to print it.

>Is there a different API to get the return pointer for a signal frame?

Do you have an example of your output and gdb's?

Re: Issue with uwx_step

I need the address for the function which called signal frame. I have a set of stack frames, then the signal frame and then some more stack frames. till i reach the signal frame i get the return address as in gdb call stack. After i come to signal frame i reset the env using the function uwx_self_do_context_frame and then again try to get the return pointer for the next frame. Then i am getting wrong value. I basically want all the return pointers for all frames in the stack.

Re: Issue with uwx_step

I need the address as mentioned in the attached trace file. Till frame 16 i am getting the values as in the trace. For frame 17(which is RP of signal frame) i get a totally diff address from the stack and then from 18 onwards i am getting correct. i am using uwx_step function to step through the stack.
Dennis Handly
Acclaimed Contributor

Re: Issue with uwx_step

>I need the address for the function which called signal frame.

The fault address should be the PC/IP value.

>I basically want all the return pointers for all frames in the stack.

As in the gdb output, there is no return value for the signal context, it appears on the next line.

>I need the address as mentioned in the attached trace file.

(Please attach text files, not images which I can't cut&paste.)

>For frame 17 (which is RP of signal frame)

No, it is the PC in that signal context.

>I get a totally diff address from the stack

What address do you get? Something that points into the kernel?

Re: Issue with uwx_step

Hi,
Please find attached the stack dump with the return pointers. The signal handler is called at frame 11 and as you said there is no return pointer for it. But for the next frame ie frame 12, which actually threw the exception i am getting a different address in my aplication. The value i get is 0x1c0028e0(the actual value is 0x4022f30:1). Also i see a difference for this frame alone. For other frames the return adress has a :0 appended to it where as in this one a :1 is appended. What is the significance of this.
Dennis Handly
Acclaimed Contributor

Re: Issue with uwx_step

>The signal handler is called at frame 11

More accurately, the signal occurs at #12 and the handler is invoked at #10. Frame #11 is a dummy frame to just hold the signal context.

>as you said there is no return pointer for it.

Have you called _UNW_getIP(3) for that frame?

>The value I get is 0x1c0028e0 (the actual value is 0x4022f30:1).

What did you call to get 0x1c0028e0?

>in this one a :1 is appended. What is the significance of this?

Return values are always bundled aligned, slot 0. But you can get signals on the other two slots.

Re: Issue with uwx_step

For each frame i am calling the return pointer (RP) and getting the values. I didnot call IP for any frame.

Return values are always bundled aligned, slot 0. But you can get signals on the other two slots. Can you please eloborate this? I didn't get it clear