- Lisensi Publik Umum GNU
- Richard Stallman
- Pengawakutu
- Safari (peramban web)
- Red Hat
- Perangkat lunak bebas
- Timbunan inti
- Xcode
- Android (sistem operasi)
- PyQt
- GNU Debugger
- Data Display Debugger
- Debugger
- GNU Binutils
- List of debuggers
- Gdbserver
- MinGW
- List of GNU packages
- GNU toolchain
- Richard Stallman
GNU Debugger GudangMovies21 Rebahinxxi LK21
The GNU Debugger (GDB) is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, Assembly, C, C++, D, Fortran, Haskell, Go, Objective-C, OpenCL C, Modula-2, Pascal, Rust, and partially others.
History
GDB was first written by Richard Stallman in 1986 as part of his GNU system, after his GNU Emacs was "reasonably stable". GDB is free software released under the GNU General Public License (GPL). It was modeled after the DBX debugger, which came with Berkeley Unix distributions.
From 1990 to 1993 it was maintained by John Gilmore. Now it is maintained by the GDB Steering Committee which is appointed by the Free Software Foundation.
Technical details
= Features
=GDB offers extensive facilities for tracing and altering the execution of computer programs. The user can monitor and modify the values of programs' internal variables, and even call functions independently of the program's normal behavior.
GDB target processors (as of 2003) include: Alpha, ARM, AVR, H8/300, Altera Nios/Nios II, System/370, System 390, x86 and its 64-bit extension x86-64, IA-64 "Itanium", Motorola 68000, MIPS, PA-RISC, PowerPC, RISC-V, SuperH, SPARC, and VAX. Lesser-known target processors supported in the standard release have included A29K, ARC, ETRAX CRIS, D10V, D30V, FR-30, FR-V, Intel i960, 68HC11, Motorola 88000, MCORE, MN10200, MN10300, NS32K, Stormy16, and Z8000. (Newer releases will likely not support some of these.) GDB has compiled-in simulators for even lesser-known target processors such like M32R or V850.
GDB is still actively being developed. As of version 7.0 new features include support for Python scripting and as of version 7.8 GNU Guile scripting as well. Since version 7.0, support for "reversible debugging" — allowing a debugging session to step backward, much like rewinding a crashed program to see what happened — is available.
= Remote debugging
=GDB offers a "remote" mode often used when debugging embedded systems. Remote operation is when GDB runs on one machine and the program being debugged runs on another. GDB can communicate to the remote "stub" that understands GDB protocol through a serial device or TCP/IP. A stub program can be created by linking to the appropriate stub files provided with GDB, which implement the target side of the communication protocol. Alternatively, gdbserver can be used to remotely debug the program without needing to change it in any way.
The same mode is also used by KGDB for debugging a running Linux kernel on the source level with gdb. With KGDB, kernel developers can debug a kernel in much the same way as they debug application programs. It makes it possible to place breakpoints in kernel code, step through the code, and observe variables. On architectures where hardware debugging registers are available, watchpoints can be set which trigger breakpoints when specified memory addresses are executed or accessed. KGDB requires an additional machine which is connected to the machine to be debugged using a serial cable or Ethernet. On FreeBSD, it is also possible to debug using FireWire direct memory access (DMA).
= Graphical user interface
=The debugger does not contain its own graphical user interface, and defaults to a command-line interface, although it does contain a text user interface. Several front-ends have been built for it, such as UltraGDB, Xxgdb, Data Display Debugger (DDD), Nemiver, KDbg, the Xcode debugger, GDBtk/Insight, Gede [1], Seer [2], and HP Wildebeest Debugger GUI (WDB GUI). IDEs such as Codelite, Code::Blocks, Dev-C++, Geany, GNAT Programming Studio (GPS), KDevelop, Qt Creator, Lazarus, MonoDevelop, Eclipse, NetBeans, and Visual Studio can interface with GDB. GNU Emacs has a "GUD mode" and tools for Vim exist (e.g. clewn). These offer facilities similar to debuggers found in IDEs.
Some other debugging tools have been designed to work with GDB, such as memory leak detectors.
= Internals
=GDB uses a system call named ptrace (the name is an abbreviation of "process trace") to observe and control the execution of another process, and examine and change the process' memory and registers.
A breakpoint is implemented by replacing an instruction at a given memory address with another special instruction. Executing breakpoint instruction causes SIGTRAP.
Examples of commands
An example session
Consider the following source-code written in C:
Using the GCC compiler on Linux, the code above must be compiled using the -g flag in order to include appropriate debug information on the binary generated, thus making it possible to inspect it using GDB. Assuming that the file containing the code above is named example.c, the command for the compilation could be:
And the binary can now be run:
Since the example code, when executed, generates a segmentation fault, GDB can be used to inspect the problem.
The problem is present in line 7, and occurs when calling the function strlen (because its argument, s, is NULL).
Depending on the implementation of strlen (inline or not), the output can be different, e.g.:
To fix the problem, the variable a (in the function main) must contain a valid string. Here is a fixed version of the code:
Recompiling and running the executable again inside GDB now gives a correct result:
GDB prints the output of printf in the screen, and then informs the user that the program exited normally.
See also
Binary File Descriptor library (libbfd)
dbx
DDD, a GUI for GDB and other debuggers
gdbserver
LLDB
References
External links
Official website
UltraGDB: Visual C/C++ Debugging with GDB on Windows and Linux Archived 2017-12-12 at the Wayback Machine
KGDB: Linux Kernel Source Level Debugger
The website for "MyGDB: GDB Frontend" in the Korean language
A Visual Studio plugin for debugging with GDB
Comparison of GDB front-ends, 2013
Using Eclipse as a Front-End to the GDB Debugger
= Documentation
=Richard M. Stallman, Roland Pesch, Stan Shebs, et al., Debugging with GDB (Free Software Foundation, 2011) ISBN 978-0-9831592-3-0
GDB Internals
= Tutorials
=RMS's gdb Tutorial (Ryan Michael Schmidt, not Richard Matthew Stallman)
GDB Tutorial
Kata Kunci Pencarian:
![GNU Debugger Tutorial [GDB walkthrough] | CYBERPUNK](https://res.cloudinary.com/dyadcr1f1/image/fetch/f_auto,q_auto/https%3A%2F%2Fcdn.cyberpunk.rs%2Fwp-content%2Fuploads%2F2020%2F01%2Fgnu-debugger-tutorial-updated.jpg)
GNU Debugger Tutorial [GDB walkthrough] | CYBERPUNK

GNU Debugger or GDB: A Powerful Source Code Debugging tool for Linux ...

An Introduction to GDB GNU Debugger - YouTube
![GNU Debugger Tutorial [GDB walkthrough] | CYBERPUNK](https://res.cloudinary.com/dyadcr1f1/image/fetch/f_auto,q_auto/https%3A%2F%2Fcdn.cyberpunk.rs%2Fwp-content%2Fuploads%2F2020%2F01%2Fthe_gnu_debugger_tutorial_bg.jpg)
GNU Debugger Tutorial [GDB walkthrough] | CYBERPUNK

Get Started with our GNU Debugger Tutorial | Red Hat Developer

A hands-on tutorial for using the GNU Project Debugger | Opensource.com

How to Install GNU Debugger GDB on Linux Mint 21 – Linux Consultant

Using Gnu Debugger (GDB) | xpressrazor

CSCI 2021 Quick Guide to gdb: The GNU Debugger

Getting Started With GNU Debugger on Linux: A Crash Course

Overview of GDB ( GNU Debugger ) | Debugging A C Program | Live Demo ...

A hands-on tutorial for using the GNU Project Debugger | Opensource.com