aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-11-13 17:00:36 +0000
committerReid Kleckner <rnk@google.com>2015-11-13 17:00:36 +0000
commitc038e2db4d890969b016efc9a0f7c907c1fca19d (patch)
tree629ee225731c1495189fee3bd2d798f30c216a75 /llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
parentf920fb19f19b5c3d7293d4d9584281250c57d504 (diff)
downloadllvm-c038e2db4d890969b016efc9a0f7c907c1fca19d.zip
llvm-c038e2db4d890969b016efc9a0f7c907c1fca19d.tar.gz
llvm-c038e2db4d890969b016efc9a0f7c907c1fca19d.tar.bz2
[Symbolizer] Don't use PE symbol tables to override PDB symbols
Summary: PE files are stripped by default, and only contain the names of exported symbols. The actual reason that we bother to do this override by default is actually due to a quirk of the way -gline-tables-only is implemented, so I phrased the check as "if we are symbolizing from dwarf, do the symtab override". This fixes lots of Windows ASan tests that I broke in r250582. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14594 llvm-svn: 253051
Diffstat (limited to 'llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
index d3a54ca..e314624 100644
--- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ b/llvm/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 @@ bool SymbolizableObjectFile::getNameFromSymbolTable(SymbolRef::Type Type,
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 @@ DILineInfo SymbolizableObjectFile::symbolizeCode(uint64_t ModuleOffset,
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 @@ DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
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,