LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-01-2002, 04:21 PM   #1
balteo
LQ Newbie
 
Registered: Jul 2002
Posts: 27

Rep: Reputation: 15
Problem with GDB


Hello,
I am compiling a C program from several source files and the "list" command of gdb always results in a "init.c: no such file or directory". Note that the problem does not happen when the program is made on only one source file.
How can I make gdb work with several source files?
Thanks in advance,
Balteo.
 
Old 07-01-2002, 06:45 PM   #2
manaskb
Member
 
Registered: Jan 2002
Location: India
Distribution: Suse , Mandrake
Posts: 121

Rep: Reputation: 15
This problem generally happens when gdb cannot find source tree from which you compiled the executable. For instance you had a source tree /path/to/source and compiled it here. But later you removed the source tree from here. Then you may see the error.

Also make sure you have the -g option set in the CFLAGS of your Makefile ( since you are using multiple source files).
Thanks,
Manas
 
Old 07-01-2002, 07:00 PM   #3
balteo
LQ Newbie
 
Registered: Jul 2002
Posts: 27

Original Poster
Rep: Reputation: 15
Further to your reply

Thanks for replying!

For your information all source files are located in the same directory I am running gdb from and I compiled everything with the -g option. Still, it is not working...

Is there a way to tell gdb the name of the source files used.
Thanks in advance,

Balteo.
 
Old 07-01-2002, 07:14 PM   #4
manaskb
Member
 
Registered: Jan 2002
Location: India
Distribution: Suse , Mandrake
Posts: 121

Rep: Reputation: 15
Actually you can create the .gdbinit file with a line like this pointing to your source directory.
dir /usr/src/path/to/source/files
 
Old 07-01-2002, 07:38 PM   #5
balteo
LQ Newbie
 
Registered: Jul 2002
Posts: 27

Original Poster
Rep: Reputation: 15
Unhappy .gdbinit

Hello,
I created the .gdbinit file and placed it both in the root and etc directories. My file reads as follows:
"dir /path/to/sources"
I still get the nasty "init.c no such file or directory"!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
normal gdb and spec gdb for kgdb Igor007 Programming 1 09-23-2005 04:15 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 01:41 PM
gdb problem lazyman Programming 1 01-10-2005 09:42 AM
GDB problem zaheer031 Linux - Newbie 1 12-26-2004 11:50 PM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration