I will narrow down my questions:
The entry address in GDB stays the same for the same program (even after reboot, and after rewriting the source code).
Why is th
Your program is (at least partially) statically linked, and main()
almost certainly is. Rebooting your computer isn't going to change that statically linked part of the executable.
For example 0x80483f4 is the starting address.
This is likely. Unless you have PIE (position independent executables), it will stay the same (for one binary) forever.
$2 = 0x80483fa <main()+6> (gdb) x $2 0x80483fa <main()+6>: 0x3fc45c7
That is the binary representation of the instructions at main()+6
. Will never change in one binary.
(gdb) p 0x3fc45c7 $3 = 66864583 <-- even after reboot.
That means 0x3fc45c7 is 66864583 in decimal...
Note that none of this has anything to do with a
or b
.
BTW the best way to get values of variables "before assignment" is to printf
them before the assignment.