diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
commit | ef5d0b5e97ec8e6fa395d377b09aa7755e345b4f (patch) | |
tree | 27916256fdeeb57d10d2f3d6948be5d71a703215 /source/Commands/CommandObjectTarget.cpp | |
parent | 76e0736e7fcfeb179779e49c05604464b1ccd704 (diff) |
Notes
Diffstat (limited to 'source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | source/Commands/CommandObjectTarget.cpp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp index a80acf19be2d..c83061d8de74 100644 --- a/source/Commands/CommandObjectTarget.cpp +++ b/source/Commands/CommandObjectTarget.cpp @@ -52,6 +52,7 @@ #include "lldb/Utility/Timer.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/FormatAdapters.h" // C Includes // C++ Includes @@ -135,25 +136,6 @@ static uint32_t DumpTargetList(TargetList &target_list, return num_targets; } -// TODO: Remove this once llvm can pretty-print time points -static void DumpTimePoint(llvm::sys::TimePoint<> tp, Stream &s, uint32_t width) { -#ifndef LLDB_DISABLE_POSIX - char time_buf[32]; - time_t time = llvm::sys::toTimeT(tp); - char *time_cstr = ::ctime_r(&time, time_buf); - if (time_cstr) { - char *newline = ::strpbrk(time_cstr, "\n\r"); - if (newline) - *newline = '\0'; - if (width > 0) - s.Printf("%-*s", width, time_cstr); - else - s.PutCString(time_cstr); - } else if (width > 0) - s.Printf("%-*s", width, ""); -#endif -} - #pragma mark CommandObjectTargetCreate //------------------------------------------------------------------------- @@ -2053,6 +2035,8 @@ protected: result.GetOutputStream().EOL(); result.GetOutputStream().EOL(); } + if (m_interpreter.WasInterrupted()) + break; num_dumped++; DumpModuleSymtab( m_interpreter, result.GetOutputStream(), @@ -2081,6 +2065,8 @@ protected: result.GetOutputStream().EOL(); result.GetOutputStream().EOL(); } + if (m_interpreter.WasInterrupted()) + break; num_dumped++; DumpModuleSymtab(m_interpreter, result.GetOutputStream(), module, m_options.m_sort_order); @@ -2146,6 +2132,8 @@ protected: " modules.\n", (uint64_t)num_modules); for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) { + if (m_interpreter.WasInterrupted()) + break; num_dumped++; DumpModuleSections( m_interpreter, result.GetOutputStream(), @@ -2167,6 +2155,8 @@ protected: FindModulesByName(target, arg_cstr, module_list, true); if (num_matches > 0) { for (size_t i = 0; i < num_matches; ++i) { + if (m_interpreter.WasInterrupted()) + break; Module *module = module_list.GetModulePointerAtIndex(i); if (module) { num_dumped++; @@ -2239,6 +2229,8 @@ protected: " modules.\n", (uint64_t)num_modules); for (uint32_t image_idx = 0; image_idx < num_modules; ++image_idx) { + if (m_interpreter.WasInterrupted()) + break; if (DumpModuleSymbolVendor( result.GetOutputStream(), target_modules.GetModulePointerAtIndexUnlocked(image_idx))) @@ -2260,6 +2252,8 @@ protected: FindModulesByName(target, arg_cstr, module_list, true); if (num_matches > 0) { for (size_t i = 0; i < num_matches; ++i) { + if (m_interpreter.WasInterrupted()) + break; Module *module = module_list.GetModulePointerAtIndex(i); if (module) { if (DumpModuleSymbolVendor(result.GetOutputStream(), module)) @@ -2327,6 +2321,8 @@ protected: if (num_modules > 0) { uint32_t num_dumped = 0; for (uint32_t i = 0; i < num_modules; ++i) { + if (m_interpreter.WasInterrupted()) + break; if (DumpCompileUnitLineTable( m_interpreter, result.GetOutputStream(), target_modules.GetModulePointerAtIndexUnlocked(i), @@ -2572,7 +2568,7 @@ public: "Fullpath or basename for module to load.", ""), m_load_option(LLDB_OPT_SET_1, false, "load", 'l', "Write file contents to the memory.", false, true), - m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p', + m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p', "Set PC to the entry point." " Only applicable with '--load' option.", false, true), @@ -3162,7 +3158,8 @@ protected: } break; case 'm': - DumpTimePoint(module->GetModificationTime(), strm, width); + strm.Format("{0:%c}", llvm::fmt_align(module->GetModificationTime(), + llvm::AlignStyle::Left, width)); break; case 'p': @@ -3969,7 +3966,8 @@ public: "Add a debug symbol file to one of the target's current modules by " "specifying a path to a debug symbols file, or using the options " "to specify a module to download symbols for.", - "target symbols add [<symfile>]", eCommandRequiresTarget), + "target symbols add <cmd-options> [<symfile>]", + eCommandRequiresTarget), m_option_group(), m_file_option( LLDB_OPT_SET_1, false, "shlib", 's', @@ -4289,18 +4287,22 @@ protected: if (uuid_option_set) { result.AppendError("specify either one or more paths to symbol files " "or use the --uuid option without arguments"); - } else if (file_option_set) { - result.AppendError("specify either one or more paths to symbol files " - "or use the --file option without arguments"); } else if (frame_option_set) { result.AppendError("specify either one or more paths to symbol files " "or use the --frame option without arguments"); + } else if (file_option_set && argc > 1) { + result.AppendError("specify at most one symbol file path when " + "--shlib option is set"); } else { PlatformSP platform_sp(target->GetPlatform()); for (auto &entry : args.entries()) { if (!entry.ref.empty()) { module_spec.GetSymbolFileSpec().SetFile(entry.ref, true); + if (file_option_set) { + module_spec.GetFileSpec() = + m_file_option.GetOptionValue().GetCurrentValue(); + } if (platform_sp) { FileSpec symfile_spec; if (platform_sp |