[binutils-gdb] gdb/dwarf: rename some abbrev-related things in debug_names writer

Simon Marchi simark@sourceware.org
Tue Jan 20 21:13:09 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=23f0876b43150fa1d5ea70b053629ad4c59fb2cf

commit 23f0876b43150fa1d5ea70b053629ad4c59fb2cf
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Sat Jan 17 01:02:34 2026 -0500

    gdb/dwarf: rename some abbrev-related things in debug_names writer
    
    I think it would be clearer for some of these things to be called
    "abbrev", rather than "idx".
    
    Change-Id: Ic128a77dc7ce14a6179c049a2de21f3f9636405d
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdb/dwarf2/index-write.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 39910cd3f71..c4bd424d434 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -720,17 +720,17 @@ public:
 	    if (parent != nullptr && (parent->flags & IS_SYNTHESIZED) != 0)
 	      parent = nullptr;
 
-	    int &idx = m_indexkey_to_idx[index_key (entry->tag,
-						    kind,
-						    entry->flags,
-						    entry->lang,
-						    parent != nullptr)];
-	    if (idx == 0)
+	    int &abbrev = m_indexkey_to_abbrev[index_key (entry->tag,
+							  kind,
+							  entry->flags,
+							  entry->lang,
+							  parent != nullptr)];
+	    if (abbrev == 0)
 	      {
-		idx = next_abbrev++;
+		abbrev = next_abbrev++;
 
 		/* Abbrev number and tag.  */
-		m_abbrev_table.append_unsigned_leb128 (idx);
+		m_abbrev_table.append_unsigned_leb128 (abbrev);
 		m_abbrev_table.append_unsigned_leb128 (entry->tag);
 
 		/* Unit index.  */
@@ -790,7 +790,7 @@ public:
 	    gdb_assert (offset_inserted);
 
 	    /* Write the entry to the pool, starting with the abbrev number.  */
-	    m_entry_pool.append_unsigned_leb128 (idx);
+	    m_entry_pool.append_unsigned_leb128 (abbrev);
 
 	    /* Unit index.  */
 	    const auto it = m_cu_index_htab.find (entry->per_cu);
@@ -1107,8 +1107,8 @@ private:
   debug_str_lookup m_debugstrlookup;
 
   /* Map each used .debug_names abbreviation tag parameter to its
-     index value.  */
-  gdb::unordered_map<index_key, int, index_key_hasher> m_indexkey_to_idx;
+     abbrev value.  */
+  gdb::unordered_map<index_key, int, index_key_hasher> m_indexkey_to_abbrev;
 
   /* .debug_names abbreviation table.  */
   data_buf m_abbrev_table;


More information about the Gdb-cvs mailing list