For example, I want to find out which memory address(es) stores the value 0xbffff5a0. Can gdb give me a list of address within a certain range that has this value?
1 Answer
The short answer is yes.
GDB provides a macro language facility. You can define a macro function to iterate over an address range, and compare against a provided value. This is not tested, but the macro could look something like this:
define findvalue
set $val=$arg0
set $p=(char *)$arg1
set $e=(char *)$arg2
while ($p < $e)
if ($val == *(int *)$p)
print (int *)$p
end
set $p=$p+1
end
end