GDB in Lenny

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi .

I'm trying to debug my example program with GDB. My question is why GDB do
not show the simbolic information. (e.g Line number and vars)

server:/home/sanyi/ALP/ch01# gdb reciprocal
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) run
Starting program: /home/sanyi/ALP/ch01/reciprocal

Program received signal SIGSEGV, Segmentation fault.
0xb7510358 in ?? () from /lib/i686/cmov/libc.so.6
(gdb) where
#0  0xb7510358 in ?? () from /lib/i686/cmov/libc.so.6
#1  0xb77807c4 in ?? ()
#2  0x00000000 in ?? ()
(gdb)

The source programs are :

main.c 

#include <stdio.h>
#include <stdlib.h>
#include "reciprocal.hpp"
int main (int argc, char **argv){
	int i;
	i = atoi (argv[1]);
	printf ("The reciprocal of %d is %g\n",i,reciprocal (i));
	return 0;
}

reciprocal.cpp:

#include <cassert>
#include "reciprocal.hpp"

double reciprocal (int i) {
	assert (i != 0);
	return 1.0/i;
}

The Makefile:

reciprocal: main.o reciprocal.o
		g++ $(CFLAGS) -o reciprocal main.o reciprocal.o
main.o: main.c reciprocal.hpp
		gcc $(CFLAGS) -c main.c
reciprocal.o: reciprocal.cpp reciprocal.hpp
		g++ $(CFLAGS) -c reciprocal.cpp
clean: 
		rm -f *.o reciprocal


I build the programm with make CFLAGS=-g

server:/home/sanyi/ALP/ch01# make CFLAGS=-g
gcc -g -c main.c
g++ -g -c reciprocal.cpp
g++ -g -o reciprocal main.o reciprocal.o

Thank You 
-- 
View this message in context: http://old.nabble.com/GDB-in-Lenny-tp26545396p26545396.html
Sent from the gcc - Help mailing list archive at Nabble.com.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux