GDB-ADD-INDEX(1)
β¨ NAME β¨
gdb-add-index β bestie's lil shortcut for adding index files so GDB starts up actually fast π (this one lives in the GNU Development Tools manual, mwah)
π¦ SYNOPSIS π¦
gdb-add-index [-h | --help] [-v | --version] [--dwarf-5] filename
πΈ DESCRIPTION πΈ
okay so picture this: GDB finds a symbol file, and the very first thing it does is scan through every symbol in there to build itself an internal symbol table. that's what makes most GDB operations speedy later β but the trade-off is a delay right at the start. and for big programs? that delay is not a vibe. it's long long. so GDB gives you a way to pre-build an index, which speeds up startup. iconic behaviour honestly π
to figure out whether a file already has one of these indexes in it, run readelf -S filename: the index lives in a section called .gdb_index (that's the pre-DWARF 5 era) or .debug_names and .debug_str (that's the DWARF 5 era). heads up though β indexes can only be produced on systems that use ELF binaries and DWARF debug information, i.e. sections named .debug_*. no ELF, no DWARF, no index, sorry not sorry π
by default gdb-add-index will drop a pre-DWARF 5 .gdb_index section into filename. but if you pass --dwarf-5, you get the DWARF 5 section .debug_names added instead. pick your fighter π
filename must be writable. like, that's non-negotiable.
gdb-add-index uses the GDB, objcopy, and readelf it finds via the PATH environment variable. and if you wanna use different versions of those programs, you can specify them through the appropriate environment variables (scroll down, they're in their own section π«Ά).
as for how it goes: gdb-add-index exits with status 0 if it succeeds in creating the index for filename, or greater than 0 if an error occurs. simple as.
and there's more lore in the GDB manual, in the node "Index Files" β hit up this shell command:
info -f gdb -n "Index Files"
π OPTIONS π
--dwarf-5β adds DWARF 5 sections instead of that previous.gdb_indexsection. glow up β¨--help,-hβ lists all the options, with brief explanations. your lil menu, bestie π--version,-vβ prints version information and then peaces out (exits).
π ENVIRONMENT π
GDBβ full file name of thegdbprogram to use for index generation. if it's not set, thePATHgets searched for agdbprogram.OBJCOPYβ full file name of theobjcopyprogram used to copy section information into the given file. if it's not set, thePATHgets searched for aobjcopyprogram.READELFβ full file name of thereadelfprogram used to inspect properties of the given file. if it's not set, thePATHgets searched for areadelfprogram.
π 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 all properly installed at your site, this command:
info gdb
should give you access to the complete manual. go off π
also, Using GDB: A Guide to the GNU Source-Level Debugger, by Richard M. Stallman and Roland H. Pesch, July 1991. vintage but make it iconic π
π COPYRIGHT π
Copyright (c) 1988-2025 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."
ok that's the whole page, no cap. this wasgdb-17.2, dated2026-05-17, and it's pageGDB-ADD-INDEX(1)of the GNU Development Tools manual. go build that index bestie, mwah ππ¦β¨
π¦ where this page comes from
- ubuntu stonking: gdb-bpf 17.2-1ubuntu1+1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms