Date: Thu, 5 Oct 1995 13:15:07 +1000 (EST) From: raoul@cssc-syd.tansu.com.au (Raoul Golan) To: gibbs@freefall.freebsd.org (Justin T. Gibbs) Cc: raoul@cssc-syd.tansu.com.au, freebsd-questions@freebsd.org Subject: Re: gdb problem? libraries, perhaps? (RESOLVED!!!) Message-ID: <199510050315.NAA27004@kiwi.cssc-syd.tansu.com.au> In-Reply-To: <199510050226.TAA14639@aslan.cdrom.com> from "Justin T. Gibbs" at Oct 4, 95 07:26:54 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > > >On FreeBSD, on the other hand, I have csh as my default, and > >"exec /usr/local/bin/zsh" on my .cshrc. With this setup gdb > >crashes since gdb's fork executes .cshrc. > > > >Something's different about the two gdb's, but I'm not sure > >what. > > > >Raoul > > Did you recently upgrade your kernel without rebuilding gdb? The > proc structure was changed a little while back and you will need > to rebuild gdb for it to pick it up. You may have to rebuild > libkvm too. > I've finally got to the bottom of all this. The result is that csh and gdb can make a dangerous combination together. The answer to your question is no. I'm using the same kernel, and the same gcc/gdb as comes with the 2.0.5-RELEASE CD. I'm sure that if you set your default shell to csh, and put in "exec /usr/local/bin/zsh" as the last line of .cshrc as well, then gdb will crash on you, too. Even rebuilding gdb does not help (something I've already tried). I haven't rebuilt kvm, but I doubt it would make a difference. The problem does not appear to be how it's built, but rather how the gdb forks a shell in order to exec the test binary, and what happens when that shell is csh. You see, csh will always execute .cshrc on startup, regardless on whether it's interactive or not. On the other hand, for instance, zsh will only execute .zshrc on *interactive* shells. This means that if your .cshrc has a line saying "exec blah", then invoking "csh filename" will NOT mean executing "filename", but rather "blah" instead. I had "exec /usr/local/bin/zsh" in my .cshrc, so you can see the problem. Yes, you can all shoot me. gdb will fork a shell in order to run its test binary. If that shell is csh, and .cshrc has an "exec blah" line, then gdb is in trouble. It will be forking "blah" instead of its test binary. Is all of this clear? None of this will happen with zsh. It looks very much like a generic gdb problem which appears when combined with csh. I just wish that gdb could be more "user friendly" in giving proper diagnostics or warnings. FreeBSD is completely innocent of all this! I know I can change my default shell rather than having that exec in my .cshrc - but I had it that way since I didn't expect it to cause any problems!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510050315.NAA27004>