Skip to content

Commit 21744bd

Browse files
JPEWdevCopilot
andcommitted
doc: add documentation for --debug-prefix-map option
Document the --debug-prefix-map command-line option in doc/running.src, including its BASE=DEST argument format, use cases (cross-directory builds and reproducible builds), example usage with ELF64/DWARF, and behavior when multiple mappings are specified. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 87968c3 commit 21744bd

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

doc/running.src

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,29 @@ If no debug information is currently implemented in the selected output
289289
format, \c{-g} is \e{silently ignored}.
290290

291291

292+
\S{opt-debug-prefix-map} The \i\c{--debug-prefix-map} Option: Remapping \i{Source File Paths} in Debug Info
293+
294+
This option remaps source file path prefixes when encoding filenames in
295+
the output object file's debug information. It takes a single argument
296+
of the form \c{BASE=DEST}: any source path that begins with \c{BASE} has
297+
that prefix replaced with \c{DEST} before the path is written into the
298+
output. This is useful when building in a different directory from the
299+
one referenced in the source, or when producing \i{reproducible builds}
300+
by stripping machine-specific path components.
301+
302+
For example:
303+
304+
\c nasm -f elf64 -g -F dwarf --debug-prefix-map /home/user/src=/usr/src myfile.asm
305+
306+
causes paths beginning with \c{/home/user/src} to appear as \c{/usr/src}
307+
in the generated DWARF debug information. Multiple \c{--debug-prefix-map}
308+
options may be given; they are applied in the order specified and the
309+
first matching prefix wins.
310+
311+
The option requires an argument of the form \c{BASE=DEST}; omitting the
312+
\c{=} separator is a fatal usage error.
313+
314+
292315
\S{opt-X} The \i\c{-X} Option: Selecting an \i{Error Reporting Format}
293316

294317
This option can be used to select an error reporting format for any
@@ -575,6 +598,8 @@ For command-line compatibility with Yasm, the form \i\c{--v} is also
575598
accepted for this option starting in NASM version 2.11.05.
576599

577600

601+
\IR{--debug-prefix-map} \c{--debug-prefix-map} option
602+
578603
\IR{--prefix} \c{--prefix} option
579604
\IC{--prefix}{--gprefix} \c{--gprefix} option
580605
\IC{--prefix}{--lprefix} \c{--lprefix} option

0 commit comments

Comments
 (0)