Author Topic: GDB : No line xx in file "/path/to/source.c"  (Read 9139 times)

Offline BrianSidebotham

  • Multiple posting newcomer
  • *
  • Posts: 45
GDB : No line xx in file "/path/to/source.c"
« on: July 05, 2012, 01:45:40 pm »
Hi guys,

I'm trying to debug a console project on windows, but I keep getting errors where GDB is ignoring breakpoints and reports the message "no line xx in file "C:\path\to\source.c" "

It is a multi-threaded console app, but I've removed all threads and it still behaves the same! I can successfully set breakpoints in any file under the cpu subdirectory, but not in any of the main files as they all get ignored.

Here's the build log:
Code
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_support_wave.c -o obj\Debug\hal\x86\cpu_support_wave.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_log.c -o obj\Debug\hal\x86\cpu_log.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_keyboard_thread.c -o obj\Debug\hal\x86\cpu_keyboard_thread.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_dac_wave.c -o obj\Debug\hal\x86\cpu_dac_wave.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_adc_wave.c -o obj\Debug\hal\x86\cpu_adc_wave.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_adc_thread.c -o obj\Debug\hal\x86\cpu_adc_thread.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu.c -o obj\Debug\hal\x86\cpu.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\pm_app.c -o obj\Debug\pmr_app.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\main.c -o obj\Debug\main.o
C:\Filter\main.c: In function 'main':
C:\Filter\main.c:47:9: warning: implicit declaration of function 'CPU_adc_sample' [-Wimplicit-function-declaration]
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_timer_thread.c -o obj\Debug\hal\x86\cpu_timer_thread.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_timer.c -o obj\Debug\hal\x86\cpu_timer.o
gcc.exe -Wall  -g    -I.\  -c C:\Filter\eam.c -o obj\Debug\eam.o
g++.exe  -o bin\Debug\cpuc.exe obj\Debug\hal\x86\cpu_support_wave.o obj\Debug\hal\x86\cpu_log.o obj\Debug\hal\x86\cpu_keyboard_thread.o obj\Debug\hal\x86\cpu_dac_wave.o obj\Debug\hal\x86\cpu_adc_wave.o obj\Debug\hal\x86\cpu_adc_thread.o obj\Debug\hal\x86\cpu.o obj\Debug\pmr_app.o obj\Debug\main.o obj\Debug\hal\x86\cpu_timer_thread.o obj\Debug\hal\x86\cpu_timer.o obj\Debug\eam.o    ..\..\..\..\mingw\lib\libpthread.a pm\lib\x86\libpm.a
Output size is 118.96 KB
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 1 warnings (0 minutes, 2 seconds)

and the GDB debugger messages:
Code
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Filter\
Adding source dir: C:\Filter\
Adding file: C:\Filter\bin\Debug\cpuc.exe
Changing directory to: C:/Filter/.
Starting debugger: C:\Program Files\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Filter/bin/Debug/cpuc.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.7.50.20071127
No line 86 in file "C:\Filter\eam.c".
At C:\Filter\hal\x86\cpu.c:51
Debugger finished with status 0

Yet, of course there IS a line 86 in eam.c. It doesn't seem to be an optimisation problem (i've tried breakpoints all over the code and have optimisation turned off anyway!)

So what am I doing wrong? I'm always convinced it's me that's doing something wrong!

I'm using the latest nightly build SVN8081 on Windows XP. I'm using GDB 7.4 and GCC 4.6.2

Thanks, Brian.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: GDB : No line xx in file "/path/to/source.c"
« Reply #1 on: July 05, 2012, 02:01:05 pm »
Code
Debugger name and version: GNU gdb 6.7.50.20071127

I'm using the latest nightly build SVN8081 on Windows XP. I'm using GDB 7.4 and GCC 4.6.2
There must be something wrong with your setup, because the debug log says that the debugger version is 6.7.50.

Offline BrianSidebotham

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: GDB : No line xx in file "/path/to/source.c"
« Reply #2 on: July 05, 2012, 03:00:46 pm »
Hi Jens,

That's because I tried GDB 6.7.50 too before I reported the problem as that's still the "official" version that's included with the standard CodeBlocks install. The result as you can see is exactly the same. Sorry I should have been clear about that.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB : No line xx in file "/path/to/source.c"
« Reply #3 on: July 05, 2012, 04:00:32 pm »
Does debugging from the command line works?
Have you looked here: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks
What is the full debugger log?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BrianSidebotham

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: GDB : No line xx in file "/path/to/source.c"
« Reply #4 on: July 05, 2012, 04:30:50 pm »
I just read this page: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks nothing exciting on there - can't wait to get back locals and function args as automatic watches though! :D

Anyway, I don't know where this bug came from, or where it went. The only thing I've changed is to Reset Defaults on the GCC compiler which simply switched gcc to mingw-gcc (but it should still be using the same gcc as the directory didn't change).

Now breakpoints work

Build Log:
Code
-------------- Build: Debug in cpuc (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_keyboard_thread.c -o obj\Debug\hal\x86\cpu_keyboard_thread.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_dac_wave.c -o obj\Debug\hal\x86\cpu_dac_wave.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_adc_wave.c -o obj\Debug\hal\x86\cpu_adc_wave.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_adc_thread.c -o obj\Debug\hal\x86\cpu_adc_thread.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\peoplemeter_app.c -o obj\Debug\peoplemeter_app.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu.c -o obj\Debug\hal\x86\cpu.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\main.c -o obj\Debug\main.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_timer_thread.c -o obj\Debug\hal\x86\cpu_timer_thread.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_timer.c -o obj\Debug\hal\x86\cpu_timer.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_support_wave.c -o obj\Debug\hal\x86\cpu_support_wave.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\hal\x86\cpu_log.c -o obj\Debug\hal\x86\cpu_log.o
mingw32-gcc.exe -Wall  -g    -I.\  -c C:\Filter\eam.c -o obj\Debug\eam.o
mingw32-g++.exe  -o bin\Debug\cpuc.exe obj\Debug\hal\x86\cpu_keyboard_thread.o obj\Debug\hal\x86\cpu_dac_wave.o obj\Debug\hal\x86\cpu_adc_wave.o obj\Debug\hal\x86\cpu_adc_thread.o obj\Debug\pm_app.o obj\Debug\hal\x86\cpu.o obj\Debug\main.o obj\Debug\hal\x86\cpu_timer_thread.o obj\Debug\hal\x86\cpu_timer.o obj\Debug\hal\x86\cpu_support_wave.o obj\Debug\hal\x86\cpu_log.o obj\Debug\eam.o    ..\..\..\..\mingw\lib\libpthread.a pm\lib\x86\libpm.a
Output size is 121.63 KB
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 0 warnings (0 minutes, 2 seconds)
Build log saved as:

Debugger output:
Code
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Filter\
Adding source dir: C:\Filter\
Adding file: C:\Filter\bin\Debug\cpuc.exe
Changing directory to: C:/Filter/.
Starting debugger: C:\Vnix\compilers\gcc\mingw\4.6.2\bin\gdb.exe -nx -fullname  -quiet  -args C:/Filter/bin/Debug/cpuc.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.4
Child process PID: 1616
At C:\Filter\eam.c:86
Debugger finished with status 0

So I can't get it to happen anymore! If I manage to get it to happen again I'll report it. Perhaps it's a GDB glitch anyway. It's hard to say.

Brian.
« Last Edit: July 05, 2012, 04:32:30 pm by BrianSidebotham »