I am creating a pin tool which keep track of the bit widths actually needed for variable. To keep track of high level(eg C Variables) I would like to use the debug information build in the executable.
I was not able to find a way to extract the debug info using pin API.
Please let me know if there any pin API function calls out there to extract debug info. If it is not possible with pin, what are the alternatives?
(For example DynamoRIO)
Best How To :
You're looking for symbol information. Sadly, PIN can't give you direct access to the variable names used in a high level language such as C or C++. If you need this information you could include
dbghelp for Windows, or
libdwarf for Linux, but that would require two completely different implementations. There is some information available in the PIN User Guide regarding symbols, and basic functionality to access symbol information about the functions called.
Pin provides access to function names using the symbol object (SYM). Symbol objects only provide information about the function symbols in the application. Information about other types of symbols (e.g. data symbols), must be obtained independently by the tool.
Pin 2.13 User Guide - Symbols