Author Topic: GDB debugger not starting at all  (Read 2110 times)

gilgameshean

  • Guest
GDB debugger not starting at all
« on: May 01, 2023, 03:48:18 pm »
Hello, I'm trying to debug an application and I've set a breakpoint, but whenever I try to debug it a pop-up window opens up and says "detected that the terminal has been closed, do you wanna stop the debugging session?". I'm running codeblocks on Ubuntu 22.04.

Things I've tried are making sure the -g flag is set and the -s flag is set off, making sure the path doesn't have spaces, making sure the debugger is set to gdb default and rebooting. I've googled for hours and I can't find a similar issue - it seems it can't find any files in /dev but I'm not sure what this means as I'm very new to Linux and codeblocks.

Here are the console logs:
Code
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/
Adding source dir: /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/
Adding file: /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/bin/Debug/leetcode-practice
Changing directory to: /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/.
Set variable: LD_LIBRARY_PATH=.:

[debug]Command-line: /usr/bin/gdb -nx -fullname -quiet  -args /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/bin/Debug/leetcode-practice
[debug]Working dir : /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice

Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/bin/Debug/leetcode-practice
Setting SHELL to '/bin/sh'
done

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

Setting breakpoints

[debug]Reading symbols from /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/bin/Debug/leetcode-practice...
[debug]Using terminal's PID as console PID 10083, TTY /dev/?
[debug]Queued:[tty /dev/?]
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
[debug]Copyright (C) 2022 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.
[debug]Type "show copying" and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<https://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 (Ubuntu 12.1-0ubuntu1~22.04) 12.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 disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/
[debug]Source directories searched: /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/?
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]/dev/?: No such file or directory.
[debug]During startup program exited with code 1.
[debug]Starting program: /home/gilgamesh/cPlusPlus/cppPractice/leetcode-practice/bin/Debug/leetcode-practice
[debug]>>>>>>cb_gdb:

During startup program exited with code 1.

[debug]> quit

Debugger finished with status 0

Any ideas at all?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: GDB debugger not starting at all
« Reply #1 on: May 08, 2023, 10:52:07 pm »
Can you run the program from codeblocks?
What is your setting in Settings->Environment->Terminal to launch console program?