- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Stack Unwinding - Register values
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2010 04:52 AM
тАО03-02-2010 04:52 AM
I am working on stack unwinding and need to get the values of registers for each frame. When i tried a sample program to get the registers for each frame, i observed that the register values(i am getting 20 GRs) are same for all the frames. Can you please help me to get the Register values for each frame in a stack. PFA my sample program.
Suchitra
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2010 09:29 PM
тАО03-02-2010 09:29 PM
Re: Stack Unwinding - Register values
secondly, your program is not complicated enough to get these preserved registers value changing. only scratch registers may change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-02-2010 11:36 PM
тАО03-02-2010 11:36 PM
Re: Stack Unwinding - Register values
I saw in the Itanium Architecture document that General registers r4-r7 are preserved registers and tried printing those with
uwx_get_reg(env,UWX_REG_GR(x),┬о) function. I am getting the same values for all the frames for these registers. However when i tried printing 32,33,34,40 i could see some changes in the values. I have attached my code. Also when i used __uc_get_grs() function to get the register values in an array,i am getting all 0 values. I am getting the context as 0 and return value of __uc_get_grs() as 22.
Thanks,
Suchitra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-03-2010 12:11 AM
тАО03-03-2010 12:11 AM
Re: Stack Unwinding - Register values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-03-2010 03:06 AM
тАО03-03-2010 03:06 AM
Re: Stack Unwinding - Register values
You should not be calling getcontext(2). The proper unwind function is uwx_get_reg(3).
>I am getting the same values for all the frames for these registers.
Because the compiler absolutely doesn't want to use those callee save registers.
>when I used __uc_get_grs() function to get the register values in an array
Again, don't use uc_access(3) with unwind.
>Ideally which all register values I need to print?
What are you going to do with them? It may be better to get a core file and then use a debugger on it.
Otherwise you need to print all of them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-03-2010 04:54 AM
тАО03-03-2010 04:54 AM
Re: Stack Unwinding - Register values
I have tried with unwind libraries and done some changes in the code. Now i am getting a value for the context and getting values for registers(Gr 30 - 50) which are different for each functions. Please let me know whether the approach i have taken is correct or not.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-03-2010 09:56 PM
тАО03-03-2010 09:56 PM
Re: Stack Unwinding - Register values
i want to print the registers at failure when any exception happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2010 03:25 AM
тАО03-04-2010 03:25 AM
Re: Stack Unwinding - Register values
You should NOT be using the old unwind lib. Only use the uwx functions.
See attached.
You should also use the CFM register to figure out how many stacked registers there are and not use all 128.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-04-2010 09:33 PM
тАО03-04-2010 09:33 PM
Re: Stack Unwinding - Register values
I want to print the values og General registers from 1 to 13 and the following Application registers:
_UNW_AR_RSC, _UNW_AR_BSP, _UNW_AR_BSPSTORE, _UNW_AR_RNAT, _UNW_AR_CCV, _UNW_AR_UNAT, _UNW_AR_FPSR, _UNW_AR_ITC, _UNW_AR_PFS, _UNW_AR_LC, _UNW_AR_EC, and _UNW_AR_LIST_COUNT
When i tried printing the GRs from 1-13 using the function you sent, its throwin g error as Bad uwx status = -9. How can i achieve my goal?
I was using the following code snippet to print the above mentioned values using the unwind libraries.
for(i=1;i<=13;i++) // General Registers 1-13
{
GRegs[j++] = _UNW_getGR(&pCtx->uc,i);
}
j=0;
// Application Registers
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_FPSR);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_RNAT);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_UNAT);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_PFS);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_BSP);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_BSPSTORE);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_RSC);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_LC);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_EC);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_CCV);
ARegs[j++] = _UNW_getAR(&pCtx->uc,_UNW_AR_ITC);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2010 04:54 AM
тАО03-05-2010 04:54 AM
SolutionYou can't get all of these, (only r4-r7). You can only do that for the top frame or any with a signal context. And you'll need to use your original getcontext(2) at the top.
In other frames, you can't get the correct values, so don't even try.
And if you do call getcontext(2) this may destroy those registers you want to print.
>it's throwing error as Bad uwx status = -9. How can I achieve my goal?
You got that too. :-)
>I was using the following code snippet to print the above mentioned values using the unwind libraries.
No, you are using the obsolete unwind routines, don't be caught dead using them.