GDB-ADD-INDEX(1)

πŸ“¦ version 2026.0.1.27+c9c3d3e3_ddb4_490e_bb41_6e9041ba32a7, in arch rolling

πŸ’… 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_index section. 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 the gdb program to use for index generation. If it's not set, the PATH gets searched for a gdb program. πŸ¦‹
  • OBJCOPY β€” the full file name of the objcopy program used to copy section information into the given file. If it's not set, the PATH gets searched for a objcopy program.
  • READELF β€” the full file name of the readelf program used to inspect properties of the given file. If it's not set, the PATH gets 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. 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 (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+, dated 2026-04-07, and yes it is still GDB-ADD-INDEX(1) even after all that. Slay. πŸ’…βœ¨
πŸ“¦ where this page comes from