- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Frame size calculation
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
Forums
Discussions
Discussions
Discussions
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
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-08-2010 02:17 AM
03-08-2010 02:17 AM
I am working on Stack unwinding on HP Itanium and wrt a recent thread on calculating the Frame size(http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1410703) i was trying to calculate the frame size with Stack pointer and Prev Stack pointer, and with BSP and Prev BSP values. PFA my sample code. When i print the values for Frame size with Memory stack, and when i debug(using wdb) the values showed for Size of Frame in 'frame info' command looks different. Why is this so. For eg : For frame 2 i am getting the frame size as 20 from the gdb and in my program i get as 64.
Thanks
Solved! Go to Solution.
- Tags:
- stackframe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2010 12:12 PM - edited 08-21-2011 07:40 PM
03-08-2010 12:12 PM - edited 08-21-2011 07:40 PM
Re: Frame size calculation
>values showed for Size of Frame in 'frame info' command looks different. For frame 2, I am getting the frame size as 20 from the gdb and in my program I get as 64.
The values from "info frame" are register frame, in registers. The values for memory frame are always a multiple of 16 bytes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2010 09:20 PM
03-08-2010 09:20 PM
Re: Freame size calculation
The value shown in Info frame and the frame size calculated by getting the difference of BSP for current frame and previous frame also lpoks differnt. For eg: For frame 4 the value shown in wdb Info frame is 5 and that using the program i sent is 24.
And what exactly is the frame size. I get different values in Wdb, the calulation of frame size using SP and PSP and the calculation using BSP and previous BSP. Which among this is the actual one ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2010 02:58 AM - edited 08-21-2011 07:40 PM
03-09-2010 02:58 AM - edited 08-21-2011 07:40 PM
Re: Frame size calculation
>The value shown in info frame and the frame size calculated by getting the difference of BSP for current frame and previous frame also looks different.
Several reasons. The value gdb uses is based on the CFM register and is the number of registers.
The value you compute is the size of the previous register frame. And every 63 registers, contains a NaT register.
>And what exactly is the frame size?
There are two frames. To keep it simple, you should only print out the memory frame size. If you want to print out the number of registers in the register frame, you can do that too but they are separate.
You have several coding style problems with your source.
You are going off the right by indentation. Instead you should use gotos, return or break to limit the indent.
You are using evil prespacing, Fortran carriage control or COBOL AFTER ADVANCING. This doesn't belong with C.
I.e. Don't use "\n" at the start of your formats, only if you don't know what has been output before.
Attached is where I have rewritten everything to use CFM register.
Ret add is 60000000c00269f0
IP is 40032c0 Current function name is: main
Sp = 200000007fffed70 PSp = 200000007fffed70
Memory Frame size = 0
BSP = 200000007fffed70 CFM = c000000000000103
Reg Frame size = 24
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2010 03:40 AM
03-09-2010 03:40 AM
Re: Freame size calculation
Now also when i run and check the frame size in gdb and the one you calculated using CFM, they are different.
For a frame where memory stack frame size is 0, can we take register frame size as the frame size ? (BSP-prev BSP or the one calculated using CFM) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2010 03:57 AM - edited 08-21-2011 07:39 PM
03-09-2010 03:57 AM - edited 08-21-2011 07:39 PM
Solution>when I run and check the frame size in gdb and the one you calculated using CFM, they are different.
Well, 8 times bigger since I converted it to bytes.
>For a frame where memory stack frame size is 0, can we take register frame size as the frame size?
The memory frame size is the memory frame size. Zero is a valid value, don't be scared. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2010 07:24 PM - edited 08-21-2011 07:38 PM
03-09-2010 07:24 PM - edited 08-21-2011 07:38 PM
Re: Frame size calculation
FYI, a colleague noticed you have a bounds error in foo3, your buf isn't large enough for the strcpy.
Compiling with +wlint shows the error right away:
procedure foo3: warning #20206-D: Possible out of bound access (In expression "strcpy((char*)buf, (const char*))", variable "buf" (type: char [32]) has byte range [0 .. 31], writing byte range [0 .. 33].)