[11/30] Use block_symbol::address in symmisc.c

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

Checks

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

Commit Message

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

Patch

diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index c1a6ab5cd7d..50b761a3b42 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -44,7 +44,7 @@ 
 
 static int block_depth (const struct block *);
 
-static void print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
+static void print_symbol (struct gdbarch *gdbarch, block_symbol symbol,
 			  int depth, ui_file *outfile);
 
 
@@ -309,7 +309,8 @@  dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
 	    {
 	      try
 		{
-		  print_symbol (gdbarch, sym, depth + 1, outfile);
+		  block_symbol bsym { sym, b };
+		  print_symbol (gdbarch, bsym, depth + 1, outfile);
 		}
 	      catch (const gdb_exception_error &ex)
 		{
@@ -489,11 +490,13 @@  maintenance_print_symbols (const char *args, int from_tty)
 /* Print symbol SYMBOL on OUTFILE.  DEPTH says how far to indent.  */
 
 static void
-print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
+print_symbol (struct gdbarch *gdbarch, block_symbol bsymbol,
 	      int depth, ui_file *outfile)
 {
   struct obj_section *section;
 
+  symbol *symbol = bsymbol.symbol;
+
   if (symbol->is_objfile_owned ())
     section = symbol->obj_section (symbol->objfile ());
   else
@@ -503,7 +506,7 @@  print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
   if (symbol->domain () == LABEL_DOMAIN)
     {
       gdb_printf (outfile, "label %s at ", symbol->print_name ());
-      gdb_puts (paddress (gdbarch, symbol->value_address ()),
+      gdb_puts (paddress (gdbarch, bsymbol.address ()),
 		outfile);
       if (section)
 	gdb_printf (outfile, " section %s\n",
@@ -573,7 +576,7 @@  print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
 
 	case LOC_STATIC:
 	  gdb_printf (outfile, "static at ");
-	  gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile);
+	  gdb_puts (paddress (gdbarch, bsymbol.address ()), outfile);
 	  if (section)
 	    gdb_printf (outfile, " section %s",
 			bfd_section_name (section->the_bfd_section));
@@ -613,7 +616,7 @@  print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
 
 	case LOC_LABEL:
 	  gdb_printf (outfile, "label at ");
-	  gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile);
+	  gdb_puts (paddress (gdbarch, bsymbol.address ()), outfile);
 	  if (section)
 	    gdb_printf (outfile, " section %s",
 			bfd_section_name (section->the_bfd_section));