My goal is:
The first is fine and it's the second that this question is about. At a high level, how do you enumerate local variables given a stack entry in Delphi?
At a low level, this is what I've been investigating:
RTTI: does not list this kind of information about methods. This was not something I actually ever thought was a realistic option, but listing here anyway.
Debug information: Loading the debug info produced for a debug build.
The problems I'm encountering here are:
If this is the right approach, then this question becomes 'Is there documentation for the TDS/TD32 file format, and are there any code samples that load local variables?'
A code sample isn't essential but could be very useful, even if it's very minimal.
Check if any debugging symbols weren't in binary. Also possible is using GDB (on Windows a port of it). It would be great if you found a .dbg or .dSYM file. They contain source code, eg.
gdb> list foo 56 void foo() 57 { 58 bar(); 59 sighandler_t fnc = signal(SIGHUP, SIG_IGN); 60 raise(SIGHUP); 61 signal(SIGHUP, fnc); 62 baz(fnc); 63 }
If you don't have any debugging files, you may try to get MinGW or Cygwin, and use nm(1) (man page). It will read symbol names from binary. They may contain some types, like C++ ones:
int abc::def::Ghi::jkl(const std::string, int, const void*)
Don't forget to add --demangle
option then or you'll get something like:
__ZN11MRasterFont21getRasterForCharacterEh
instead of:
MRasterFont::getRasterForCharacter(unsigned char)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With