# 使用 Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, zypper, scoop 安装 gdb

查看 gdb 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:gdb
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install gdb
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install gdb
```

  证据: MacPorts ports tree: devel/gdb/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add gdb
```

  证据: Alpine Linux edge package indexes: gdb from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install gdb
```

  证据: Debian stable package indexes: gdb from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install gdb
```

  证据: Fedora Rawhide package metadata: gdb from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#gdb
```

  证据: nixpkgs package indexes: pkgs/by-name/gd/gdb/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S gdb
```

  证据: Arch Linux sync databases: gdb from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install gdb
```

  证据: openSUSE Tumbleweed package metadata: gdb from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/gdb
```

  证据: Scoop official bucket manifest trees: bucket/gdb.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:gdb
- **软件包管理器:** Homebrew
- **版本:** 17.2
- **来源摘要:** GNU debugger
- **主页:** <https://www.gnu.org/software/gdb/>
- **最后更新:** 2026-05-10T20:39:26Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- gcore (别名)
- gdb (别名)
- gdb-add-index (别名)
- gdbserver (别名)
- gstack (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 17.2
## 项目历史与用法

GDB is the GNU Project's source-level debugger, used from the command line to run programs under observation, stop them at controlled points, inspect state, and experiment with program execution.

### 项目历史

The current GDB manual credits Richard Stallman as the original author and describes many later contributors. Its copyright history begins in 1988, placing GDB among the early core GNU development tools.

The manual's contributor history records early releases through 2.8 under Richard Stallman and assistants, later 3.x and 4.x release stewards, and major commercial and community contributions for CPU targets, object formats, remote debugging, gdbserver, the machine interface, and language support.

GDB is maintained in Sourceware's binutils-gdb repository, reflecting its close development relationship with GNU Binutils and the broader GNU toolchain.

### 采用历史

GDB became the default debugger in many Unix-like development environments because it paired a scriptable CLI with broad compiler, architecture, object-file, and language support.

The manual records Cygnus Solutions sponsoring GDB maintenance and much development since 1991, an important phase in professionalizing GNU toolchain support for commercial cross-development and embedded targets.

### 使用方式

The manual describes GDB as useful for starting a program, stopping it on specified conditions, examining what happened after it stopped, and changing program state to continue debugging.

GDB supports many languages, including C, C++, D, Go, Objective-C, Fortran, OpenCL C, Pascal, Rust, assembly, Modula-2, and Ada. It also includes remote debugging, gdbserver, TUI, GDB/MI, Python and Guile extension APIs, and Debugger Adapter Protocol support.

### 为什么软件包爱好者会关心

GDB is a canonical package-manager debugging tool: small at the command line, but deeply tied to compiler output, debug symbols, libc behavior, architecture support, Python scripting, and remote target workflows.

Its initialization-file search path is platform-sensitive, with XDG-style paths on non-macOS Unix systems and Library/Preferences paths on macOS, which makes packaging and documentation details visible to users.

### 时间线

- 1988: The GDB manual copyright history begins.
- 1991: Cygnus Solutions begins sponsoring GDB maintenance and much of its development.
- 2025: GDB 17.1 is released according to the official news page.
- 2026: GDB 17.2 is released according to the official news page.

### Related projects

- GDB is developed with GNU Binutils in the binutils-gdb repository and relies on BFD for multiple object-file formats.
- Related tools and interfaces include gdbserver, Readline, GDB/MI, the Debugger Adapter Protocol, and frontends such as gdbgui.

### 来源

- <https://sourceware.org/gdb/current/onlinedocs/gdb.html>
- <https://sourceware.org/gdb/current/onlinedocs/gdb.html/Contributors.html>
- <https://sourceware.org/gdb/current/onlinedocs/gdb.html/Initialization-Files.html>
- <https://sourceware.org/gdb/current/onlinedocs/gdb.html/Summary.html>
- <https://sourceware.org/gdb/current/onlinedocs/gdb.html/Supported-Languages.html>
- <https://sourceware.org/gdb/news/>
- <https://sourceware.org/git/?p=binutils-gdb.git>


## 安全说明

doc example: debugger and process inspection tool.

- **Geiger 风险:** red / 高
- doc example: debugger and process inspection tool


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- macOS: ~/Library/Preferences/gdb/gdbearlyinit, ~/.gdbearlyinit, ~/Library/Preferences/gdb/gdbinit, ~/.gdbinit, ./.gdbinit
- Unix: $XDG_CONFIG_HOME/gdb/gdbearlyinit, ~/.config/gdb/gdbearlyinit, ~/.gdbearlyinit, $XDG_CONFIG_HOME/gdb/gdbinit, ~/.config/gdb/gdbinit, ~/.gdbinit, ./.gdbinit
## 其他软件包管理器记录

- Debian apt - gdb - 16.3-1: normalized package name match | Debian stable package indexes: gdb from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNU Debugger | https://www.gnu.org/s/gdb/
- Debian apt - gdb-minimal - 16.3-1: normalized package name match | Debian stable package indexes: gdb-minimal from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNU Debugger (minimal version - dummy transitional package) | https://www.gnu.org/s/gdb/
- Debian apt - gdb-multiarch - 16.3-1: normalized package name match | Debian stable package indexes: gdb-multiarch from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNU Debugger (with support for multiple architectures) | https://www.gnu.org/s/gdb/
- Debian apt - gdb-source - 16.3-1: normalized package name match | Debian stable package indexes: gdb-source from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNU Debugger (source) | https://www.gnu.org/s/gdb/
- Debian apt - gdbserver - 16.3-1: normalized package name match | Debian stable package indexes: gdbserver from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNU Debugger (remote server) | https://www.gnu.org/s/gdb/
- Nix - gdb: normalized package name match | nixpkgs package indexes: pkgs/by-name/gd/gdb/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - gdb - 15.0.50.20240403-0ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: gdb from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | GNU Debugger | https://www.gnu.org/s/gdb/
- Ubuntu apt - gdb-doc - 15.0.50.20240403-0ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: gdb-doc from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | The GNU Debugger Documentation | https://www.gnu.org/s/gdb/
- Ubuntu apt - gdb-multiarch - 15.0.50.20240403-0ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: gdb-multiarch from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | GNU Debugger (with support for multiple architectures) | https://www.gnu.org/s/gdb/
- Ubuntu apt - gdb-source - 15.0.50.20240403-0ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: gdb-source from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | GNU Debugger (source) | https://www.gnu.org/s/gdb/
- Ubuntu apt - gdbserver - 15.0.50.20240403-0ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: gdbserver from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | GNU Debugger (remote server) | https://www.gnu.org/s/gdb/
- apk - gdb - 16.3-r4: normalized package name match | Alpine Linux edge package indexes: gdb from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | The GNU Debugger | https://www.gnu.org/software/gdb/
- apk - gdb-dbg - 16.3-r4: normalized package name match | Alpine Linux edge package indexes: gdb-dbg from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | The GNU Debugger (debug symbols) | https://www.gnu.org/software/gdb/
- apk - gdb-doc - 16.3-r4: normalized package name match | Alpine Linux edge package indexes: gdb-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | The GNU Debugger (documentation) | https://www.gnu.org/software/gdb/
- apk - gdb-multiarch - 16.3-r4: normalized package name match | Alpine Linux edge package indexes: gdb-multiarch from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | The GNU Debugger for all supported architectures | https://www.gnu.org/software/gdb/
- dnf - gdb - 17.2-4.fc45: normalized package name match | Fedora Rawhide package metadata: gdb from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | A GNU source-level debugger for C, C++, Fortran, Go and other languages | https://gnu.org/software/gdb/


## Combined YAML source

View the package source record on GitHub. [combined/gdb.yml](https://github.com/mxcl/pkgdb/blob/main/combined/gdb.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
