(gdb) p x
$1 = 10
(gdb) set var x = 20
(gdb) p x
$2 = 20
(gdb) set var x = 30
(gdb) p x
$3 = 30
(gdb) set var x = -6
(gdb) p x
$4 = -6
(gdb) p &x
$5 = (int *) 0x7fffffffdc9c
gdb) set {int }0x7fffffffdc9c = -7
gdb) p x
$6 = -7
(gdb)
For changing the variable value, use the set command with var as parameter saying to the GDB that x is a variable. In the above example, in line 14, changed the value of x using address also.
No comments:
Post a Comment