*BSD News Article 32641


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!MathWorks.Com!panix!not-for-mail
From: wpaul@panix.com (Bill Paul)
Newsgroups: comp.os.386bsd.questions
Subject: Re: GDB dosent find symbols?!
Date: 8 Jul 1994 16:45:15 -0400
Organization: The M00se Illiminati (bl00p!)
Lines: 77
Message-ID: <2vkdsr$94r@panix3.panix.com>
References: <2vk8k1$f2d@oak.zilker.net>
NNTP-Posting-Host: panix3.panix.com
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se,
Matt Helgren (ross@zilker.net) had the courage to say:

: 	Im running FreeBSD 1.1.5.1 and having trouble wiht gdb and gcc.  My
: problem is im compiling some code with -g to gcc but when invoking gdb
: on the new binary it complains about not finding any symbols.  I've even
: tried linking the binary statically thinking that gdb didnt like the
: dynamic version but no help.  Am I missing something obvious?  Thanks
: for any help.

: Matt

Hurm... I'm pretty sure the debugger works since I used to smack the
netaudio package around yesterday. Let's see:

[/home/wpaul]:skynet{38}% cat > hello.c
#include <stdio.h>

main()

{
printf("Foo!\n");
}
^D
[/home/wpaul]:skynet{39}% gcc -g -o hello hello.c
[/home/wpaul]:skynet{40}% ls -l hello
-rwxr-xr-x    1 wpaul       10113 Jul  8 16:15 hello
[/home/wpaul]:skynet{41}% hello
Foo!
[/home/wpaul]:skynet{42}% gdb hello
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.11 (i386-unknown-freebsd), 
Copyright 1993 Free Software Foundation, Inc...
(gdb) list
1       #include <stdio.h>
2
3       main()
4
5       {
6       printf("Foo!\n");
7       }
(gdb) run
Starting program: /home/wpaul/hello 
Foo!

Program exited with code 05.
(gdb) 

Try the above on your machine. If it works, then the gdb is not the problem.
(There is a *SLIM* chance that a bug cropped up between 1.1.5 and 1.1.5.1,
but I really doubt it.)

Some things to watch for:

- If your program consists of several different .c files, make sure you're
   compiling all of them with -g.

- If you're building something with a Makefile generated by some other
  program, or written by some other person, make sure it isn't using
  the 'strip' command on the binary.

- Check all the compilation flags you're using against the man pages for
  gcc and ld. There are flags to strip the symbols from output files and
  you might be using one by mistake.

Hope this helps.

-Bill
--
 _      /\      _            Join the
/ \_/\_/  \_/\_/ \  .----.   M00se Illuminati   Bill Paul 
\_____/ () \_____/ (bl00p!)  Face it: wouldn't  <Big City M00se>
     /      \       `----'   you feel much      wpaul@panix.com   -or-
    /  \__/  \    --'        safer?             ghod@drycas.club.cc.cmu.edu
   /__________\