1

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 1

3

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.