Author Topic: Debugger skips breakpoint  (Read 573 times)

Offline 5jm55jm5

  • Single posting newcomer
  • *
  • Posts: 3
Debugger skips breakpoint
« 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:
Debug
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
done

[debug]Reading symbols from C:/f3/usaco17febplat1/bin/Debug/usaco17febplat1.exe...
[debug]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]> set max-value-size unlimited

[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> directory C:/f3/usaco17febplat1/
[debug]Source directories searched: C:/f3/usaco17febplat1;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/f3/usaco17febplat1/main.cpp:84"
[debug]Breakpoint 1 at 0x401881: file C:\f3\usaco17febplat1\main.cpp, line 84.
[debug]>>>>>>cb_gdb:
[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]
[debug]>>>>>>cb_gdb:

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

[debug]> quit

Debugger finished with status 0

Online BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2933
Re: Debugger skips breakpoint
« Reply #1 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: https://github.com/ssbssa/gdb/releases/tag/gdb-10.1.90.20201024, 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?

Offline 5jm55jm5

  • Single posting newcomer
  • *
  • Posts: 3
Re: Debugger skips breakpoint
« Reply #2 on: April 08, 2021, 07:07:43 am »
I downloaded the new version and haven't had a problem since, thanks

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: Debugger skips breakpoint
« Reply #3 on: April 08, 2021, 12:14:41 pm »
Are you using the one from the link?
(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 5jm55jm5

  • Single posting newcomer
  • *
  • Posts: 3
Re: Debugger skips breakpoint
« Reply #4 on: April 08, 2021, 09:32:23 pm »
yes