GDB-ADD-INDEX(1)
π gdb-add-index π
okay so real quick β this page comes to you straight from GNU Development Tools, and it's about making GDB not take a million years to boot up. bestie, let's go. π
β¨ NAME β¨
gdb-add-index β adds index files to speed up GDB ποΈπ¨
πΈ SYNOPSIS πΈ
gdb-add-index [-h | --help] [-v | --version] [--dwarf-5] filename
π¦ DESCRIPTION π¦
so here's the tea π΅ β when GDB finds a symbol file, it scans all the symbols in that file to construct an internal symbol table. iconic behaviour, yes, and it's what lets most GDB operations run super quickly β but at the cost of a little delay early on. and for large programs? that delay can be, like, quite lengthy. π so GDB gives you a way to build an index, and that index speeds up startup. main character energy fr fr. π
to figure out whether a file already contains such an index, just use the command readelf -S filename β the index is stored in a section named .gdb_index (pre-DWARF 5) or .debug_names and .debug_str (DWARF 5). heads up though: indexes can only be produced on systems which use ELF binaries and DWARF debug information (i.e., sections named .debug_*). no ELF, no DWARF, no index. that's the vibe check. π
by default, gdb-add-index will add a pre-DWARF 5 .gdb_index section to filename. with --dwarf-5, the DWARF 5 section .debug_names is added instead. glow-up. β¨
filename must be writable. non-negotiable bestie, it's literally writing to it. π
gdb-add-index uses GDB, objcopy, and readelf found in the PATH environment variable. if you want to use different versions of these programs, you can specify them through the appropriate environment variables (see below π).
gdb-add-index exits with status 0 if it succeeds in creating the index for filename, or greater than 0 if an error occurs. zero means slay, nonzero means not slay. π
see more in the GDB manual in node "Index Files" β shell command info -f gdb -n "Index Files".
π OPTIONS π
--dwarf-5β adds DWARF 5 sections instead of the previous.gdb_indexsection. new gen, new sections π¦--help,-hβ lists all the options, with brief explanations. the tour guide of flags π«Ά--version,-vβ prints version information and then exits. hit it and quit it π
π ENVIRONMENT π
GDBβ full file name of the"gdb"program to use for index generation. if it's not set, thePATHwill be searched for a"gdb"program.OBJCOPYβ full file name of the"objcopy"program to use to copy section information into the given file. if it's not set, thePATHwill be searched for a"objcopy"program.READELFβ full file name of the"readelf"program to use to inspect properties of the given file. if it's not set, thePATHwill be searched for a"readelf"program.
β SEE ALSO β
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. literally the whole thing. π
Using GDB: A Guide to the GNU Source-Level Debugger, Richard M. Stallman and Roland H. Pesch, July 1991. vintage but still iconic π°οΈ
π COPYRIGHT π
Copyright (c) 1988-2026 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being "Free Software" and "Free Software Needs Free Documentation", with the Front-Cover Texts being "A GNU Manual," and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: "You are free to copy and modify this GNU Manual. Buying copies from GNU Press supports the FSF in developing GNU and promoting software freedom."
and that's the whole page, bestie π«Άβ¨ this lil masterpiece is gdb-18.1, dated 2026-09-25 β go forth and index responsibly π ππ¦
π¦ where this page comes from
- arch rolling: gdb 18.1-1 Β· GPL-3.0-or-later AND LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms