[lldb-dev] Symtab for PECOFF

Aleksandr Urakov via lldb-dev lldb-dev at lists.llvm.org
Thu Aug 30 06:59:59 PDT 2018


Hello!

I'm working on an expressions evaluation on Windows, and currently I'm
trying to make a JIT evaluation working.

When I'm trying to evaluate the next expression:

print S::x


on the next code:

struct S {
  static int x;
  void foo() { }
};
int S::x = 5;

int main() {
  S().foo(); // here
  return 0;
}


the evaluation requires JIT (but printing of global variables requires not,
and I can't figure out what is the key difference between a class static
variable and a global variable in the case?).

During symbols resolving IRExecutionUnit::FindInSymbols is used, and it
searches a symbol among functions (which is not our case), and then calls
Module::FindSymbolsWithNameAndType for each module in the list. This
function looks symbols up in a Symtab, which is retrieved through a
SymbolVendor, and it retrieves one from an ObjectFile. ELF files contain
symbols for such a variables in their symbol tables, but the problem is
that PE files usually contain info about exported (and imported) symbols
only, so the lookup in Symtab fails.

I think that we need somehow to retrieve a symbols info from a symbol file.
I thought that we can emit a Symtab from a SymbolFile just like from an
ObjectFile (and for now implement it for SymbolFilePDB only), but I'm not
sure if this solution is good. How can we solve the problem else?

-- 
Aleksandr Urakov
Software Developer
JetBrains
http://www.jetbrains.com
The Drive to Develop
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180830/edfe2bb0/attachment.html>


More information about the lldb-dev mailing list