Tutorial :Visual Studio 2005 Search Memory



Question:

I don't think this exists, but I'll throw this out there anyway. Is it possible, while debugging, to search for a value in memory?

For example, if I have a string "uniqueString" cached somewhere in memory, but I don't know under which variable it's stored--can I do a search for it? As in, find out which variable(s) have "uniqueString" as their value?

This is for C# managed code.


Solution:1

windbg will let you do the search directly. 's' is the command you're looking for, here's a very good cheat sheet. sos extension lets you scan for string objects too in managed code though the s command should find them too (must use unicode aware search).


Solution:2

You have the same functionality in Visual Studio, available from the immediate window. Although, you'd have to manually somehow limit the address range to search in (see the syntax in the link).

(edit) BTW, you can easily create dumps from VS too: Debug->Save Dump As.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »