I'm running a program under gdb-5.0-13 which was linked against libefence from ElectricFence-2.2.2-7. Here's the output I see in the gdb window (there's no output from the program because it's an X program): (gdb) run -name linuxxrn -iconName linuxxrn Starting program: /c/build/xrn/xrn -name linuxxrn -iconName linuxxrn [New Thread 1024 (LWP 4493)] Electric Fence 2.2.0 Copyright (C) 1987-1999 Bruce Perens <bruce> [New Cannot find thread 2049: invalid thread handle (gdb) where Couldn't get registers: No such process. The "[New Cannot find thread..." message comes up quite a while after the program starts running. My best guess is that the program is encountering a memory problem and ElectricFence is detecting it and trying to throw control back to the debugger, but that isn't working somehow. I recently upgraded both ElectricFence and gdb, so I don't know if one of these or the other is the one causing the problem. I'm going to try downgrading ElectricFence and see if the problem goes away. This may or may not be a related problem.... If I link this program against efence: include <malloc.h> main() { char *foo = malloc(1); memset(foo, 0, 2048); } run it under gdb and then try to reload it, watch what happens: (gdb) run Starting program: /tmp/a.out [New Thread 1024 (LWP 9575)] Electric Fence 2.2.0 Copyright (C) 1987-1999 Bruce Perens <bruce> Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1024 (LWP 9575)] 0x400aac27 in memset () from /lib/libc.so.6 (gdb) kill Kill the program being debugged? (y or n) y (gdb) file a.out Load new symbol table from "a.out"? (y or n) y Reading symbols from a.out...done. warning: Cannot initialize thread debugging library: generic error (gdb) That last warning may be a problem.
The last part is still a problem...
I haven't seen any trouble since I downgraded to ElectricFence-2.1-3. This suggests that perhaps EF is doing something wrong. Or perhaps EF is doing something completely legitimate which gdb isn't prepared to handle properly.
That's because efence now uses threads.
Still a problem with current gdb CVS.
Still a problem with gdb 5.1
Fixed in gdb 5.2.