Author Topic: "No source file named " problem while debugging  (Read 52462 times)

Offline Ramazan Kartal

  • Multiple posting newcomer
  • *
  • Posts: 16
"No source file named " problem while debugging
« on: November 15, 2006, 04:26:46 pm »
Hi,

I have a problem setting breakpoints in my code. Actually I am able to set breakpoints, but debugger does not stop when it reaches the breakpoint, it simply says "No source file named ../Safka/Safka.cpp.".

Details:
I have the following directory structure.

C:\Z
C:\Z\Saf
C:\Z\Safka

I have the following files
C:\Z\Test.workspace
C:\Z\Saf\Saf.cbp
C:\Z\Saf\Saf.cpp
C:\Z\Saf\Saf.h
C:\Z\Safka\Safka.cbp
C:\Z\Safka\Safka.cpp
C:\Z\Safka\Safka.h

Saf.cbp is a console project. Safka.cbp is a static library project. Saf.cpp contains "main" and simply calls a function in Safka.cpp which prints "doThis" on the screen. I set a preakpoint in this function in Safka.cpp and start the debug (F8). Program runs, I can see the "doThis" on the screen, however debugger does not stop on this breakpoint. On debugger(debug) pane, it says:
Setting breakpoints
Debugger name and version: GNU gdb 6.3
No source file named ../Safka/Safka.cpp.
Breakpoint 1 ("../Safka/Safka.cpp:11) pending.

Build log is as follows:
-------------- Build: debug in Safka ---------------
mingw32-g++.exe -g -ggdb -fno-default-inline -fno-inline -fno-inline-functions -finline-limit=0 -g3 -DDEBUG1 -finput-charset=latin5  -I..\K -I..\T -I..\L -IC:\MinGW\include  -c Safka.cpp -o debug\Safka.o
ar.exe -rs debug\libSafka.a debug\Safka.o
   
ar.exe: creating debug\libSafka.a

-------------- Build: debug in Saf ---------------
mingw32-g++.exe -g -ggdb -fno-default-inline -fno-inline -fno-inline-functions -finline-limit=0 -g3 -DDEBUG1 -finput-charset=latin5  -I..\Safka -I..\T -I..\L -I..\K -IC:\MinGW\include  -c Saf.cpp -o debug\Saf.o
mingw32-g++.exe -LC:\MinGW\lib  -o debug\Saf.exe debug\Saf.o    C:\Z\Safka\debug\libSafka.a
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

I am using "svn build rev 3202" dated Nov 10 2006, 16:32:01.

Is this a bug, or am I doing something wrong?

Thanks,
Ramazan Kartal
 

 

pbo42

  • Guest
Re: "No source file named " problem while debugging
« Reply #1 on: November 21, 2006, 10:38:42 am »
I have a similar project structure and the same problem (Windows, mingw, gdb-6.3-2).

I played a bit with setting breakpoints and the current directory manually (via Settings->Compiler and Debugger->Debugger settings->Debugger initialization commands (for debugging this is useless, but shows how it could work)) .

The current directory is set correctly with the directory command.
It seems that gdb does not treat a relative path given with dots (../ and similar) correctly for the breakpoint command. If I set the breakpoint with an absolute path, the "No source file named" warning doesn't occur. (Is this true too for linux/unix version of gdb?)

So, if Code::Blocks would generate the gdb breakpoint command with absolute paths, it would work. But I haven't found any setting or condition which could force CB to do this. Any suggestions?

Peter

pbo42

  • Guest
Re: "No source file named " problem while debugging
« Reply #2 on: November 22, 2006, 10:47:21 am »
I played a bit with setting breakpoints and the current directory manually (via Settings->Compiler and Debugger->Debugger settings->Debugger initialization commands (for debugging this is useless, but shows how it could work)) .

 :lol: "Debug->Send user command to debugger" is basically the more useful way do that!!

Entering

break "full_path_to_source_file:lineno"

there works for now, but it's not the most comfortable way...

Peter

Offline Phatency

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: "No source file named " problem while debugging
« Reply #3 on: November 23, 2006, 01:11:47 pm »
Could codeblocks actually add all the source directories to begin with? Wouldn't that eliminate the problem? Or are the recursive paths to blame?

I'm still having the same problem with the latest nightly (3253), gdb 6.3 winXP SP2.

Code: [Select]
Adding source dir: C:\CodeBlocks\user\ytlp\gen\
Adding source dir: C:\CodeBlocks\user\ytlp\gen\
Adding source dir: C:\CodeBlocks\user\ytlp\graph\
Adding source dir: C:\CodeBlocks\user\ytlp\graph\
Adding source dir: C:\CodeBlocks\user\ytlp\aitest\
Adding source dir: C:\CodeBlocks\user\ytlp\aitest\
Changing directory to: ./bin/
Adding file: .\bin\Debug.exe
Starting debugger: done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.3
Breakpoint 2 ("../graph/src/scenemngr.cpp:18) pending.
No source file named ../graph/src/scenemngr.cpp.


All projects are compiled with debugging symbols enabled.
« Last Edit: November 23, 2006, 01:23:00 pm by Phatency »

Offline Ramazan Kartal

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: "No source file named " problem while debugging
« Reply #4 on: November 24, 2006, 10:35:51 am »
Hi,

After experimenting with gdb, I found out that if:
1. You start the gdb using the command line "gdb -nx -readnow -fullname  -quiet -args Program.exe"
2. You set the breakpoints for foreign files using the absolute path of filename with forward slashes

then it works.

So I downloaded all the necessary wxWidgets and codeblocks sources, changed sources accordingly and compiled. Now breakpoints work flawlessly, that is no more "No source file named blabla". I just want to test it a little more and if all goes well I will create a patch for applying to cvs sources.

Ramazan Kartal
   
 

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: "No source file named " problem while debugging
« Reply #5 on: November 24, 2006, 11:51:56 am »
1. You start the gdb using the command line "gdb -nx -readnow -fullname  -quiet -args
then it works.
Nice one. Please also verify that this switch is available in major GDB version (5.x and 6.x) if possible. This would be an important additional information.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Ramazan Kartal

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: "No source file named " problem while debugging
« Reply #6 on: November 24, 2006, 04:52:28 pm »
Hi,

For GDB 6.3 series, there was no problem I could find. However for GDB 5.1.1 there are some problems.
1. It does not accept "-args" in command line.
2. It does not accept "set breakpoint pending on" as a command.
3. Although it accepts "-readnow", my solution above does not work for GDB 5.1.1. It always requires an exact filename match, which you can find out by issuing an "info sources" command in debugger.

I don't have access to other versions of GDB so I cannot test them, but how many of users actually using versions other than 6.3?

Ramazan Kartal
 

Offline Ramazan Kartal

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: "No source file named " problem while debugging
« Reply #7 on: November 24, 2006, 11:24:07 pm »
Hi,

I just created a patch to correct the "No source file named blabla" problem, and send it to berlios.

Ramazan Kartal

Offline Phatency

  • Multiple posting newcomer
  • *
  • Posts: 65
Re: "No source file named " problem while debugging
« Reply #8 on: November 25, 2006, 07:20:56 pm »
I don't have access to other versions of GDB so I cannot test them, but how many of users actually using versions other than 6.3?


Well, I've read a few times being said that debugging (in C::B) doesn't even work in earlier versions than 6.x, so I guess not many. I sure hope this'll get applied soon, as I really want to debug my libraries :P
« Last Edit: November 25, 2006, 07:27:27 pm by Phatency »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: "No source file named " problem while debugging
« Reply #9 on: November 25, 2006, 08:36:15 pm »
Quote
Well, I've read a few times being said that debugging (in C::B) doesn't even work in earlier versions than 6.x

That used to be true but not anymore. gdb 5.x works fine.
Be patient!
This bug will be fixed soon...

Offline Kayl

  • Single posting newcomer
  • *
  • Posts: 4
Re: "No source file named " problem while debugging
« Reply #10 on: November 28, 2006, 12:56:09 am »
Would it be possible for C::B team to post a message on this thread when Ramazan Kartal's patch will be used in a nightly build as I am in the same situation and dying to be able to debug my static lib without having to switch to VC just for that.

May I also use this message to ask how you guys deal with dependencies with your static lib ?
My app (.exe) depends on the static lib. The app project is the current one. Each time I build the app when the static lib sources have changed, the .a is generated just fine but the building of the app itself is more than random. Most of the time it says it is "uptodate" (when it's not) and doesn't link (use) the new .a

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: "No source file named " problem while debugging
« Reply #11 on: November 28, 2006, 08:46:25 am »
Quote from: kayl
Would it be possible for C::B team to post a message on this thread when Ramazan Kartal's patch will be used in a nightly build

When it has been checked that it works as expected across most platforms.

Quote from: kayl
May I also use this message to ask how you guys deal with dependencies with your static lib ?
My app (.exe) depends on the static lib. The app project is the current one. Each time I build the app when the static lib sources have changed, the .a is generated just fine but the building of the app itself is more than random. Most of the time it says it is "uptodate" (when it's not) and doesn't link (use) the new .a

Nothing is random inside C::B (well, maybe except the $COIN and $RANDOM variables ;)).
To accomplish what you want, go to your executable target's properties, click the "External dependencies" button and add the static lib's filename there.
Be patient!
This bug will be fixed soon...

diazdh

  • Guest
Re: "No source file named " problem while debugging
« Reply #12 on: December 09, 2006, 10:47:28 pm »
Hi everyone,

Thanks for the great work, CB is a really nice and powerful development tool.

The project I'm working on is also affected by the problem that is the subject of this thread (I have already written a follow-up to the bug #008949 at BerliOS with some details about that).

Ramazan Kartal's patch solves this problem using absolute paths to set the breakpoints. However it's possible, in case that it happens to be necessary, to restrict the use of absolute paths to the construction of the gdb search path.

Could you please tell me where is the apropriate place to post the details of that approach? I hope they could be useful for the development process of the debugger plugin or maybe for some other component of Code:Blocks.

Thanks in advance,

Dhionel Diaz


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: "No source file named " problem while debugging
« Reply #13 on: January 10, 2007, 12:55:48 pm »
Ramazan Kartal's patch solves this problem using absolute paths to set the breakpoints. However it's possible, in case that it happens to be necessary, to restrict the use of absolute paths to the construction of the gdb search path.
Please notice this, too: http://forums.codeblocks.org/index.php?topic=4850.msg38322#msg38322
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
"No source file named " problem come back
« Reply #14 on: September 03, 2009, 08:17:18 pm »
today I update the gdb to "6.3 -2"  (from 5.3)

I found the "No source file named" come back if the proejct path include a space char.


>>>>>>cb_gdb:
> break "C:/aa bb/main.cpp:7"               <-- NOTE: there is a space between "aa" and "bb".
No source file named C:/aa bb/main.cpp.
Breakpoint 2 ("C:/aa bb/main.cpp:7) pending.

BUT it I create a project in a "aa_bb", the gdb work fine.
-------------------
c::b 5731
windows xp
gcc 4.2.2
gdb 6.3-2
« Last Edit: September 03, 2009, 08:26:30 pm by nanyu »