public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb does not find any source files in a very simple testcase.
@ 2006-02-10 21:40 Yasuo Iwakura
  2006-02-10 21:45 ` Joel Brobecker
  0 siblings, 1 reply; 2+ messages in thread
From: Yasuo Iwakura @ 2006-02-10 21:40 UTC (permalink / raw)
  To: gdb

Hello everybody,

i set up a simple testcase just containing a HelloWorld-program

main.cc:
#include <stdio.h>

int main()
{	printf("Puga!");
}

it resides i a directory called "HelloWorld".
No other files are there, at the moment. 
Then i compile it using:

g++ main.cc (using gcc with a main.c does not work either)

then i start gdb (from the same directory):

yasuo@lainsglove ~/Projects/HelloWorld $ gdb a.out
GNU gdb 6.4
Copyright 2005 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-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) info sources
Source files for which symbols have been read in:



Source files for which symbols will be read in on demand:

/var/tmp/portage/glibc-2.3.6-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/crtn.S,
/var/tmp/portage/glibc-2.3.6-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/crti.S

Here i expect gcc to list main.cc, but it does not. So i check the
indexed directories: 

(gdb) show directories
source directories searched: $cdir:$cwd

The $cwd contains main.cc, but gdb does not use it. 
I tried to add it manually, but it did not help.

(gdb) list
1       /var/tmp/portage/glibc-2.3.6-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/crti.S: Datei oder Verzeichnis nicht gefunden.

in /var/tmp/portage/glibc-2.3.6-r2/work/build-default-i686-pc-linux-gnu-nptl/csu/crti.S
(gdb)    

(Sorry for the german locales, "Datei oder Verzeichnis nicht gefunden"
translates to: "File or directory not found").
As you might know /var/temp/portage is the temporary directory of the
gentoo portage system. gdb and glibc got compiled there. 
Everything other than sourcefiles work fine. For example i can set
breakpoints:

(gdb) break main
breakpoint 1 at 0x804845a

And gdb uses them: 

(gdb) run
starting program: /home/yasuo/Projects/HelloWorld/a.out

Breakpoint 1, 0x0804845a in main ()

But i would like to show gdb the sourcelines(in backtraces for example
they are REALLY handy).

Here is some extra information about my system: 

yasuo@lainsglove ~/Projects/HelloWorld $ gcc --version
gcc (GCC) 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9)


sys-libs/glibc
	Latest version available: 2.3.6-r2	
	Latest version installed: 2.3.6-r2

yasuo@lainsglove ~/Projects/HelloWorld $ uname -a
Linux lainsglove 2.6.14-gentoo-r6 #7 PREEMPT Tue Feb 7 11:51:23 
CET 2006 i686 AMD Athlon(tm) XP 2600+ AuthenticAMD GNU/Linux

What am i doing wrong? Is this a bug? 
Or is it a gentoo-related Problem?
 

Thanks i advance
-- 
Yasuo Iwakura <deus@thewired.net>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gdb does not find any source files in a very simple testcase.
  2006-02-10 21:40 gdb does not find any source files in a very simple testcase Yasuo Iwakura
@ 2006-02-10 21:45 ` Joel Brobecker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Brobecker @ 2006-02-10 21:45 UTC (permalink / raw)
  To: Yasuo Iwakura; +Cc: gdb

> Then i compile it using:
> 
> g++ main.cc (using gcc with a main.c does not work either)

Is this the complete command you used? You should add "-g" to tell
the compiler to include debugging information. Without that, the
debugger operations are limited.

-- 
Joel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-10 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-10 21:40 gdb does not find any source files in a very simple testcase Yasuo Iwakura
2006-02-10 21:45 ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).