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
🌐
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 · Follow below mentioned steps to compile GDB from scratch and install it.
🌐
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 ...
Find elsewhere
🌐
Linux Hint
linuxhint.com › install-gnu-debugger-gdb-linux-mint
How to Install GNU Debugger GDB on Linux Mint 21 – Linux Hint
Open the software manager, search for the GDB using the search bar, and hit the accurate output from the several results: Click on the Install button to let it install on Linux Mint 21 system:
🌐
GitHub
github.com › Marslanali › gdb-linux
GitHub - Marslanali/gdb-linux: Debug C program using gdb
cd gdb-7.11 ./configure make make install sudo make install (optional)
Author   Marslanali
🌐
Ubuntu
documentation.ubuntu.com › snapcraft › stable › how-to › debugging › debug-with-gdb
Debug with GDB - Snapcraft 8.13.2 documentation
Most snaps don’t ship with apps that include debug symbols. While GDB can be used without debug symbols, debugging is more difficult because function names, variable names, and source code won’t be available. To use GDB effectively, you need to build and install the snap locally with debug symbols enabled.
🌐
CSE CGI Server
cgi.cse.unsw.edu.au › ~learn › debugging › modules › gdb_setup
GDB - Basic Setup — Debugging documentation
GDB should be already installed on the CSE systems. If it is not installed on your linux distribution, run the following commands:
🌐
Linux From Scratch
linuxfromscratch.org › blfs › view › 12.0 › general › gdb.html
GDB-13.2
If you have built the API documentation, it is now in gdb/doc/doxy. You can install it (as the root user):
🌐
Toradex Community
community.toradex.com › technical support
How can I install gdb again? - Technical Support - Toradex Community
January 10, 2019 - After upgrading my iMX6 my gdb went lost. Please can someone tell me, how I kann get it back ? Best regards
🌐
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.
🌐
Interrupt
interrupt.memfault.com › blog › installing-gdb
Tools we use: installing GDB for ARM | Interrupt
August 3, 2022 - # select a specific SHA, to strictly ...D=noninteractive # install GDB + GCC for ARM RUN apt-get update && apt-get install -y --no-install-recommends \ gcc-arm-none-eabi \ gdb-multiarch ... running Docker images on Mac or Windows is ...
🌐
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
🌐
Linux From Scratch
linuxfromscratch.org › blfs › view › svn › general › gdb.html
GDB-16.3
If you have built the API documentation, it is now in gdb/doc/doxy. You can install it (as the root user): install -d /usr/share/doc/gdb-16.3 && rm -rf gdb/doc/doxy/xml && cp -Rv gdb/doc/doxy /usr/share/doc/gdb-16.3
🌐
Linux Man Pages
man7.org › linux › man-pages › man1 › gdb.1.html
gdb(1) - Linux manual page
The full documentation for GDB is maintained as a Texinfo manual. If the "info" and "gdb" programs and GDB's Texinfo documentation are properly installed at your site, the command info gdb should give you access to the complete manual. Using GDB: A Guide to the GNU Source-Level Debugger, Richard M.
🌐
iO Flood
ioflood.com › blog › install-gdb-command-linux
Linux GDB Command Installation: A Step-by-Step Guide
January 2, 2024 - In this guide, we will walk you through the process of installing and using the GDB command in Linux. We will provide you with installation instructions for both APT and YUM-based distributions, delve into compiling GDB from the source, and installing a specific version.
🌐
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.
🌐
University of Bristol
acrc.bris.ac.uk › acrc › RedHat › rhel-gdb-en-4 › installing-gdb.html
Installing gdb
In particular, if you run the first ... configuration of bfd, readline, and other sibling directories of the gdb subdirectory. This leads to build errors about missing include files such as bfd/bfd.h. You can install gdb anywhere; it has no hardwired paths....