jasonmolenda created this revision. jasonmolenda added a reviewer: mib. jasonmolenda added a project: LLDB. Herald added a subscriber: JDevlieghere. Herald added a project: All. jasonmolenda requested review of this revision. Herald added a subscriber: lldb-commits.
When debugging possible issues with the Target's SectionLoadList table, it would be helpful to have a way to dump all of the entries. Add that. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D154169 Files: lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Target/SectionLoadList.cpp Index: lldb/source/Target/SectionLoadList.cpp =================================================================== --- lldb/source/Target/SectionLoadList.cpp +++ lldb/source/Target/SectionLoadList.cpp @@ -262,8 +262,7 @@ addr_to_sect_collection::const_iterator pos, end; for (pos = m_addr_to_sect.begin(), end = m_addr_to_sect.end(); pos != end; ++pos) { - s.Printf("addr = 0x%16.16" PRIx64 ", section = %p: ", pos->first, - static_cast<void *>(pos->second.get())); + s.Printf("addr = 0x%16.16" PRIx64 " ", pos->first); pos->second->Dump(s.AsRawOstream(), s.GetIndentLevel(), target, 0); } } Index: lldb/source/Commands/CommandObjectTarget.cpp =================================================================== --- lldb/source/Commands/CommandObjectTarget.cpp +++ lldb/source/Commands/CommandObjectTarget.cpp @@ -5123,6 +5123,30 @@ } }; +#pragma mark CommandObjectTargetDumpSectionLoadList + +/// Dumps the SectionLoadList of the selected Target. +class CommandObjectTargetDumpSectionLoadList : public CommandObjectParsed { +public: + CommandObjectTargetDumpSectionLoadList(CommandInterpreter &interpreter) + : CommandObjectParsed( + interpreter, "target dump section-load-list", + "Dump the state of the target's internal section load list. " + "Intended to be used for debugging LLDB itself.", + nullptr, eCommandRequiresTarget) {} + + ~CommandObjectTargetDumpSectionLoadList() override = default; + +protected: + bool DoExecute(Args &command, CommandReturnObject &result) override { + Target &target = GetSelectedTarget(); + target.GetSectionLoadList().Dump(result.GetOutputStream(), &target); + result.SetStatus(eReturnStatusSuccessFinishResult); + return result.Succeeded(); + } +}; + + #pragma mark CommandObjectTargetDump /// Multi-word command for 'target dump'. @@ -5133,10 +5157,13 @@ : CommandObjectMultiword( interpreter, "target dump", "Commands for dumping information about the target.", - "target dump [typesystem]") { + "target dump [typesystem|section-load-list]") { LoadSubCommand( "typesystem", CommandObjectSP(new CommandObjectTargetDumpTypesystem(interpreter))); + LoadSubCommand( + "section-load-list", + CommandObjectSP(new CommandObjectTargetDumpSectionLoadList(interpreter))); } ~CommandObjectTargetDump() override = default;
Index: lldb/source/Target/SectionLoadList.cpp =================================================================== --- lldb/source/Target/SectionLoadList.cpp +++ lldb/source/Target/SectionLoadList.cpp @@ -262,8 +262,7 @@ addr_to_sect_collection::const_iterator pos, end; for (pos = m_addr_to_sect.begin(), end = m_addr_to_sect.end(); pos != end; ++pos) { - s.Printf("addr = 0x%16.16" PRIx64 ", section = %p: ", pos->first, - static_cast<void *>(pos->second.get())); + s.Printf("addr = 0x%16.16" PRIx64 " ", pos->first); pos->second->Dump(s.AsRawOstream(), s.GetIndentLevel(), target, 0); } } Index: lldb/source/Commands/CommandObjectTarget.cpp =================================================================== --- lldb/source/Commands/CommandObjectTarget.cpp +++ lldb/source/Commands/CommandObjectTarget.cpp @@ -5123,6 +5123,30 @@ } }; +#pragma mark CommandObjectTargetDumpSectionLoadList + +/// Dumps the SectionLoadList of the selected Target. +class CommandObjectTargetDumpSectionLoadList : public CommandObjectParsed { +public: + CommandObjectTargetDumpSectionLoadList(CommandInterpreter &interpreter) + : CommandObjectParsed( + interpreter, "target dump section-load-list", + "Dump the state of the target's internal section load list. " + "Intended to be used for debugging LLDB itself.", + nullptr, eCommandRequiresTarget) {} + + ~CommandObjectTargetDumpSectionLoadList() override = default; + +protected: + bool DoExecute(Args &command, CommandReturnObject &result) override { + Target &target = GetSelectedTarget(); + target.GetSectionLoadList().Dump(result.GetOutputStream(), &target); + result.SetStatus(eReturnStatusSuccessFinishResult); + return result.Succeeded(); + } +}; + + #pragma mark CommandObjectTargetDump /// Multi-word command for 'target dump'. @@ -5133,10 +5157,13 @@ : CommandObjectMultiword( interpreter, "target dump", "Commands for dumping information about the target.", - "target dump [typesystem]") { + "target dump [typesystem|section-load-list]") { LoadSubCommand( "typesystem", CommandObjectSP(new CommandObjectTargetDumpTypesystem(interpreter))); + LoadSubCommand( + "section-load-list", + CommandObjectSP(new CommandObjectTargetDumpSectionLoadList(interpreter))); } ~CommandObjectTargetDump() override = default;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits