[v2,06/31] Use block_symbol::address in printcmd.c

Message ID 20231105-split-objfile-2023-bound-sym-october-v2-6-dbd2d158bbc3@tromey.com
State New
Headers
Series Baby step for objfile splitting |

Commit Message

Tom Tromey Nov. 5, 2023, 6:11 p.m. UTC
  This changes printcmd.c to use block_symbol::address.
---
 gdb/printcmd.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
  

Patch

diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 06cc5316eec..2dbaaf0fffe 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1637,7 +1637,6 @@  info_address_command (const char *exp, int from_tty)
 {
   struct gdbarch *gdbarch;
   int regno;
-  struct symbol *sym;
   struct bound_minimal_symbol msymbol;
   long val;
   struct obj_section *section;
@@ -1647,8 +1646,10 @@  info_address_command (const char *exp, int from_tty)
   if (exp == 0)
     error (_("Argument required."));
 
-  sym = lookup_symbol (exp, get_selected_block (&context_pc), VAR_DOMAIN,
-		       &is_a_field_of_this).symbol;
+  block_symbol bsym = lookup_symbol (exp, get_selected_block (&context_pc),
+				     VAR_DOMAIN,
+				     &is_a_field_of_this);
+  symbol *sym = bsym.symbol;
   if (sym == NULL)
     {
       if (is_a_field_of_this.type != NULL)
@@ -1725,7 +1726,7 @@  info_address_command (const char *exp, int from_tty)
 
     case LOC_LABEL:
       gdb_printf ("a label at address ");
-      load_addr = sym->value_address ();
+      load_addr = bsym.address ();
       fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
 		    gdb_stdout);
       if (section_is_overlay (section))
@@ -1761,7 +1762,7 @@  info_address_command (const char *exp, int from_tty)
 
     case LOC_STATIC:
       gdb_printf (_("static storage at address "));
-      load_addr = sym->value_address ();
+      load_addr = bsym.address ();
       fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
 		    gdb_stdout);
       if (section_is_overlay (section))