[pushed] Fix self-test crash

Message ID 20250117175042.1376478-1-tromey@adacore.com
State New
Headers
Series [pushed] Fix self-test crash |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Tom Tromey Jan. 17, 2025, 5:50 p.m. UTC
  My earlier changes introduced a self-test crash.  This patch fixes the
bug by introducing a new method overload into mock_mapped_index.
---
 gdb/dwarf2/read-gdb-index.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index 165816f23e7..a9ae741cb81 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -145,7 +145,9 @@  struct mapped_gdb_index : public dwarf_scanner_base
     return symbol_table[2 * idx + 1];
   }
 
-  bool symbol_name_slot_invalid (offset_type idx) const
+  /* Return whether the name at IDX in the symbol table should be
+     ignored.  */
+  virtual bool symbol_name_slot_invalid (offset_type idx) const
   {
     return (symbol_name_index (idx) == 0
 	    && symbol_vec_index (idx) == 0);
@@ -553,6 +555,9 @@  class mock_mapped_index : public mapped_gdb_index
 
   DISABLE_COPY_AND_ASSIGN (mock_mapped_index);
 
+  bool symbol_name_slot_invalid (offset_type idx) const override
+  { return false; }
+
   /* Return the number of names in the symbol table.  */
   size_t symbol_name_count () const override
   {