- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Checking the size of the stack using HP aCC
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
04-22-2003 05:04 AM
04-22-2003 05:04 AM
Checking the size of the stack using HP aCC
I don't think there's a standard C/C++ function to do this.
I'm receiving a "Bus error" at a point in my code where a variable is "created" (instantiating a class) . I'm trying to figure out whether something is getting corrupted due to a stack overrun or whether the problem lies somewhere else.
Thanks,
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:14 AM
04-22-2003 05:14 AM
Re: Checking the size of the stack using HP aCC
Hello,
You may use the function mallinfo to
see how much memory your program has
allocated.
To know how much more you can allocate you
will need to know the value of the kernel-parameter maxdsiz.
Lack of swap-space could also be a problem.
Olav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:22 AM
04-22-2003 05:22 AM
Re: Checking the size of the stack using HP aCC
Hello again,
The struct pst_status returned from
pstat_getproc also has a lot of interesting
info, like pages used for data, pages used
for stack etc.
Olav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:31 AM
04-22-2003 05:31 AM
Re: Checking the size of the stack using HP aCC
main()
{
int i;
printf("The Stack Top is near %#X\n",&i);
}
also run
%echo;echo "text data bss total"; size a.out
to look for different segment sizes.
I would typically use a debugger like "gdb" for this kind of diagnostics.
A Bus Error typically means a misalignment.That is somewhere something funky happened.Mostly as a result of irregular memory allocation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:37 AM
04-22-2003 05:37 AM
Re: Checking the size of the stack using HP aCC
Thanks,
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 05:44 AM
04-22-2003 05:44 AM
Re: Checking the size of the stack using HP aCC
$gdb filename
(gdb) b main
Abort(coredump)
Strange, huh? Now how do you go about debugging that :(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 06:07 AM
04-22-2003 06:07 AM
Re: Checking the size of the stack using HP aCC
gdb also has some bugs, unfortunately - nothing really new.
But I think you can try run the program even without this breakpoint. It should be stopped by gdb at the moment of signal generation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2003 01:03 AM
04-25-2003 01:03 AM
Re: Checking the size of the stack using HP aCC
The failing program had been compiled with a high optimisation level, so we recompiled it without optimisation and with debugging information, hoping to get more clues using the debugger. Interestingly, it then failed with a SIGSEGV instead of a bus error and we could immediately locate a (the?) fault. Perhaps the compiler optimisations can transform a segmentation-violation into a bus error? (Compiler Writer's Motto - Optimization Pass: Making a wrong program worse is no sin- Bill McKeeman, Wang Institute)