[1/7] Compare section index in lookup_minimal_symbol_by_pc_section

Message ID 20240217-dwarf-race-relocate-v1-1-d3d2d908c1e8@tromey.com
State New
Headers
Series Fix race in DWARF reader |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Testing failed

Commit Message

Tom Tromey Feb. 18, 2024, 1:10 a.m. UTC
  This changes lookup_minimal_symbol_by_pc_section to compare the
section index when comparing two symbols.  This is ok because the
symbols in question always come from the same objfile.  The motivation
for this is to simplify a refactoring in a subsequent patch; but it is
also more efficient.
---
 gdb/minsyms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 1b85424586f..ffded3781c4 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -901,8 +901,8 @@  lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
 		      && (msymbol[hi].size () == msymbol[hi - 1].size ())
 		      && (msymbol[hi].unrelocated_address ()
 			  == msymbol[hi - 1].unrelocated_address ())
-		      && (msymbol[hi].obj_section (objfile)
-			  == msymbol[hi - 1].obj_section (objfile)))
+		      && (msymbol[hi].section_index ()
+			  == msymbol[hi - 1].section_index ()))
 		    {
 		      hi--;
 		      continue;