[Lldb-commits] [PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Sep 30 11:39:46 PDT 2018

clayborg added a comment.

See SymbolFileDWARF::ParseVariableDIE. It has code that links up the DW_OP_addr:

  if (is_static_lifetime) {
    if (is_external)
      scope = eValueTypeVariableGlobal;
      scope = eValueTypeVariableStatic;
    if (debug_map_symfile) {
      // When leaving the DWARF in the .o files on darwin, when we have a
      // global variable that wasn't initialized, the .o file might not
      // have allocated a virtual address for the global variable. In
      // this case it will have created a symbol for the global variable
      // that is undefined/data and external and the value will be the
      // byte size of the variable. When we do the address map in
      // SymbolFileDWARFDebugMap we rely on having an address, we need to
      // do some magic here so we can get the correct address for our
      // global variable. The address for all of these entries will be
      // zero, and there will be an undefined symbol in this object file,
      // and the executable will have a matching symbol with a good
      // address. So here we dig up the correct address and replace it in
      // the location for the variable, and set the variable's symbol
      // context scope to be that of the main executable so the file
      // address will resolve correctly.

This is what needs to be fixed.


More information about the lldb-commits mailing list