Author Topic: Debugger not functioning properly with breakpoints  (Read 3946 times)

Offline Barry_Toner

  • Single posting newcomer
  • *
  • Posts: 2
Debugger not functioning properly with breakpoints
« on: May 27, 2021, 12:59:01 am »
I am running everything x64; OS, debugger, compiler, all that. I've got all y flags set right; -g is on, -s is off. The debugger is able to start just fine, and runs the program if I don't have any breakpoints. However, everything goes downhill after that; whenever I watch a variable, it tells me that it is not available in the current context. This happens even if the break happens just after the variable is assigned a value. On top of that, hitting either "continue" or "next instruction" causes the program to crash. Here is the complete debug log:

-------------------------------------------------------------------------------------------------------------------------------------------
Code
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Users\Andy\Desktop\Codeabby\ArithProg\
Adding source dir: C:\Users\Andy\Desktop\Codeabby\ArithProg\
Adding file: C:\Users\Andy\Desktop\Codeabby\ArithProg\bin\Debug\ArithProg.exe
Changing directory to: C:/Users/Andy/Desktop/Codeabby/ArithProg/.
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:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\PuTTY;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\dotnet;C:\Users\Andy\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Nmap;C:\Users\Andy\AppData\Local\Programs\MiKTeX\miktex\bin\x64;C:\Users\Andy\.dotnet\tools

[debug]Command-line: C:\Program Files\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/Andy/Desktop/Codeabby/ArithProg/bin/Debug/ArithProg.exe
[debug]Working dir : C:\Users\Andy\Desktop\Codeabby\ArithProg

Starting debugger: C:\Program Files\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname -quiet  -args C:/Users/Andy/Desktop/Codeabby/ArithProg/bin/Debug/ArithProg.exe
done

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

Setting breakpoints

[debug]Reading symbols from C:/Users/Andy/Desktop/Codeabby/ArithProg/bin/Debug/ArithProg.exe...done.
[debug](gdb) >>>>>>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/Andy/Desktop/Codeabby/ArithProg/
[debug]Source directories searched: C:/Users/Andy/Desktop/Codeabby/ArithProg;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/Users/Andy/Desktop/Codeabby/ArithProg/main.cpp:33"
[debug]Breakpoint 2 at 0x4014b8: file C:\Users\Andy\Desktop\Codeabby\ArithProg\main.cpp, line 33.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: C:\Users\Andy\Desktop\Codeabby\ArithProg\bin\Debug\ArithProg.exe

Child process PID: 880

[debug][New Thread 880.0x4110]
[debug][New Thread 880.0x41b8]
[debug][New Thread 880.0x40b0]
[debug][New Thread 880.0x402c]
[debug]Thread 1 received signal ?, Unknown signal.
[debug]0x0009df48 in ?? ()
[debug]>>>>>>cb_gdb:

In ?? () ()

[debug]> info locals
[debug]No symbol table info available.
[debug]>>>>>>cb_gdb:
[debug]> info args
[debug]No symbol table info available.
[debug]>>>>>>cb_gdb:
[debug]> bt 30
[debug]#0  0x0009df48 in ?? ()
[debug]#1  0x00000000 in ?? ()
[debug]>>>>>>cb_gdb:
[debug]> whatis a
[debug]No symbol "a" in current context.
[debug]>>>>>>cb_gdb:
[debug]> if 1
disassemble 0x0009df48
info frame
end

[debug] >
[debug] >
[debug]No function contains specified address.
[debug] >>>>>>>cb_gdb:>>>>>>cb_gdb:

Failure finding "Stack level "
Failure matching reg_output

[debug]> nexti
[debug][Thread 880.0x40b0 exited with code 1073741855]
[debug][Thread 880.0x41b8 exited with code 1073741855]
[debug][Inferior 1 (process 880) exited with code 010000000037]
[debug]>>>>>>cb_gdb:

[Inferior 1 (process 880) exited with code 010000000037]

[debug]> quit

Debugger finished with status 0
---------------------------------------------------------------------------------------------------------------

Any help with this issue would be greatly appreciated.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger not functioning properly with breakpoints
« Reply #1 on: May 27, 2021, 08:21:34 am »
Can you show the full build log?
Are you mixing 32 bit gdb and 64 bit program or vice-versa?
(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 Barry_Toner

  • Single posting newcomer
  • *
  • Posts: 2
Re: Debugger not functioning properly with breakpoints
« Reply #2 on: May 29, 2021, 05:25:43 am »
No; the compiler, debugger, and Code::Blocks itself are all 64 bit. Here's the build log, but I'm not sure whether it's the full one. I couldn't find any "full build log" option.

Code
-------------- Build: Debug in ArithProg (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -fexceptions -Wall -g -Wall -g  -c C:\Users\Andy\Desktop\Codeabby\ArithProg\main.cpp -o obj\Debug\main.o
g++.exe  -o bin\Debug\ArithProg.exe obj\Debug\main.o   
Output file is bin\Debug\ArithProg.exe with size 64.87 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))