diff options
author | Aaron Smith <aaron.smith@microsoft.com> | 2018-12-06 21:36:39 +0000 |
---|---|---|
committer | Aaron Smith <aaron.smith@microsoft.com> | 2018-12-06 21:36:39 +0000 |
commit | 93f281d789db9a99dd566e5c00e417e1efbba845 (patch) | |
tree | ab053e6858e2559cb9fe74dbc9f4119916e26f5e /lldb/tools | |
parent | cd6774859ae9c5760b6543743fb2847d550f9e8a (diff) |
[pecoff] Implement ObjectFilePECOFF::GetDependedModules()
Summary:
This parses entries in pecoff import tables for imported DLLs and
is intended as the first step to allow LLDB to load a PE's shared
modules when creating a target on the LLDB console.
Reviewers: rnk, zturner, aleksandr.urakov, lldb-commits, labath, asmith
Reviewed By: labath, asmith
Subscribers: labath, lemo, clayborg, Hui, mgorny, mgrang, teemperor
Differential Revision: https://reviews.llvm.org/D53094
Diffstat (limited to 'lldb/tools')
-rw-r--r-- | lldb/tools/lldb-test/lldb-test.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp index 25ee16886e5..42eb5642f97 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -90,6 +90,9 @@ namespace object { cl::opt<bool> SectionContents("contents", cl::desc("Dump each section's contents"), cl::sub(ObjectFileSubcommand)); +cl::opt<bool> SectionDependentModules("dep-modules", + cl::desc("Dump each dependent module"), + cl::sub(ObjectFileSubcommand)); cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input files>"), cl::OneOrMore, cl::sub(ObjectFileSubcommand)); @@ -612,8 +615,7 @@ Expected<Error (*)(lldb_private::Module &)> opts::symbols::getAction() { if (DumpAST) { if (Find != FindType::None) - return make_string_error( - "Cannot both search and dump AST."); + return make_string_error("Cannot both search and dump AST."); if (Regex || !Context.empty() || !Name.empty() || !File.empty() || Line != 0) return make_string_error( @@ -758,6 +760,20 @@ static int dumpObjectFiles(Debugger &Dbg) { } Printer.NewLine(); } + + if (opts::object::SectionDependentModules) { + // A non-empty section list ensures a valid object file. + auto Obj = ModulePtr->GetObjectFile(); + FileSpecList Files; + auto Count = Obj->GetDependentModules(Files); + Printer.formatLine("Showing {0} dependent module(s)", Count); + for (size_t I = 0; I < Files.GetSize(); ++I) { + AutoIndent Indent(Printer, 2); + Printer.formatLine("Name: {0}", + Files.GetFileSpecAtIndex(I).GetCString()); + } + Printer.NewLine(); + } } return HadErrors; } @@ -832,8 +848,8 @@ bool opts::irmemorymap::evalMalloc(StringRef Line, ++Probe; } - // Insert the new allocation into the interval map. Use unique allocation IDs - // to inhibit interval coalescing. + // Insert the new allocation into the interval map. Use unique allocation + // IDs to inhibit interval coalescing. static unsigned AllocationID = 0; if (Size) State.Allocations.insert(Addr, EndOfRegion, AllocationID++); |