]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove last_examine_address
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 5 Mar 2026 15:07:54 +0000 (16:07 +0100)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 5 Mar 2026 15:08:30 +0000 (16:08 +0100)
Remove the global variable `last_examine_address`.  It can be obtained
from another global variable, `last_examine_value`.

Reviewed-By: Keith Seitz <keiths@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/printcmd.c

index d7abbcc499b122b5f86ee2b77c966e8f9abf6fc1..193080ef75cd1d66c4cf135cb02a2c45f001ca91 100644 (file)
@@ -85,10 +85,6 @@ static CORE_ADDR next_address;
 
 static int branch_delay_insns;
 
-/* Last address examined.  */
-
-static CORE_ADDR last_examine_address;
-
 /* Contents of last address examined.
    This is not valid past the end of the `x' command!  */
 
@@ -1164,9 +1160,6 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
           i--, count--)
        {
          gdb_printf ("\t");
-         /* Note that print_formatted sets next_address for the next
-            object.  */
-         last_examine_address = next_address;
 
          /* The value to be displayed is not fetched greedily.
             Instead, to avoid the possibility of a fetched value not
@@ -1176,7 +1169,10 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
             the address stored in LAST_EXAMINE_VALUE.  FIXME: Should
             the disassembler be modified so that LAST_EXAMINE_VALUE
             is left with the byte sequence from the last complete
-            instruction fetched from memory?  */
+            instruction fetched from memory?
+
+            Note that print_formatted sets NEXT_ADDRESS for the next
+            object.  */
          last_examine_value
            = release_value (value_at_lazy (val_type, next_address));
 
@@ -1883,6 +1879,7 @@ x_command (const char *exp, int from_tty)
         the correct pointer type.  */
       struct type *pointer_type
        = lookup_pointer_type (last_examine_value->type ());
+      CORE_ADDR last_examine_address = last_examine_value->address ();
       set_internalvar (lookup_internalvar ("_"),
                       value_from_pointer (pointer_type,
                                           last_examine_address));