[Dwarf-Discuss] variable locations - safe use as lvalues

Bishop, John E john.e.bishop@intel.com
Fri Jan 24 19:32:50 GMT 2020

> (1) What if the user chose the first of these options and the program
> changed the variable multiple times between lines 112 and 120?

That's a user error (or misunderstanding), just as in the case where the code was far simpler:

 Line  Source
  10    A = 10
  11    A = 11
  12    B = A

...and the current PC/line was 11 (i.e. the program is about to execute line 11), and the user issued the command:

  debugger-prompt> set A = 30

The debugger would obediently set A to 30.  But now a continue command from the user would execute line 11 and A would be set to 11.

> Should the debugger suppress the program's changes to ensure that the variable
> stays at the given value until line 120?


> (2) Why does the user need to choose a location at all, instead of just
> using the location that matches the current PC?

1. As Ron pointed out, the current PC may correspond to more than one location.
2. The user is setting the variable value in order that a future use of the variable by the code will do what the user wants. This means that the user is focused on a future _use_ of the variable, not on the current value of the variable.

More information about the Dwarf-discuss mailing list