It just hangs like in an infinite loop. Any suggestions?

You don't know whether it's waiting for something or is actually in infinite loop.

Your first steps should be:

  1. Run top and see whether GDB process is consuming CPU or is increasing in memory and
  2. Run strace gdb to see which (if any) system calls it is performing.

With that info, further guesses could be made. It may also help to know which system you are on, and which version of GDB you have installed.

Update:

Running strace gdb results in a infinite loop outputting: readlink(“/usr/bin/python”, “python”, 4096) = 6

So you have /usr/bin/python which is a symlink to itself.

Yes, that would cause all kinds of problems (including not being able to actually run python from command line).

Remove that symlink (/usr/bin/python is supposed to point to python2 or python3).

Answer from Employed Russian on Stack Overflow

It just hangs like in an infinite loop. Any suggestions?

You don't know whether it's waiting for something or is actually in infinite loop.

Your first steps should be:

  1. Run top and see whether GDB process is consuming CPU or is increasing in memory and
  2. Run strace gdb to see which (if any) system calls it is performing.

With that info, further guesses could be made. It may also help to know which system you are on, and which version of GDB you have installed.

Update:

Running strace gdb results in a infinite loop outputting: readlink(“/usr/bin/python”, “python”, 4096) = 6

So you have /usr/bin/python which is a symlink to itself.

Yes, that would cause all kinds of problems (including not being able to actually run python from command line).

Remove that symlink (/usr/bin/python is supposed to point to python2 or python3).

Answer from Employed Russian on Stack Overflow
🌐
LinuxQuestions.org
linuxquestions.org › questions › linux-newbie-8 › install-gdb-in-linux-904831
install gdb in Linux
September 24, 2011 - Hi, I need gdb but when I run gdb command I get the following error: bash: gdb: command not found Could you please tell me what should I do to fix
Discussions

Does installing GDB on a mac usually take a while? or is it only me?
If I recall, the Mac even lies to you. If you type GCC, it installs CLang and then aliases it to gcc, after forcing you to agree to some ridiculous terms. More on reddit.com
🌐 r/C_Programming
40
12
April 13, 2024
How to properly install gdb on an apple machine

Have you tried macports?

More on reddit.com
🌐 r/macsysadmin
1
1
October 11, 2013
[Question] How can I install GDB? Searching it won’t install and [[BigBoss Recommended Tools]] depends on it (Unc0ver 11.3.1)
What’s [[BigBoss recommended tools]]? More on reddit.com
🌐 r/jailbreak
3
2
April 24, 2018
Installation of GDB on Mac (Mojave)
Have you looked into using lldb? More on reddit.com
🌐 r/C_Programming
19
2
January 10, 2019
🌐
Gdbtutorial
gdbtutorial.com › tutorial › how-install-gdb
How to Install GDB? | GDB Tutorial
Ubuntu, Mint, etc) by following command.$ sudo apt-get update $ sudo apt-get install gdb
🌐
OGG
rpg.hamsterrepublic.com › ohrrpgce › GDB_on_Windows
GDB on Windows
June 18, 2017 - You can get the latest mingw installer here which can in turn install gdb. After installing MinGW, run the "MinGW Installation Manager" (which for me was located in C:\MinGW\libexec\mingw-get\guimain.exe ) and then make sure that the mingw32-gdb bin package is installed.
🌐
GNU Project
sourceware.org › gdb
GDB: The GNU Project Debugger
Version 16.3 of GDB, the GNU Debugger, is now available for download.
Find elsewhere
🌐
UCI ICS
ics.uci.edu › ~pattis › common › handouts › macmingweclipse › allexperimental › mac-gdb-install.html
ICS 46: GDB Installation on Mac OS X
As with GCC, the easiest way to install GDB is through Homebrew. In a Terminal window, run the command brew install gdb, and wait for it to complete.
🌐
Reddit
reddit.com › r/cs2b › how to install gdb (c++ compiler)
r/cs2b on Reddit: How to install GDB (C++ compiler)
February 8, 2025 - sudo apt-get update sudo apt-get install build-essential gdb · Here is the referenced YT video showing the installation: https://youtu.be/oC69vlWofJQ · You can download the latest installer from the MSYS2 page or use this direct link to the ...
🌐
Kali Linux
kali.org › tools › gdb
gdb | Kali Linux Tools
1 day ago - Currently, gdb supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, Go, and Ada. A must-have for any serious programmer. Installed size: 12.87 MB How to install: sudo apt install gdb
🌐
Homebrew
formulae.brew.sh › formula › gdb
gdb — Homebrew Formulae
brew install gdb · GNU debugger · https://www.gnu.org/software/gdb/ License: GPL-3.0-or-later · Formula JSON API: /api/formula/gdb.json · Formula code: gdb.rb on GitHub ·
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 9 › html › user_guide › chap-gdb
Chapter 8. GNU Debugger (GDB) | User Guide | Red Hat Developer Toolset | 9 | Red Hat Documentation
# debuginfo-install glibc Loaded plugins: product-id, refresh-packagekit, subscription-manager --> Running transaction check ---> Package glibc-debuginfo.x86_64 0:2.17-105.el7 will be installed ... Copy to Clipboard Copied! ... Copy to Clipboard Copied! ... This starts the gdb debugger in interactive mode and displays the default prompt, (gdb).
🌐
Hugsy
hugsy.github.io › gef › install
Installation - GEF - GDB Enhanced Features documentation
The repository gef-extras is an open repository where anyone can freely submit their own commands to extend GDB via GEF's API. ... # using the automated way ## via the install script $ bash -c "$(wget https://github.com/hugsy/gef/raw/main/scripts/gef-extras.sh -O -)" # or manually ## clone the repo $ git clone --branch main https://github.com/hugsy/gef-extras.git ## then specify gef to load this directory $ gdb -ex 'gef config gef.extra_plugins_dir "/path/to/gef-extras/scripts"' -ex 'gef save' -ex quit [+] Configuration saved
🌐
YouTube
youtube.com › watch
Install GCC Compiler & GDB Debugger for C/C++ on Windows ...
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
LinuxConfig
linuxconfig.org › home › how to install gdb in rhel 8
Install gdb on RHEL 8: Step-by-Step Guide
September 22, 2025 - Learn to install gdb on RHEL 8 and debug C programs using breakpoints. Get step-by-step guidance on using gdb effectively.
🌐
Anaconda.org
anaconda.org › conda-forge › gdb
Gdb | Anaconda.org
Info: This package contains files in non-standard labels. ... To install this package run one of the following: conda install conda-forge::gdbconda install conda-forge/label/cf201901::gdbconda install conda-forge/label/cf202003::gdbconda install conda-forge/label/testing::gdb
🌐
Gdbgui
gdbgui.com › installation
Installation - gdbgui
Minimal GNU for Windows (MinGW) is the recommended Windows option. Install MinGW with the "MinGW Base System" package. This is the default package which contains make, gcc, and gdb.