[llvm] [llvm-objdump] Add inlined function display support (PR #142246)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 18:13:14 PDT 2025
================
@@ -22,60 +23,108 @@
namespace llvm {
namespace objdump {
+/// Base class for representing the location of a source-level variable or
+/// an inlined function.
+class LiveElement {
+protected:
+ const char *Name;
+ DWARFUnit *Unit;
+ const DWARFDie FuncDie;
+
+public:
+ LiveElement(const char *Name, DWARFUnit *Unit, const DWARFDie FuncDie)
+ : Name(Name), Unit(Unit), FuncDie(FuncDie) {}
+
+ virtual ~LiveElement() {};
+ const char *getName() const { return Name; }
+ DWARFUnit *getDwarfUnit() const { return Unit; }
+ const DWARFDie getFuncDie() const { return FuncDie; }
+
+ virtual bool liveAtAddress(object::SectionedAddress Addr) = 0;
+ virtual void print(raw_ostream &OS, const MCRegisterInfo &MRI) const = 0;
+ virtual void dump(raw_ostream &OS) const = 0;
+ virtual void printElementLine(raw_ostream &OS,
+ object::SectionedAddress Address,
+ bool IsEnd) const {}
+};
+
+class InlinedFunction : public LiveElement {
+ DWARFDie InlinedFuncDie;
+ DWARFAddressRange Range;
+
+public:
+ InlinedFunction(const char *FunctionName, DWARFUnit *Unit,
+ const DWARFDie FuncDie, const DWARFDie InlinedFuncDie,
+ DWARFAddressRange &Range)
+ : LiveElement(FunctionName, Unit, FuncDie),
+ InlinedFuncDie(InlinedFuncDie), Range(Range) {}
+
+ virtual ~InlinedFunction() {}
+ virtual bool liveAtAddress(object::SectionedAddress Addr) override;
+ virtual void print(raw_ostream &OS, const MCRegisterInfo &MRI) const override;
+ virtual void dump(raw_ostream &OS) const override;
+ virtual void printElementLine(raw_ostream &OS,
+ object::SectionedAddress Address,
+ bool IsEnd) const override;
+};
+
/// Stores a single expression representing the location of a source-level
/// variable, along with the PC range for which that expression is valid.
-struct LiveVariable {
+class LiveVariable : public LiveElement {
DWARFLocationExpression LocExpr;
- const char *VarName;
- DWARFUnit *Unit;
- const DWARFDie FuncDie;
+public:
LiveVariable(const DWARFLocationExpression &LocExpr, const char *VarName,
DWARFUnit *Unit, const DWARFDie FuncDie)
- : LocExpr(LocExpr), VarName(VarName), Unit(Unit), FuncDie(FuncDie) {}
+ : LiveElement(VarName, Unit, FuncDie), LocExpr(LocExpr) {}
- bool liveAtAddress(object::SectionedAddress Addr);
-
- void print(raw_ostream &OS, const MCRegisterInfo &MRI) const;
+ virtual ~LiveVariable() {}
----------------
gulfemsavrun wrote:
Done.
https://github.com/llvm/llvm-project/pull/142246
More information about the llvm-commits
mailing list