IBM developerWorks: Linux software debugging with GDB | Linux Today

IBM developerWorks: Linux software debugging with GDB

Written By
Web Webster
Web Webster
Mar 17, 2001

[ Thanks to Frank for
this link. ]

Most flavours of Linux come with the GNU debugger, or gdb
to the shell. Gdb lets you see the internal structure of a program,
print out variable values, set breakpoints and single step through
source code. It makes an extremely powerful tool for fixing
problems in program code. In this article I’ll try to show how cool
and useful gdb is.

“Before you can get started, the program you want to debug has
to be compiled with debugging information in it. This is so gdb can
work out the variables, lines and functions being used. To do this,
compile your program under gcc (or g++) with an extra ‘-g’
option…”

“Gdb is run from the shell with the command ‘gdb’ with the
program name as a parameter, for example ‘gdb eg’, or you can use
the file command once inside gdb to load a program for debugging,
for example ‘file eg’. Both of these assume you execute the
commands from the same directory as the program. Once loaded, the
program can be started with the gdb command ‘run’.”


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.