gdb: reference gold --gdb-index in documentation

Message ID 20241005045224.20415-3-forkbombidable@gmail.com
State New
Headers
Series gdb: reference gold --gdb-index in documentation |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Robert Guthrie Oct. 5, 2024, 4:50 a.m. UTC
  Hello, I recently learned about the --gdb-index flag on the GNU linker.
This has been quite an improvement for my workflow with GDB.
I've asked some developers I respect if they knew about this, and none of them did.
There doesn't appear to be any reference to this whatsoever in the GDB documentation.
I think it is appropriate to mention, given its usefulness and GDB's close relationship to gold.

Apologies if this patch is sub par as-is. I haven't contributed to GNU documentation before,
so there may be some conventions I am not aware of that I did not follow.

Thank you

---
 gdb/doc/gdb.texinfo | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Eli Zaretskii Oct. 12, 2024, 11:47 a.m. UTC | #1
> From: Robert Guthrie <forkbombidable@gmail.com>
> Cc: Robert Guthrie <forkbombidable@gmail.com>
> Date: Fri,  4 Oct 2024 23:50:52 -0500
> 
> Hello, I recently learned about the --gdb-index flag on the GNU linker.
> This has been quite an improvement for my workflow with GDB.
> I've asked some developers I respect if they knew about this, and none of them did.
> There doesn't appear to be any reference to this whatsoever in the GDB documentation.
> I think it is appropriate to mention, given its usefulness and GDB's close relationship to gold.
> 
> Apologies if this patch is sub par as-is. I haven't contributed to GNU documentation before,
> so there may be some conventions I am not aware of that I did not follow.

Thanks, installed in your name.
  

Patch

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index cc1b69c6978..3ef3f7d4747 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22862,6 +22862,18 @@  Print the number of cache hits and misses since the launch of @value{GDBN}.
 
 @end table
 
+@subsection Building the index with the GNU @command{gold} linker
+
+The GNU @command{gold} linker can write the index at link time into the resulting ELF
+file, by passing the @command{--gdb-index} flag to @command{gold}.
+
+This is especially helpful if you intend to build a program and immediately
+run it under @value{GDBN}.  You may find that it is faster overall for
+the linker to write the index while it has the relevant information in
+memory anyways, rather than re-reloading the data from disk with
+@command{gdb-add-index}, or debugging the program without an index at
+all, especially for large programs.
+
 @node Debug Names
 @section Extensions to @samp{.debug_names}
 @cindex index files