Operating System - HP-UX
1745808 Members
3732 Online
108722 Solutions
New Discussion юеВ

Re: gdb/wdb crashes loading my program

 
SOLVED
Go to solution
Trygve Isaacson
Occasional Contributor

gdb/wdb crashes loading my program

I have a problem with debugging that I would greatly appreciate any suggestions on. I'm using HP-UX 11.11 on PA-RISC, gcc 3.4.3, gdb 6.2.1, and wdb 5.0 (same behavior with gdb and wdb). (Thanks to H.Merijn's pages.) If I build a smallish test program (order of magnitude smaller, just the base framework code without the big app on top of it) everything works fine in the debugger. But for the full program (the "real" one), gdb/wdb crashes (segmentation fault) upon trying to load my program symbols -- before even running it. The program runs fine on its own outside the debugger.

The program executable seems large (250MB) which I imagine could be the issue (?) but I am not sure what I can do to shrink that. By contrast, the exe size of the same program built on Windows by VC++ or on Mac OS by CodeWarrior is under 15MB; GCC on Mac OS X also generates a 250MB executable, so perhaps size is not the problem. There is no practical way for me whittle down to a buildable subset in order probe for the limit.

If anyone has insight into what could cause gdb/wdb to crash loading my symbols, or what I can do to diagnose or remedy it, I'd appreciate the help!

Thanks,
Trygve
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: gdb/wdb crashes loading my program

Well, the most logical approach would be to try to use the debugger itself to do a stack trace on one of its own core files. That would at least give you a clue as to what's going on -- if the debugger lives through that. I don't use gcc or g++ on HP-UX but you might try increasing maxssiz, maxdsiz and possibly maxtsiz.
If it ain't broke, I can fix that.
Trygve Isaacson
Occasional Contributor

Re: gdb/wdb crashes loading my program

Thank you so much for the info! That led me down the right path and I was able to get it working.

First, I ran sam (selecting kernel -> configurable parameters) and upped the values of maxssiz, maxtsiz, and maxdsiz to their max allowed values, and rebooted with the rebuilt kernel. The problem persisted, but with the new parameters gdb got further before core dumping, and the error message was better, stating that gdb was crashing either due to running out of memory or maxssiz stack space.

I checked the executables of both gdb and the application I'm debugging, and they're built with the 32-bit compiler. But it occurred to me that I should try upping the 64-bit values of the kernel parameters, too. So I went back into sam and set maxdsiz_64bit, maxtsiz_64bit, and maxssiz_64bit to match the 32-bit settings, and rebooted with a rebuilt kernel. Success! gdb loads my program and so far seems OK debugging it.

For reference, my hardware info and kernel parameters were/are:
/etc/dmesg says I have 1GB physical memory
/etc/swapinfo -t says I have about 2.7GB of swap
The original kernel parameters were:
maxdsiz 0x10000000 (32bit) and 0x40000000 (64bit)
maxtsiz 0x04000000 (32bit) and 0x40000000 (64bit)
maxssiz 0x00800000 (32bit) and 0x00800000 (64bit)
The new kernel parameters that work for me and are at or near the max values sam will allow are:
maxdsiz 0xC0000000
maxtsiz 0x40000000
maxssiz 0x17F00000
(same for 32 and 64 bit)

Thanks again,
Trygve