[09/30] Use block_symbol::address in linespec.c

Message ID 20231029-split-objfile-2023-bound-sym-october-v1-9-612531df2734@tromey.com
State New
Headers
Series Baby step for objfile splitting |

Commit Message

Tom Tromey Oct. 29, 2023, 11:23 p.m. UTC
  This changes linespec.c to use block_symbol::address.
---
 gdb/linespec.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gdb/linespec.c b/gdb/linespec.c
index fa733d880e3..a118a20cade 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -383,7 +383,7 @@  static struct line_offset
 			      const char *variable);
 
 static int symbol_to_sal (struct symtab_and_line *result,
-			  int funfirstline, struct symbol *sym);
+			  int funfirstline, block_symbol sym);
 
 static void add_matching_symbols_to_info (const char *name,
 					  symbol_name_match_type name_match_type,
@@ -2187,7 +2187,7 @@  convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
 	  struct program_space *pspace
 	    = sym.symbol->symtab ()->compunit ()->objfile ()->pspace;
 
-	  if (symbol_to_sal (&sal, state->funfirstline, sym.symbol)
+	  if (symbol_to_sal (&sal, state->funfirstline, sym)
 	      && maybe_add_address (state->addr_set, pspace, sal.pc))
 	    add_sal_to_sals (state, &sals, &sal,
 			     sym.symbol->natural_name (), 0);
@@ -2252,7 +2252,7 @@  convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
 	      if (!found_ifunc)
 		{
 		  symtab_and_line sal;
-		  if (symbol_to_sal (&sal, state->funfirstline, sym.symbol)
+		  if (symbol_to_sal (&sal, state->funfirstline, sym)
 		      && maybe_add_address (state->addr_set, pspace, sal.pc))
 		    add_sal_to_sals (state, &sals, &sal,
 				     sym.symbol->natural_name (), 0);
@@ -4358,8 +4358,9 @@  add_matching_symbols_to_info (const char *name,
 
 static int
 symbol_to_sal (struct symtab_and_line *result,
-	       int funfirstline, struct symbol *sym)
+	       int funfirstline, block_symbol bsym)
 {
+  symbol *sym = bsym.symbol;
   if (sym->aclass () == LOC_BLOCK)
     {
       *result = find_function_start_sal (sym, funfirstline);
@@ -4367,13 +4368,13 @@  symbol_to_sal (struct symtab_and_line *result,
     }
   else
     {
-      if (sym->aclass () == LOC_LABEL && sym->value_address () != 0)
+      if (sym->aclass () == LOC_LABEL && bsym.address () != 0)
 	{
 	  *result = {};
 	  result->symtab = sym->symtab ();
 	  result->symbol = sym;
 	  result->line = sym->line ();
-	  result->pc = sym->value_address ();
+	  result->pc = bsym.address ();
 	  result->pspace = result->symtab->compunit ()->objfile ()->pspace;
 	  result->explicit_pc = 1;
 	  return 1;
@@ -4389,7 +4390,7 @@  symbol_to_sal (struct symtab_and_line *result,
 	  result->symtab = sym->symtab ();
 	  result->symbol = sym;
 	  result->line = sym->line ();
-	  result->pc = sym->value_address ();
+	  result->pc = bsym.address ();
 	  result->pspace = result->symtab->compunit ()->objfile ()->pspace;
 	  return 1;
 	}