ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a way to use gdb to scan a process' memory for a set of values in a specified address range?
For instance, if the heap for my process ran from 0x08050000 - 0x0827d000, and I wanted to have gdb return the address of the first location it finds within that address range which contains the 4-byte sequence 0xa17ad376 ... what is the command to do this sort of thing?
If GDB cannot do this, could someone recommend a tool that does possess this capability?
Sorry I didn't understand the question, well right now I can only come up with somenthing like this: supose you know the address you want to start with, in gdb you tell it this:
here at the example in looking for the 0x14 in memory, and p/x will give me the addres where it was found or the end address, I hope it can be useful now.
I have a file of C functions for doing complex things inside of GDB.
All of them are set up with do-nothing defaults, so when called they do not affect program behavior. (I do not have one for finding a memory value the way you specified. You also didn't indicate if the value was word-aligned or not. Makes a big difference in how you search.) I set up a single entry point in the code to force the linker to include them.
They do nothing. Unless.
You call the function in gdb "call functionname", with an already set breakpoint inside the function, change the arguments with set, and let it run. IF you need this often consider writing a simple
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.