[llvm] r253051 - [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:00:36 PST 2015
Author: rnk
Date: Fri Nov 13 11:00:36 2015
New Revision: 253051
URL: http://llvm.org/viewvc/llvm-project?rev=253051&view=rev
Log:
[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
Modified:
llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h
Modified: llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp?rev=253051&r1=253050&r2=253051&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp (original)
+++ llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp Fri Nov 13 11:00:36 2015
@@ -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::getNameFrom
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::symbo
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::s
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,
Modified: llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h?rev=253051&r1=253050&r2=253051&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h (original)
+++ llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h Fri Nov 13 11:00:36 2015
@@ -43,6 +43,9 @@ public:
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;
More information about the llvm-commits
mailing list