-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[llvm-debuginfo-analyzer] Add support for LLVM IR format. #135440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: users/SLTozer/debug-ssa-updater
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ class LVSplitContext final { | |
|
||
/// The logical reader owns of all the logical elements created during | ||
/// the debug information parsing. For its creation it uses a specific | ||
/// bump allocator for each type of logical element. | ||
/// bump allocator for each type of logical element. | ||
class LVReader { | ||
LVBinaryType BinaryType; | ||
|
||
|
@@ -121,7 +121,24 @@ class LVReader { | |
|
||
#undef LV_OBJECT_ALLOCATOR | ||
|
||
// Scopes with ranges for current compile unit. It is used to find a line | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (for the benefit of any other reviewers, these have been hoisted out of the object-file and DWARF readers to be more generic) |
||
// giving its exact or closest address. To support comdat functions, all | ||
// addresses for the same section are recorded in the same map. | ||
using LVSectionRanges = std::map<LVSectionIndex, std::unique_ptr<LVRange>>; | ||
LVSectionRanges SectionRanges; | ||
|
||
protected: | ||
// Current elements during the processing of a DIE/MDNode. | ||
LVElement *CurrentElement = nullptr; | ||
LVScope *CurrentScope = nullptr; | ||
LVSymbol *CurrentSymbol = nullptr; | ||
LVType *CurrentType = nullptr; | ||
LVLine *CurrentLine = nullptr; | ||
LVOffset CurrentOffset = 0; | ||
|
||
// Address ranges collected for current DIE/MDNode/AST Node. | ||
std::vector<LVAddressRange> CurrentRanges; | ||
|
||
LVScopeRoot *Root = nullptr; | ||
std::string InputFilename; | ||
std::string FileFormatName; | ||
|
@@ -132,11 +149,18 @@ class LVReader { | |
// Only for ELF format. The CodeView is handled in a different way. | ||
LVSectionIndex DotTextSectionIndex = UndefinedSectionIndex; | ||
|
||
void addSectionRange(LVSectionIndex SectionIndex, LVScope *Scope); | ||
void addSectionRange(LVSectionIndex SectionIndex, LVScope *Scope, | ||
LVAddress LowerAddress, LVAddress UpperAddress); | ||
LVRange *getSectionRanges(LVSectionIndex SectionIndex); | ||
|
||
// Record Compilation Unit entry. | ||
void addCompileUnitOffset(LVOffset Offset, LVScopeCompileUnit *CompileUnit) { | ||
CompileUnits.emplace(Offset, CompileUnit); | ||
} | ||
|
||
LVElement *createElement(dwarf::Tag Tag); | ||
|
||
// Create the Scope Root. | ||
virtual Error createScopes() { | ||
Root = createScopeRoot(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
#include "llvm/DebugInfo/LogicalView/Core/LVReader.h" | ||
#include "llvm/DebugInfo/PDB/Native/PDBFile.h" | ||
#include "llvm/Object/Archive.h" | ||
#include "llvm/Object/IRObjectFile.h" | ||
#include "llvm/Object/MachOUniversal.h" | ||
#include "llvm/Object/ObjectFile.h" | ||
#include "llvm/Support/MemoryBuffer.h" | ||
|
@@ -29,7 +30,9 @@ namespace logicalview { | |
|
||
using LVReaders = std::vector<std::unique_ptr<LVReader>>; | ||
using ArgVector = std::vector<std::string>; | ||
using PdbOrObj = PointerUnion<object::ObjectFile *, pdb::PDBFile *>; | ||
using PdbOrObjOrIr = | ||
PointerUnion<object::ObjectFile *, pdb::PDBFile *, object::IRObjectFile *, | ||
MemoryBufferRef *, StringRef *>; | ||
Comment on lines
+33
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel we should be able to invent a more symbolic name for this type -- something like "InputHandle" perhaps? That communicates more about the purpose of the type than just a list of types it might be. |
||
|
||
// This class performs the following tasks: | ||
// - Creates a logical reader for every binary file in the command line, | ||
|
@@ -60,9 +63,12 @@ class LVReaderHandler { | |
object::Binary &Binary); | ||
Error handleObject(LVReaders &Readers, StringRef Filename, StringRef Buffer, | ||
StringRef ExePath); | ||
Error handleObject(LVReaders &Readers, StringRef Filename, | ||
MemoryBufferRef Buffer); | ||
|
||
Error createReader(StringRef Filename, LVReaders &Readers, PdbOrObj &Input, | ||
StringRef FileFormatName, StringRef ExePath = {}); | ||
Error createReader(StringRef Filename, LVReaders &Readers, | ||
PdbOrObjOrIr &Input, StringRef FileFormatName, | ||
StringRef ExePath = {}); | ||
|
||
public: | ||
LVReaderHandler() = delete; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there's a more illustrative example to motivate the reader -- is it possible to search for "INTPTR" and discover both the type alias and the parameter? That's the sort of query I think I'd end up making: "I can see this type in the output format, but why is it present? -> Ah, it's a parameter to a function".
(The current example is fine, I'm just trying to imagine a better one).