Author Topic: Can't debug in CB  (Read 13719 times)

Offline Shane

  • Single posting newcomer
  • *
  • Posts: 7
Can't debug in CB
« on: December 03, 2008, 08:20:36 pm »
I am trying to debug my app in CB.  I have a custom make, but and build just fine, and I can debug in ddd, or kdbg, but I would like to step through my code in CB.  All it does is starts the debugger, or at least it looks like it, and doesn't hit any or my break points.  Here is the output from the debugger tab.

Adding source dir: /home/user/
Changing directory to: ../Build
Adding file: Test
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 Red Hat Linux (6.5-15.fc6rh)
No symbol table is loaded.  Use the "file" command.
Continuing...
Use the "file" or "exec-file" command.
No symbol table is loaded.  Use the "file" command.
The program is not being run.
Debugger finished with status 0

I can click next line, step out, start, whatever and all it does is stop.  The code does not execute, I know because it is suppose to create a few files.  Any ideas?

Thanks.

Offline mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 587
Re: Can't debug in CB
« Reply #1 on: December 03, 2008, 10:19:55 pm »
Hi Shane,

Code: [Select]
No symbol table is loaded.

Are you sure that your application is compiled with debug information. If you application is compiled with debug information the path of the sources is stored in the debug info (relative of absolute). If you use relative path the working directory of the gdb must be correct. You can also use the gdb command line option --cd=<path> to specify the working directory.

Bye,

Mario

Offline Joerg

  • Multiple posting newcomer
  • *
  • Posts: 100
Re: Can't debug in CB
« Reply #2 on: December 04, 2008, 10:23:33 am »
Quote
You can also use the gdb command line option --cd=<path> to specify the working directory.
Where can I set command line options for gdb in C::B ?
It's never too late to fail!

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Can't debug in CB
« Reply #3 on: December 04, 2008, 10:58:17 am »
The code does not execute, I know because it is suppose to create a few files.  Any ideas?

You can switch on the debuggers debug-log and see waht is really sent to gdb: Check "Settings -> Compiler and Debugger... -> Debugger settings -> Display debugger's debug log"

Offline Shane

  • Single posting newcomer
  • *
  • Posts: 7
Re: Can't debug in CB
« Reply #4 on: December 04, 2008, 11:17:14 pm »
Yeah looks like I am not pointing it to the correct directory with my debugging symbols.  Where do I place the --cd<path> option at inside CB?

Thanks.

Offline Shane

  • Single posting newcomer
  • *
  • Posts: 7
Re: Can't debug in CB
« Reply #5 on: December 09, 2008, 05:38:02 pm »
I still don't know ho to point C::B to my debug directory with the debug symbols.  Can anyone help me out on that?  Where do I place the gdb command line option at?  I've tried a number of places and it is still using my currect directory where the project file is as the base directory.

Offline Shane

  • Single posting newcomer
  • *
  • Posts: 7
Re: Can't debug in CB
« Reply #6 on: December 09, 2008, 08:18:43 pm »
Got it.  To specify the symbol file you want loaded you have to use a GDB command and not the program argument.  Example:

file /home/user/Debug/bin/File_I_am_debugging

I could not find a why to pass an argument to GDB within CB only GDB commands.

Thanks.

Offline Joerg

  • Multiple posting newcomer
  • *
  • Posts: 100
Re: Can't debug in CB
« Reply #7 on: December 10, 2008, 10:25:49 am »
Quote
Got it.  To specify the symbol file you want loaded you have to use a GDB command and not the program argument.  Example:
file /home/user/Debug/bin/File_I_am_debugging
thats interesting,
AFAIK C::B passes to GDB the file specified under
Project/Properties/Build targets/ Output filename ?
It's never too late to fail!

Offline Shane

  • Single posting newcomer
  • *
  • Posts: 7
Re: Can't debug in CB
« Reply #8 on: January 20, 2009, 07:46:01 pm »
My bad, it works, I was debugging a library without debugging symbols.

Thanks for your help.

Offline Miro1701

  • Single posting newcomer
  • *
  • Posts: 3
Re: Can't debug in CB
« Reply #9 on: February 13, 2010, 06:12:32 pm »
Hi.

I have same problem.  I use two projects Dynamic Library and Console Application. I have compiled them with "Produce Debugging Symbol".
I need debugger because i had segmentation fault and i can't find error without debugger.

Code: [Select]
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: /home/miroslav/Development/Games/Examples/
Adding source dir: /home/miroslav/Development/Games/Examples/
Adding file: bin/Debug/Examples
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 (GDB) 7.0-ubuntu
Continuing...
The program is not being run.
Debugger finished with status 0

Thanks
« Last Edit: February 13, 2010, 06:25:55 pm by Miro1701 »

Offline Miro1701

  • Single posting newcomer
  • *
  • Posts: 3
Re: Can't debug in CB
« Reply #10 on: February 13, 2010, 07:15:29 pm »
I do it, but why debuger use Debug build target, i was using my Debug c++0x target