This is the mail archive of the gdb-testers@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi! I am having serious problem with gdb. I thought my problem were solved when I started using the 4.16.85 snapshot but I still run into trouble. Most of the time, what happens is rather simple. I execute my application with a breakpoint deep in a function. When gdb stops there, I try to print the value of a variable (often a pointer). Than gdb "seems" to hang, eats up all my virtual memory (200M) and then says that it cannot access the address. (it used to coredump). I was very puzzled by this so I picked an old test program of mine and compiled it with both 2.7.2.3 and egcs 1.0.1. And even though, in these simple example gdb doesn't eat all my VM, here it also returns the strange message. I append to this email the single source file used for the test together with a "dump" of the program executed alone/inside gdb compiled under egcs. If you have any pointer/advice, let me know ============================================================================== Debug session for the silly program. All I'm doing is a trace of the first insert call and printing the data that is to be inserted. The test program in itself is irrelevant. WHat really matters is the actual behavior. of the debugger. I also still run into the same problem when I try to print "this". (eating al the VM) It mainly depends on the calling context. thorgal /home/ldm/Misc [32] -> /usr/local/bin/g++ -g toto.C thorgal /home/ldm/Misc [33] -> a.out A::Hello 0 A::Hello 1 -------------- A::Hello 1 A::Hello 1 A::Hello 1 A::Hello 1 A::Hello 1 B::Hello 2 B::Hello 2 B::Hello 2 B::Hello 2 B::Hello 2 thorgal /home/ldm/Misc [34] -> gdb a.out GNU gdb 4.16.85 Copyright 1997 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnulibc1"... (gdb) l 74 { 75 for(int i=0;i<s;i++) 76 a[i].visit(op); 77 } 78 79 int main() 80 81 82 { 83 A a[5]; (gdb) l 84 B b[5]; 85 List<A> aList; 86 aList.insert(new A); 87 aList.insert(new A); 88 Iterator<A> myIt(&aList); 89 int i = 0; 90 while (myIt.more()) { 91 myIt()->X(i++); 92 myIt.next(); 93 } (gdb) break 85 Breakpoint 1 at 0x80488b8: file toto.C, line 85. (gdb) run Starting program: /mnt/disk2/home/ldm/Misc/a.out Breakpoint 1, main () at toto.C:85 85 List<A> aList; (gdb) p aList $1 = {head = 0xbffff780} (gdb) p *aList.head $2 = {data = 0xbffff884, next = 0x0} (gdb) n 86 aList.insert(new A); (gdb) p *aList.head Cannot access memory at address 0x0. (gdb) p *aList Structure has no component named operator*. (gdb) p aList $3 = {head = 0x0} (gdb) s A::A (this=0x804a8a8) at toto.C:19 19 }; (gdb) s 83 A a[5]; (gdb) s List<A>::insert (this=0xbffff734, data=0x804a8a8) at toto.C:58 58 void insert(T* data) { head = new Node(data,head);} (gdb) where #0 List<A>::insert (this=0xbffff734, data=0x804a8a8) at toto.C:58 #1 0x80488ee in main () at toto.C:86 #2 0x804873e in ___crt_dummy__ () (gdb) p this $4 = (List<A> *) 0xbffff734 (gdb) p *this $5 = {head = 0x0} (gdb) p data Cannot access memory at address 0x804b004. (gdb) s List<A>::Node::Node (this=0x804a8b8, d=0x804a8a8, n=0x0) at toto.C:52 52 Node(T* d,Node* n) { data = d;next =n;} (gdb) p d Cannot access memory at address 0x804b004. (gdb) quit The program is running. Exit anyway? (y or n) y thorgal /home/ldm/Misc [35] -> ============================================================================= My system: Linux thorgal 2.0.32 #1 Tue Dec 23 12:52:21 EST 1997 i686 thorgal /home/ldm/Misc [47] -> /usr/local/bin/g++ -v Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.23/specs gcc version egcs-2.90.23 980102 (egcs-1.0.1 release) thorgal /home/ldm/Misc [46] -> ls -l /lib total 4401 lrwxrwxrwx 1 root root 39 Dec 7 14:44 cpp -> ../usr/lib/gcc-lib/i486-linux/2.7.2/cpp* lrwxrwxrwx 1 root root 17 Mar 8 20:06 ld-linux.so.1 -> ld-linux.so.1.9.6* -rwxr-xr-x 1 root root 22721 Feb 21 08:07 ld-linux.so.1.9.6* -rwxr-xr-x 2 root root 104236 Feb 21 08:07 ld.so* -rwxr-xr-x 2 root root 104236 Feb 21 08:07 ld.so.1.9.6* lrwxrwxrwx 1 root root 19 Mar 8 19:58 libc.so -> /lib/libc.so.5.4.44* lrwxrwxrwx 1 root root 13 Dec 21 1996 libc.so.4 -> libc.so.4.7.2 -rw-r--r-- 1 root root 634880 Dec 21 1996 libc.so.4.7.2 lrwxrwxrwx 1 root root 19 Mar 8 19:58 libc.so.5 -> /lib/libc.so.5.4.44* -rwxr-xr-x 1 root root 2178190 Feb 21 10:16 libc.so.5.4.44* lrwxrwxrwx 1 root root 17 Dec 19 1996 libcom_err.so.2 -> libcom_err.so.2.0* -rwxr-xr-x 1 root root 5819 Sep 1 1996 libcom_err.so.2.0* lrwxrwxrwx 1 root root 14 Mar 8 20:06 libdl.so -> libdl.so.1.9.6* lrwxrwxrwx 1 root root 14 Mar 8 20:06 libdl.so.1 -> libdl.so.1.9.6* -rwxr-xr-x 1 root root 5416 Feb 21 08:07 libdl.so.1.9.6* lrwxrwxrwx 1 root root 13 Dec 19 1996 libe2p.so.2 -> libe2p.so.2.1* -rwxr-xr-x 1 root root 8841 Sep 1 1996 libe2p.so.2.1* lrwxrwxrwx 1 root root 16 Dec 19 1996 libext2fs.so.2 -> libext2fs.so.2.0* -rwxr-xr-x 1 root root 46800 Sep 1 1996 libext2fs.so.2.0* lrwxrwxrwx 1 root root 18 Mar 8 19:58 libm.so -> /lib/libm.so.5.0.9* lrwxrwxrwx 1 root root 18 Mar 8 19:58 libm.so.5 -> /lib/libm.so.5.0.9* -rwxr-xr-x 1 root root 75501 Feb 21 10:16 libm.so.5.0.9* lrwxrwxrwx 1 root root 11 Dec 28 1996 libpam.so -> libpam.so.0 lrwxrwxrwx 1 root root 14 Dec 19 1996 libpam.so.0 -> libpam.so.0.50 -rw-r--r-- 1 root root 56527 Oct 25 1996 libpam.so.0.50 -rw-r--r-- 1 root root 12050 Oct 25 1996 libpam_misc.a lrwxrwxrwx 1 root root 17 Dec 7 15:25 libpthread.so.0 -> libpthread.so.0.6* -rwxr-xr-x 1 root root 68705 Oct 12 13:10 libpthread.so.0.6* -rw-r--r-- 1 root root 736958 Oct 24 15:00 libpwdb.a lrwxrwxrwx 1 root root 12 Dec 17 20:50 libpwdb.so -> libpwdb.so.0 lrwxrwxrwx 1 root root 15 Dec 17 20:51 libpwdb.so.0 -> libpwdb.so.0.54 -rw-r--r-- 1 root root 364167 Oct 24 15:00 libpwdb.so.0.54 lrwxrwxrwx 1 root root 12 Dec 19 1996 libss.so.2 -> libss.so.2.0* -rwxr-xr-x 1 root root 18029 Sep 1 1996 libss.so.2.0* lrwxrwxrwx 1 root root 19 Dec 28 1996 libtermcap.so.2 -> libtermcap.so.2.0.8* -rwxrwxr-x 1 root root 11419 Jul 28 1996 libtermcap.so.2.0.5* -rwxr-xr-x 1 bin bin 11925 Aug 9 1996 libtermcap.so.2.0.8* drwxr-xr-x 3 root root 1024 Dec 23 18:37 modules/ drwxr-xr-x 2 root root 1024 Dec 28 1996 security/ ============================================================================= Here comes the file