From owner-freebsd-questions Wed Jul 31 09:43:59 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA09849 for questions-outgoing; Wed, 31 Jul 1996 09:43:59 -0700 (PDT) Received: from bourbon.pl.vtcom.fr (bourbon.pl.vtcom.fr [193.252.69.217]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id JAA09843 for ; Wed, 31 Jul 1996 09:43:52 -0700 (PDT) Received: (from mail@localhost) by bourbon.pl.vtcom.fr (8.6.12/8.6.11) id SAA25175 for ; Wed, 31 Jul 1996 18:37:38 +0100 Received: from deepthought.sv.vtcom.fr(193.252.64.251) by bourbon.pl.vtcom.fr via smap (V1.3) id sma025170; Wed Jul 31 18:37:14 1996 Date: Wed, 31 Jul 1996 18:42:53 +0200 (MET DST) From: Jean-Paul POIRET X-Sender: jpp@deepthought.sv.vtcom.fr To: FreeBSD questions Subject: Can really gdb examine a core file ? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hello ! When I try a post-mortem analysis with Gdb of a C programm with a bss array , like this es.c : --------------------------- | int titi[1000]; | | f() | | { | | int l = 4; | | kill(getpid(),6); | | } | | main() | | { | | titi[0] = 461; | | f(); | | } | --------------------------- gcc -g -c es.c gcc -g -o es es.o ./es Abort (core dumped) Thus, I have got the core file: -rw------- 1 jpp jpp 147456 Jul 31 18:34 es.core Now, I wish to examine the core file : gdb es es.core GDB is free software and you are welcome to 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. GDB 4.13 (i386-unknown-freebsd), Copyright 1994 Free Software Foundation, Inc... Core was generated by `es'. Program terminated with signal 6, Abort trap. #0 0x805fee5 in end () bt (gdb) #0 0x805fee5 in end () Cannot access memory at address 0x309c. (gdb) It seems that the bt command can't retrieve the stack data. ----------------------------------------------------------- Now, when I comment the two "titi" lines, the backtracking works again: bt (gdb) #0 0x805fee5 in end () #1 0x162c in f () at es.c:5 #2 0x1641 in main () at es.c:10 (gdb) I tried gcore, some gcc options ... without result. It seems that gdb on a core file gives always 0 for global data --------------------------------------------------------------- contents too. ------------ However, without the two titi lines, we can read local data in the core file (but not global data): p f::l (gdb) $1 = 4 (gdb) Today, I run FreeBSD 2.1. I will switch to FreeBSD 2.1.5 in 2 weeks. It could explain my problem, I suppose. Does somebody meet with this gdb problem on core files too ? Jean-Paul =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Jean-Paul POIRET Phone +33 1 46 12 67 90 VTCOM Solutions Vocales Fax +33 1 46 12 67 00 40, rue Gabriel Crie 92245 Malakoff FRANCE E-mail JeanPaul.Poiret@vtcom.fr =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=