[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#145081)
This is the culmination of a series of changes described in [1].
Although somewhat large by line count, it is almost entirely mechanical,
creating a new library in DebugInfo/DWARF/LowLevel. This new library has
very minimal dependencies, allowing it to be used from more places than
the normal DebugInfo/DWARF library--in particular from MC.
I am happy to put it in another location, or to structure it differently
if that makes sense. Some have suggested in BinaryFormat, but it is not
a great fit there. But if that makes more sense to the reviewers, I can
do that.
Another possibility would be to use pass-through headers to allow
clients who don't care to depend only on DebugInfo/DWARF. This would be
a much less invasive change, and perhaps easier for clients. But also a
system that hides details.
Either way, I'm open.
1.
https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
This commit is contained in:
committed by
GitHub
parent
f2991bf791
commit
cbf781f0bd
@@ -36,7 +36,8 @@
|
||||
#include "lldb/Target/StackID.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Target/Thread.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
|
||||
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
@@ -81,7 +82,7 @@ void DWARFExpression::DumpLocation(Stream *s, lldb::DescriptionLevel level,
|
||||
llvm::DIDumpOptions DumpOpts;
|
||||
DumpOpts.GetNameForDWARFReg = GetRegName;
|
||||
llvm::DWARFExpression E(m_data.GetAsLLVM(), m_data.GetAddressByteSize());
|
||||
llvm::DWARFExpressionPrinter::print(&E, s->AsRawOstream(), DumpOpts, nullptr);
|
||||
llvm::printDwarfExpression(&E, s->AsRawOstream(), DumpOpts, nullptr);
|
||||
}
|
||||
|
||||
RegisterKind DWARFExpression::GetRegisterKind() const { return m_reg_kind; }
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
#include "lldb/Utility/Log.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
|
||||
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace lldb;
|
||||
@@ -89,8 +90,7 @@ static void DumpDWARFExpr(Stream &s, llvm::ArrayRef<uint8_t> expr, Thread *threa
|
||||
order_and_width->second);
|
||||
llvm::DWARFExpression E(data, order_and_width->second,
|
||||
llvm::dwarf::DWARF32);
|
||||
llvm::DWARFExpressionPrinter::print(&E, s.AsRawOstream(),
|
||||
llvm::DIDumpOptions(), nullptr);
|
||||
printDwarfExpression(&E, s.AsRawOstream(), llvm::DIDumpOptions(), nullptr);
|
||||
} else
|
||||
s.PutCString("dwarf-expr");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user