I debugged a program with segv at a command like *p = a;
In GDB, it is fine to do
Breakpoint 2, Foo (size=4) at bar.cpp:144
144 meta->requested_size = size;
(gdb) p meta->requested_size = size
$9 = 4
(gdb) p &meta->requested_size
$10 = (size_t *) 0x7021fffffff8
(gdb) p *0x7021fffffff8 = size
$11 = 4
with crash, while n causes segv.
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
0x00005555555a3dcb in Foo (size=4) at bar.cpp:144
144 meta->requested_size = size;
(gdb) p $_siginfo._sifields._sigfault.si_addr
$12 = (void *) 0x7021fffffff8
By How can I check whether a memory address is writable or not at runtime?, I found this address is not writable. Is this gdb's result expected?