Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 1996 18:42:53 +0200 (MET DST)
From:      Jean-Paul POIRET <jpp@vtcom.fr>
To:        FreeBSD questions <freebsd-questions@freebsd.org>
Subject:   Can really gdb examine a core file ?
Message-ID:  <Pine.BSF.3.91.960731182725.11439A-100000@deepthought.sv.vtcom.fr>

next in thread | raw e-mail | index | archive | help
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960731182725.11439A-100000>