Example tools:
Detecting the Loading and Unloading of Images (Image Instrumentation)
Iteration idioms:
// Visit every loaded image for( IMG img= APP_ImgHead(); IMG_Valid(img); img = IMG_Next(img) )
|
Type of function to be called when an image is loaded |
|
|
|
|
|
|
Use this to register a call back to catch the loading of an image
|
|
Register fun as a call back to be used when an image is unloaded. This is not an instrumentation function--it doesn't make sense to instrument a function when it removed from memory.
|
|
Close the open image.
|
|
|
|
Find image by address. For each image, check if the address is within the mapped memory region of one of its segments.
|
|
Find image by Id
|
|
|
|
Tells the highest address of any code or data loaded by the image. This is the address of the last byte loaded by the image.
|
|
Returns a unique ID for the image. If an image is unloaded, the ID is not reused for a different image. If an image is unloaded and the same one is loaded back, the ID is different.
|
|
|
|
|
|
|
|
|
|
Tells the lowest address of any code or data loaded by the image.
|
|
|
|
|
|
|
|
Allows one to open an image and browse it statically. There can only be one image open at a time. File names are encoded in UTF8 (a superset of ASCII), this is supported for Linux (only for locales encoded in UTF8) and Windows.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tells the size of the raw image mapped by Pin, including the size of the image's symbolic information, which is not normally mapped by the application. Use this with IMG_StartAddress() to find the entire memory range of the raw image mapped by Pin. Note, this does not give the address range of the image from the application's perspective. To get that, use IMG_LowAddress() and IMG_HighAddress(). On Linux, the file is mapped in image-load callback or after IMG_Open. In other cases the IMG_SizeMapped returns 0.
|
|
On Windows, the whole image has been loaded by system loader at once. IMG_StartAddress() gives the pointer to the image, mapped by loader. If you are working inside image-load callback - IMG_LowAddress() and IMG_StartAddress() return the same value. On Unix, the loader maps only portions of the image file that contain code and data. Additionally, Pin maps the whole image file for parsing. IMG_StartAddress() returns a pointer to the memory mapped file. After return form image-load callback the whole image file is being unmapped and the pointer becomes invalid. The IMG_StartAddress() returns 0. Note, On Unix, the IMG_LowAddress() and IMG_StartAddress() return different values. On IMG_Open(), Pin maps the whole image into memory and the pointer is valid until IMG_Close()
|
|
|
|
|