3

I am new to gdb and I am trying to figure out if there is a way to do this: I have a reference and want to know where all this reference is been used in a core dump heap memory, something like a search for all occurrences of this reference in heap memory. Sorry if this question makes no sense or seems too simple.

1 Answer 1

5

So first you need to find out where the memory has been mapped. This can be done with either "info files" or "maintenance info sections". After you have the mappings you can use the gdb find command on each of these mappings. The gdb find command has the following syntax:

find begin-address end-address address-to-search-for
Sign up to request clarification or add additional context in comments.

2 Comments

is there anyway to automate this to scan all areas of memory?
You can use github.com/hugsy/gef, GDB extension which provides a "search-pattern" (hugsy.github.io/gef/commands/search-pattern) command searches the value in all segments or you can write you own gdb python extension that can do the same thing.

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.