[PATCH] D14594: [Symbolizer] Don't use PE symbol tables to override PDB symbols

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 09:15:32 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL253051: [Symbolizer] Don't use PE symbol tables to override PDB symbols (authored by rnk).

Changed prior to commit:
  http://reviews.llvm.org/D14594?vs=39987&id=40158#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14594

Files:
  llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
  llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h

Index: llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h
===================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h
+++ llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h
@@ -43,6 +43,9 @@
   uint64_t getModulePreferredBase() const override;
 
 private:
+  bool shouldOverrideWithSymbolTable(FunctionNameKind FNKind,
+                                     bool UseSymbolTable) const;
+
   bool getNameFromSymbolTable(object::SymbolRef::Type Type, uint64_t Address,
                               std::string &Name, uint64_t &Addr,
                               uint64_t &Size) const;
Index: llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
===================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -14,6 +14,7 @@
 #include "SymbolizableObjectFile.h"
 #include "llvm/Object/SymbolSize.h"
 #include "llvm/Support/DataExtractor.h"
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
 
 namespace llvm {
 namespace symbolize {
@@ -186,6 +187,16 @@
   return true;
 }
 
+bool SymbolizableObjectFile::shouldOverrideWithSymbolTable(
+    FunctionNameKind FNKind, bool UseSymbolTable) const {
+  // When DWARF is used with -gline-tables-only / -gmlt, the symbol table gives
+  // better answers for linkage names than the DIContext. Otherwise, we are
+  // probably using PEs and PDBs, and we shouldn't do the override. PE files
+  // generally only contain the names of exported symbols.
+  return FNKind == FunctionNameKind::LinkageName && UseSymbolTable &&
+         isa<DWARFContext>(DebugInfoContext.get());
+}
+
 DILineInfo SymbolizableObjectFile::symbolizeCode(uint64_t ModuleOffset,
                                                  FunctionNameKind FNKind,
                                                  bool UseSymbolTable) const {
@@ -195,7 +206,7 @@
         ModuleOffset, getDILineInfoSpecifier(FNKind));
   }
   // Override function name from symbol table if necessary.
-  if (FNKind == FunctionNameKind::LinkageName && UseSymbolTable) {
+  if (shouldOverrideWithSymbolTable(FNKind, UseSymbolTable)) {
     std::string FunctionName;
     uint64_t Start, Size;
     if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
@@ -218,7 +229,7 @@
     InlinedContext.addFrame(DILineInfo());
 
   // Override the function name in lower frame with name from symbol table.
-  if (FNKind == FunctionNameKind::LinkageName && UseSymbolTable) {
+  if (shouldOverrideWithSymbolTable(FNKind, UseSymbolTable)) {
     std::string FunctionName;
     uint64_t Start, Size;
     if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14594.40158.patch
Type: text/x-patch
Size: 2788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151113/d4e44335/attachment.bin>


More information about the llvm-commits mailing list