News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Unable to debug in codeblocks

Started by vopler930, April 21, 2020, 12:31:02 AM

Previous topic - Next topic

vopler930

Well guys, I am unable to debug my projects in codeblocks for some reason... I was using the code blocks 20.03 portable and now I installed the code blocks, tried again and nothing happened.

I can't use the "next line", because it returns this: "Cannot find bounds of current function".

The Full DEBUG LOG

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\randomuser\Desktop\project\bbb\
Adding source dir: C:\Users\randomuser\Desktop\project\bbb\
Adding file: C:\Users\randomuser\Desktop\project\bbb\bin\Debug\bbb.exe
Changing directory to: C:/Users/randomuser/Desktop/project/bbb/.
Set variable: PATH=.;C:\MinGW\bin;C:\MinGW;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\randomuser\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\randomuser\AppData\Local\Programs\Python\Python38-32;C:\Users\randomuser\AppData\Local\Microsoft\WindowsApps;C:\Users\randomuser\AppData\Local\Programs\Microsoft VS Code\bin

[debug]Command-line: C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/randomuser/Desktop/project/bbb/bin/Debug/bbb.exe
[debug]Working dir : C:\Users\randomuser\Desktop\project\bbb

Starting debugger: C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/randomuser/Desktop/project/bbb/bin/Debug/bbb.exe
done

[debug]Reading symbols from C:/Users/randomuser/Desktop/project/bbb/bin/Debug/bbb.exe...done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:

Setting breakpoints

[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 8.1
[debug]Copyright (C) 2018 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 "x86_64-w64-mingw32".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 8.1

[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 200
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory C:/Users/randomuser/Desktop/project/bbb/
[debug]Source directories searched: C:/Users/randomuser/Desktop/project/bbb;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/randomuser/Desktop/project/bbb/Untitled1.c:6"
[debug]Breakpoint 2 at 0x40141e: file C:\Users\randomuser\Desktop\project\bbb\Untitled1.c, line 6.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Users\randomuser\Desktop\project\bbb\bin\Debug\bbb.exe

Child process PID: 8912

[debug][New Thread 8912.0x850]
[debug][New Thread 8912.0x1388]
[debug]Thread 1 received signal ?, Unknown signal.
[debug]0x0009e0c8 in ?? ()
[debug]>>>>>>cb_gdb:

In ?? () ()

[debug]> bt 30
[debug]#0  0x0009e0c8 in ?? ()
[debug]#1  0x00000000 in ?? ()
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:

Cannot find bounds of current function

[debug]> next
[debug]Cannot find bounds of current function
[debug]>>>>>>cb_gdb:

Cannot find bounds of current function

oBFusCATed

Do you have debug symbols? Have you tried with another version of gdb? Are all executables either 32bit or 64bit (gdb, codeblocks, your program)?
(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!]

vopler930

Quote from: vopler930 on April 21, 2020, 01:36:42 AM
Quote from: oBFusCATed on April 21, 2020, 01:04:19 AM
Do you have debug symbols? Have you tried with another version of gdb? Are all executables either 32bit or 64bit (gdb, codeblocks, your program)?

Yeah, I have the debug symbols. About the 32bit or 64bit gdb, codeblocks and the program, how can I check if they are at the same configuration? I just installed code blocks and I didn't change nothing as I remember of. You can see the symbols here https://prnt.sc/s2zb29.

Edit:

Hey Dude, I fixed it! I have a path "C:\MinGW\bin" folder,  where the MinGW was installed by me (I didn't even remember to installed it there), so I set the debugger of code blocks to use the "gdb.exe" from the "C:\MinGW\bin\" path and it is working now, when I was using the "gdb.exe" from "C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe" didn't work.

But just because I'm curious, why only the "gdb.exe" from the previously installed MinGW works?
I am sorry for "wasting" your time, I am a beginner at programming, C, IDEs and that stuff, so I basically have no idea of what I am doing in the vast majority of the time.

stahta01

That was the Compiler you used to compile the program! It likely is an 32 bit installation.
While the debugger that failed to work was 64 bit.

Tim S.


C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]