Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/DebugInfo/DIContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ struct DIDumpOptions {

class DIContext {
public:
enum DIContextKind { CK_DWARF, CK_PDB, CK_BTF, CK_GSYM };
enum DIContextKind { CK_DWARF, CK_PDB, CK_BTF };

DIContext(DIContextKind K) : Kind(K) {}
virtual ~DIContext() = default;
Expand Down
66 changes: 0 additions & 66 deletions llvm/include/llvm/DebugInfo/GSYM/GsymDIContext.h

This file was deleted.

3 changes: 0 additions & 3 deletions llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,11 @@ class LLVMSymbolizer {
bool RelativeAddresses = false;
bool UntagAddresses = false;
bool UseDIA = false;
bool DisableGsym = false;
std::string DefaultArch;
std::vector<std::string> DsymHints;
std::string FallbackDebugPath;
std::string DWPName;
std::vector<std::string> DebugFileDirectory;
std::vector<std::string> GsymFileDirectory;
size_t MaxCacheSize =
sizeof(size_t) == 4
? 512 * 1024 * 1024 /* 512 MiB */
Expand Down Expand Up @@ -179,7 +177,6 @@ class LLVMSymbolizer {
ObjectFile *lookUpBuildIDObject(const std::string &Path,
const ELFObjectFileBase *Obj,
const std::string &ArchName);
std::string lookUpGsymFile(const std::string &Path);

bool findDebugBinary(const std::string &OrigPath,
const std::string &DebuglinkName, uint32_t CRCHash,
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/DebugInfo/GSYM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ add_llvm_component_library(LLVMDebugInfoGSYM
FileWriter.cpp
FunctionInfo.cpp
GsymCreator.cpp
GsymDIContext.cpp
GsymReader.cpp
InlineInfo.cpp
LineTable.cpp
Expand Down
166 changes: 0 additions & 166 deletions llvm/lib/DebugInfo/GSYM/GsymDIContext.cpp

This file was deleted.

1 change: 0 additions & 1 deletion llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ add_llvm_component_library(LLVMSymbolize

LINK_COMPONENTS
DebugInfoDWARF
DebugInfoGSYM
DebugInfoPDB
DebugInfoBTF
Object
Expand Down
94 changes: 23 additions & 71 deletions llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/BTF/BTFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/GSYM/GsymDIContext.h"
#include "llvm/DebugInfo/GSYM/GsymReader.h"
#include "llvm/DebugInfo/PDB/PDB.h"
#include "llvm/DebugInfo/PDB/PDBContext.h"
#include "llvm/DebugInfo/Symbolize/SymbolizableObjectFile.h"
Expand Down Expand Up @@ -500,34 +498,6 @@ bool LLVMSymbolizer::getOrFindDebugBinary(const ArrayRef<uint8_t> BuildID,
return false;
}

std::string LLVMSymbolizer::lookUpGsymFile(const std::string &Path) {
if (Opts.DisableGsym)
return {};

auto CheckGsymFile = [](const llvm::StringRef &GsymPath) {
sys::fs::file_status Status;
std::error_code EC = llvm::sys::fs::status(GsymPath, Status);
return !EC && !llvm::sys::fs::is_directory(Status);
};

// First, look beside the binary file
if (const auto GsymPath = Path + ".gsym"; CheckGsymFile(GsymPath))
return GsymPath;

// Then, look in the directories specified by GsymFileDirectory

for (const auto &Directory : Opts.GsymFileDirectory) {
SmallString<16> GsymPath = llvm::StringRef{Directory};
llvm::sys::path::append(GsymPath,
llvm::sys::path::filename(Path) + ".gsym");

if (CheckGsymFile(GsymPath))
return static_cast<std::string>(GsymPath);
}

return {};
}

Expected<LLVMSymbolizer::ObjectPair>
LLVMSymbolizer::getOrCreateObjectPair(const std::string &Path,
const std::string &ArchName) {
Expand Down Expand Up @@ -664,48 +634,30 @@ LLVMSymbolizer::getOrCreateModuleInfo(StringRef ModuleName) {
std::unique_ptr<DIContext> Context;
// If this is a COFF object containing PDB info and not containing DWARF
// section, use a PDBContext to symbolize. Otherwise, use DWARF.
// Create a DIContext to symbolize as follows:
// - If there is a GSYM file, create a GsymDIContext.
// - Otherwise, if this is a COFF object containing PDB info, create a
// PDBContext.
// - Otherwise, create a DWARFContext.
const auto GsymFile = lookUpGsymFile(BinaryName.str());
if (!GsymFile.empty()) {
auto ReaderOrErr = gsym::GsymReader::openFile(GsymFile);

if (ReaderOrErr) {
std::unique_ptr<gsym::GsymReader> Reader =
std::make_unique<gsym::GsymReader>(std::move(*ReaderOrErr));

Context = std::make_unique<gsym::GsymDIContext>(std::move(Reader));
}
}
if (!Context) {
if (auto CoffObject = dyn_cast<COFFObjectFile>(Objects.first)) {
const codeview::DebugInfo *DebugInfo;
StringRef PDBFileName;
auto EC = CoffObject->getDebugPDBInfo(DebugInfo, PDBFileName);
// Use DWARF if there're DWARF sections.
bool HasDwarf = llvm::any_of(
Objects.first->sections(), [](SectionRef Section) -> bool {
if (Expected<StringRef> SectionName = Section.getName())
return SectionName.get() == ".debug_info";
return false;
});
if (!EC && !HasDwarf && DebugInfo != nullptr && !PDBFileName.empty()) {
using namespace pdb;
std::unique_ptr<IPDBSession> Session;

PDB_ReaderType ReaderType =
Opts.UseDIA ? PDB_ReaderType::DIA : PDB_ReaderType::Native;
if (auto Err = loadDataForEXE(ReaderType, Objects.first->getFileName(),
Session)) {
Modules.emplace(ModuleName, std::unique_ptr<SymbolizableModule>());
// Return along the PDB filename to provide more context
return createFileError(PDBFileName, std::move(Err));
}
Context.reset(new PDBContext(*CoffObject, std::move(Session)));
if (auto CoffObject = dyn_cast<COFFObjectFile>(Objects.first)) {
const codeview::DebugInfo *DebugInfo;
StringRef PDBFileName;
auto EC = CoffObject->getDebugPDBInfo(DebugInfo, PDBFileName);
// Use DWARF if there're DWARF sections.
bool HasDwarf =
llvm::any_of(Objects.first->sections(), [](SectionRef Section) -> bool {
if (Expected<StringRef> SectionName = Section.getName())
return SectionName.get() == ".debug_info";
return false;
});
if (!EC && !HasDwarf && DebugInfo != nullptr && !PDBFileName.empty()) {
using namespace pdb;
std::unique_ptr<IPDBSession> Session;

PDB_ReaderType ReaderType =
Opts.UseDIA ? PDB_ReaderType::DIA : PDB_ReaderType::Native;
if (auto Err = loadDataForEXE(ReaderType, Objects.first->getFileName(),
Session)) {
Modules.emplace(ModuleName, std::unique_ptr<SymbolizableModule>());
// Return along the PDB filename to provide more context
return createFileError(PDBFileName, std::move(Err));
}
Context.reset(new PDBContext(*CoffObject, std::move(Session)));
}
}
if (!Context)
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Loading