Code::Blocks Forums

User forums => Help => Topic started by: 5jm55jm5 on February 22, 2021, 06:22:46 am

Title: Debugger skips breakpoint
Post by: 5jm55jm5 on February 22, 2021, 06:22:46 am
When I set a breakpoint in my code the debugger skips over it and ends the program. How do I fix this?

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Adding source dir: C:\f3\usaco17febplat1\
Adding source dir: C:\f3\usaco17febplat1\
Adding file: C:\f3\usaco17febplat1\bin\Debug\usaco17febplat1.exe
Changing directory to: C:/f3/usaco17febplat1/.
Set variable: PATH=.;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\CodeBlocks\MinGW;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python39\Scripts;C:\Python39;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Common Files\Adobe\AGL;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\victo\AppData\Local\Microsoft\WindowsApps;C:\Users\victo\AppData\Local\GitHubDesktop\bin;C:\Users\victo\AppData\Roaming\npm;C:\Program Files\heroku\bin

[debug]Command-line: C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet  -args C:/f3/usaco17febplat1/bin/Debug/usaco17febplat1.exe
[debug]Working dir : C:\f3\usaco17febplat1

Starting debugger: C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet  -args C:/f3/usaco17febplat1/bin/Debug/usaco17febplat1.exe

[debug]Reading symbols from C:/f3/usaco17febplat1/bin/Debug/usaco17febplat1.exe...
[debug]> set prompt >>>>>>cb_gdb:

Setting breakpoints

[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 <>
[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]Find the GDB manual and other documentation resources online at:
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 8.1

[debug]> set width 0
[debug]> set height 0
[debug]> set breakpoint pending on
[debug]> set print asm-demangle on
[debug]> set unwindonsignal on
[debug]> set print elements 200
[debug]> set new-console on
[debug]> set disassembly-flavor att
[debug]> set max-value-size unlimited

[debug]> directory C:/f3/usaco17febplat1/
[debug]Source directories searched: C:/f3/usaco17febplat1;$cdir;$cwd
[debug]> break "C:/f3/usaco17febplat1/main.cpp:84"
[debug]Breakpoint 1 at 0x401881: file C:\f3\usaco17febplat1\main.cpp, line 84.
[debug]> run
[debug]Starting program: C:\f3\usaco17febplat1\bin\Debug\usaco17febplat1.exe

Child process PID: 7044

[debug][New Thread 7044.0x3d74]
[debug][New Thread 7044.0x36c4]
[debug][Thread 7044.0x36c4 exited with code 3]
[debug][Inferior 1 (process 7044) exited with code 03]

[Inferior 1 (process 7044) exited with code 03]

[debug]> quit

Debugger finished with status 0
Title: Re: Debugger skips breakpoint
Post by: BlueHazzard on February 22, 2021, 09:23:24 am
Two reasons i can think of:
1) You have the disassemly window open: The gdb shipped with codeblocks is buggy and crashes, you need a newer version of gdb:, extract it and point the Settings->Debugger->Default->Executable path to the extracted gdb

2) Your code probably crashes/ ends before the breakpoint is reached? Try to set the breakpoint at the beginning of your main

What operating system and version of codeblocks are you using?
Title: Re: Debugger skips breakpoint
Post by: 5jm55jm5 on April 08, 2021, 07:07:43 am
I downloaded the new version and haven't had a problem since, thanks
Title: Re: Debugger skips breakpoint
Post by: oBFusCATed on April 08, 2021, 12:14:41 pm
Are you using the one from the link?
Title: Re: Debugger skips breakpoint
Post by: 5jm55jm5 on April 08, 2021, 09:32:23 pm
Title: Re: Debugger skips breakpoint
Post by: dwaindibbley on May 13, 2021, 06:10:20 am
Fixed my issue as well