Attention UNIX geeks: GDB problem

I’m not a UNIX guy.

I have a project on a Sun workstation that I cannot debug because I crash the GNU debugger. It will either fail with a “bus error” message when I try to step past a socket call, or in more general cases I get a segmentation fault where I’m not manipulating a pointer.

Trying to find some help on this, I found a website that listed GDB problems, and it said that the problem was that the user process was running out of stack space.

  1. Can you tell me if this is true?

  2. Is the stack space allocation something I can change myself?

You can e-mail me directly if this is too geeky even for GQ…

I am far from a programmer or a Unix expert but I’ll take a shot.
Check your shell’s start-up files (.profile, .bashrc, .cshrc, etc) to see if it’s set to limit your memory use. I wish I remembered the exact options but “man <your_shell>” should give you more info.

First step that I would take - turn off ALL optimizaions. Compiler’s often optimize away sanity too. :eek:

Can you step into the socket call? I’m guessing not since you probably don’t have source for that. Also check for how the compiler is targeting the compilation. On Linux, for instance you will get “bus error” as a general crap-out that really sometimes indicates that you are trying to run Pentium code on a 386 or something. Sun used several different MIPS chips if I recall. Maybe your compiler is targeting the wrong chip.

As for memory size issue. I believe the relevant command is “ulimit”. Try both “man ulimit” and “help ulimit”. I think it’s a shell builtin in most cases.