GDB-ADD-INDEX(1)
π gdb-add-index β like, the GNU Development Tools era, but make it fast
Hey bestie, welcome to gdb-add-index(1), straight out of the GNU Development Tools corner of the universe. Buckle up, we're making debuggers go zoom. β¨
πΈ NAME
gdb-add-index β adds index files to speed up GDB. That's it. That's the whole vibe. π
π¦ SYNOPSIS
gdb-add-index [-h | --help] [-v | --version] [--dwarf-5] filename
π DESCRIPTION
Okay so picture this: GDB finds a symbol file, and the first thing it does is scan every symbol in it to build its own internal symbol table. Which, like, makes everything else super fast afterwards β but at the cost of a little delay right at the start. π For big programs that delay is honestly not little at all, so GDB gives you a way to pre-build an index, and that speeds up startup. Iconic behaviour, no cap.
Wanna know if a file already has one? Run readelf -S filename β the index lives in a section called .gdb_index (that's pre-DWARF 5) or .debug_names and .debug_str (that's DWARF 5). Also, heads up: indexes can only be produced on systems that use ELF binaries and DWARF debug information (like, sections named .debug_*). It's giving very specific requirements, I know. π
By default, gdb-add-index adds a pre-DWARF 5 .gdb_index section to filename. With --dwarf-5 the DWARF 5 section .debug_names gets added instead. Glow up. β¨
filename must be writable. Not optional, bestie. π«Ά
gdb-add-index uses the GDB, objcopy, and readelf programs found in the PATH environment variable. If you want different versions of those programs, just specify them through the appropriate environment variables (scroll down, they're right there).
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. π
Wanna see more? It's in the GDB manual, node "Index Files" β shell command info -f gdb -n "Index Files".
β¨ OPTIONS β¨
--dwarf-5β adds DWARF 5 sections instead of the previous.gdb_indexsection. Newer, fresher, very main character.--help,-hβ lists all the options with brief explanations. Your little cheatsheet moment. π--version,-vβ prints version info and then exits. Bye bestie! π
π ENVIRONMENT
GDBβ the full file name of thegdbprogram to use for index generation. If it's not set, thePATHgets searched for agdbprogram. π¦OBJCOPYβ the full file name of theobjcopyprogram used to copy section information into the given file. If it's not set, thePATHgets searched for aobjcopyprogram.READELFβ the 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 properly installed at your site, the command
info gdb
should give you access to the complete manual. Fr fr, it's all in there. π
Using GDB: A Guide to the GNU Source-Level Debugger, Richard M. Stallman and Roland H. Pesch, July 1991. Vintage, but make it 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." @sp 1 Copyright (c) 2026, Intel Corporation. Intel's modifications are provided pursuant to the GNU Free Documentation license.
π That's the whole page, bestie βgdb-17.1.2026.be1840694+, dated2026-04-07, and yes it is stillGDB-ADD-INDEX(1)even after all that. Slay. π β¨
π¦ where this page comes from
- arch rolling: intel-oneapi-dpcpp-debugger 2026.0.0_220-1 Β· LicenseRef-Intel-EULA-Developer-Tools
- arch rolling: intel-oneapi-toolkit 2026.0.1.27+c9c3d3e3_ddb4_490e_bb41_6e9041ba32a7-2 Β· LicenseRef-Intel-EULA-Developer-Tools AND LicenseRef-Intel-Simplified
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms