Author Topic: [SOLVED]Help using debugger  (Read 41068 times)

Offline Quagmire

  • Single posting newcomer
  • *
  • Posts: 3
[SOLVED]Help using debugger
« on: December 04, 2012, 11:03:35 pm »
Hello

I am a newbie in Code Blocks (and programming), and I really like it and would like to use it as much as I can. The only problem is I can't run the debugger
in the latest build. I don't seem to have any problems with this with version 10.05 (I was using this, because of the college).

In short, I want to execute code line by line and to watch the variables. I read the manual maybe about a thousand times, I searched for almost a week,
and I still cannot do this. Can someone please explain me how to do it?

I compile the project with -g and -Wall, add some breakpoints and press the debugger start button. And then, the debugger just exits with this message:

Starting the debuggee failed: No symbol table loaded.  Use the "file" command.

[debug]> quit

Debugger finished with status 0


I know that I'm doing something wrong here. Please help me see it :)

Boris
« Last Edit: December 05, 2012, 02:37:01 pm by Quagmire »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Help using debugger
« Reply #1 on: December 05, 2012, 07:59:19 am »
Enable full log for the compiler and verify that you're correctly using -g and there no -s options in the 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 Quagmire

  • Single posting newcomer
  • *
  • Posts: 3
Re: Help using debugger
« Reply #2 on: December 05, 2012, 09:27:10 am »
This is the build log:

-------------- Clean: Debug in newpr (compiler: GNU GCC Compiler)---------------

Cleaned "newpr - Debug"

-------------- Build: Debug in newpr (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall  -g  -Wall -g    -c "C:\Users\Stewie\Desktop\c primer\newpr\main.c" -o obj\Debug\main.o
mingw32-g++.exe  -o bin\Debug\newpr.exe obj\Debug\main.o   
Output size is 82.55 KB
Process terminated with status 0 (0 minutes, 3 seconds)
0 errors, 0 warnings (0 minutes, 3 seconds)


And this is the debugger:

[debug]Command-line: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Stewie/Desktop/CPRIME~1/newpr/bin/Debug/newpr.exe
[debug]Working dir : C:\Users\Stewie\Desktop\CPRIME~1\newpr

Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/Users/Stewie/Desktop/CPRIME~1/newpr/bin/Debug/newpr.exe
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]"C:/Users/Stewie/Desktop/CPRIME~1/newpr/bin/Debug/newpr.exe": not in executable format: File format not recognized
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb 6.8
[debug]Copyright (C) 2008 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-pc-mingw32".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb 6.8

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]>>>>>>cb_gdb:
[debug]> source C:\Users\Stewie\Desktop\CB_20121123_rev8598_win32(1)\CB_20121123_rev8598_win32(2)\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]Function "__cxa_throw" not defined in loaded symbols.
[debug]>>>>>>cb_gdb:
[debug]> -g
[debug]Undefined command: "-g".  Try "help".
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Users/Stewie/Desktop/CPRIME~1/newpr/
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Stewie/Desktop/c primer/newpr/main.c:6"
[debug]No source file named C:/Users/Stewie/Desktop/c primer/newpr/main.c in loaded symbols.
[debug]Breakpoint 1 ("C:/Users/Stewie/Desktop/c primer/newpr/main.c:6) pending.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Stewie/Desktop/c primer/newpr/main.c:7"
[debug]No source file named C:/Users/Stewie/Desktop/c primer/newpr/main.c in loaded symbols.
[debug]Breakpoint 2 ("C:/Users/Stewie/Desktop/c primer/newpr/main.c:7) pending.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Stewie/Desktop/c primer/newpr/main.c:8"
[debug]No source file named C:/Users/Stewie/Desktop/c primer/newpr/main.c in loaded symbols.
[debug]Breakpoint 3 ("C:/Users/Stewie/Desktop/c primer/newpr/main.c:8) pending.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Stewie/Desktop/c primer/newpr/main.c:9"
[debug]No source file named C:/Users/Stewie/Desktop/c primer/newpr/main.c in loaded symbols.
[debug]Breakpoint 4 ("C:/Users/Stewie/Desktop/c primer/newpr/main.c:9) pending.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Stewie/Desktop/c primer/newpr/main.c:10"
[debug]No source file named C:/Users/Stewie/Desktop/c primer/newpr/main.c in loaded symbols.
[debug]Breakpoint 5 ("C:/Users/Stewie/Desktop/c primer/newpr/main.c:10) pending.
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Stewie/Desktop/c primer/newpr/main.c:11"
[debug]No source file named C:/Users/Stewie/Desktop/c primer/newpr/main.c in loaded symbols.
[debug]Breakpoint 6 ("C:/Users/Stewie/Desktop/c primer/newpr/main.c:11) pending.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]No executable specified, use `target exec'.
[debug]>>>>>>cb_gdb:

Starting the debuggee failed: No executable specified, use `target exec'.

[debug]> quit

Debugger finished with status 0


These are the logs. I am really lost here, so any help would be greatly appreciated.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Help using debugger
« Reply #3 on: December 05, 2012, 09:38:02 am »
Try it in a path without spaces (and special characters).
You should also thinkabout updating your compiler suite, as gdb 6.8 is quiet old.

Offline Quagmire

  • Single posting newcomer
  • *
  • Posts: 3
Re: Help using debugger
« Reply #4 on: December 05, 2012, 02:36:23 pm »
Try it in a path without spaces (and special characters).
You should also thinkabout updating your compiler suite, as gdb 6.8 is quiet old.

That did the trick. Everything is working fine now.

Thanks a lot!

markons

  • Guest
Re: [SOLVED]Help using debugger
« Reply #5 on: December 10, 2012, 06:43:35 pm »
Hi, I have a similar problem, I use C::B 12.11 and the standard GCC compiler when I debug and when I open the debug-> debugging windows -> Watches, in the Watches window i dont have anything, there's no local variables and function arguments, nothing, only a blank window... i set a breakpoint and evrithing... Funny thing is when I do the same thing in C::B 10.05 i have normal Watches window with local variables and function arguments and everything works fine...
Can someone help me pls ???

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: [SOLVED]Help using debugger
« Reply #6 on: December 10, 2012, 08:19:08 pm »
Can someone help me pls ???
Have you read the change log? Forum search? You're probably the 100+th person to ask this question.

http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#In_12.11_or_latest_nightly_builds
« Last Edit: December 10, 2012, 08:21:26 pm by oBFusCATed »
(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 joneewheelock

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: [SOLVED]Help using debugger
« Reply #7 on: January 26, 2018, 06:17:41 am »
Which path we need to take care of space? I am getting same issue (CB 16.01)

-g is used for compiling. Optimization is disabled and I am using C++11.

Active debugger config: GDB/CDB debugger:mingwDBG
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Temp\collegeProject\
Adding source dir: C:\Temp\collegeProject\
Adding file: C:\Temp\collegeProject\Debug\collegeProject.exe
Changing directory to: C:/Temp/collegeProject/.
Set variable: PATH=.;C:\TDM-GCC-64\bin;C:\TDM-GCC-64;C:\Program Files\Java\jdk1.8.0_77\bin;C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\Intel\iCLS Client;c:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\wamp\www;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP;C:\Program Files (x86)\OpenSSH\bin;C:\Users\Mahesha\AppData\Local\Microsoft\WindowsApps
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet  -args C:/Temp/collegeProject/Debug/collegeProject.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.6.1
Starting the debuggee failed: No executable specified, use `target exec'.
Debugger finished with status 0

« Last Edit: January 26, 2018, 06:19:48 am by joneewheelock »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: [SOLVED]Help using debugger
« Reply #8 on: January 26, 2018, 08:17:01 am »
Which path we need to take care of space? I am getting same issue (CB 16.01)
I don't think you're getting any of the two issues reported in the topic.
It is something else, but we need bigger log.
Please enable full debugger log and post it here.
Please use code tags (the # button).
(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 stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: [SOLVED]Help using debugger
« Reply #9 on: January 26, 2018, 10:35:37 am »
Bad compiler toolchain installation is my guess.

Code
Set variable: PATH=.;C:\TDM-GCC-64\bin;C:\TDM-GCC-64;C:\Program Files\Java\jdk1.8.0_77\bin;C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\Intel\iCLS Client;c:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\wamp\www;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP;C:\Program Files (x86)\OpenSSH\bin;C:\Users\Mahesha\AppData\Local\Microsoft\WindowsApps
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet  -args C:/Temp/collegeProject/Debug/collegeProject.exe
done

He is using C:\MinGW\bin\gdb.exe as the debugger; but, compiling likely with C:\TDM-GCC-64 as the toolchain.

Tim S.
« Last Edit: January 26, 2018, 10:48:22 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline joneewheelock

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: [SOLVED]Help using debugger
« Reply #10 on: March 28, 2018, 02:40:55 am »
@stahta01: Sorry, I could not look into this afterwards. Yes That fixed the problem. It was mainly because I was using MinGW and TDM both and in some place path was not getting updated. Also upgraded to CB 17.12. Actually auto detect feature has some issues and I have to do this manually. If that problem is fixed, I guess such mismatch may not occur.

Suppose if you have both tool chains installed and switch between them, typing the base folder name of the toolchain and clicking auto detect will not change and existing tool chain will be selected by default. What I have to do is rename one of the toolchain folder and select the other path and then click on auto detect.
« Last Edit: March 28, 2018, 02:47:48 am by joneewheelock »