diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Commands/CommandObjectTarget.cpp | 332 |
1 files changed, 156 insertions, 176 deletions
diff --git a/contrib/llvm/tools/lldb/source/Commands/CommandObjectTarget.cpp b/contrib/llvm/tools/lldb/source/Commands/CommandObjectTarget.cpp index 448da0e..026ae35 100644 --- a/contrib/llvm/tools/lldb/source/Commands/CommandObjectTarget.cpp +++ b/contrib/llvm/tools/lldb/source/Commands/CommandObjectTarget.cpp @@ -79,7 +79,8 @@ DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bo uint32_t properties = 0; if (target_arch.IsValid()) { - strm.Printf ("%sarch=%s", properties++ > 0 ? ", " : " ( ", target_arch.GetTriple().str().c_str()); + strm.Printf ("%sarch=", properties++ > 0 ? ", " : " ( "); + target_arch.DumpTriple (strm); properties++; } PlatformSP platform_sp (target->GetPlatform()); @@ -187,17 +188,17 @@ public: m_option_group.Finalize(); } - ~CommandObjectTargetCreate () + ~CommandObjectTargetCreate () override { } Options * - GetOptions () + GetOptions () override { return &m_option_group; } - virtual int + int HandleArgumentCompletion (Args &input, int &cursor_index, int &cursor_char_position, @@ -205,7 +206,7 @@ public: int match_start_point, int max_return_elements, bool &word_complete, - StringList &matches) + StringList &matches) override { std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); @@ -223,7 +224,7 @@ public: protected: bool - DoExecute (Args& command, CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { const size_t argc = command.GetArgumentCount(); FileSpec core_file (m_core_file.GetOptionValue().GetCurrentValue()); @@ -255,7 +256,7 @@ protected: { if (!symfile.Readable()) { - result.AppendErrorWithFormat("symbol file '%s' is not readable", core_file.GetPath().c_str()); + result.AppendErrorWithFormat("symbol file '%s' is not readable", symfile.GetPath().c_str()); result.SetStatus (eReturnStatusFailed); return false; } @@ -401,7 +402,7 @@ protected: if (process_sp) { - // Seems wierd that we Launch a core file, but that is + // Seems weird that we Launch a core file, but that is // what we do! error = process_sp->LoadCore(); @@ -477,14 +478,13 @@ public: { } - virtual - ~CommandObjectTargetList () + ~CommandObjectTargetList () override { } protected: - virtual bool - DoExecute (Args& args, CommandReturnObject &result) + bool + DoExecute (Args& args, CommandReturnObject &result) override { if (args.GetArgumentCount() == 0) { @@ -525,14 +525,13 @@ public: { } - virtual - ~CommandObjectTargetSelect () + ~CommandObjectTargetSelect () override { } protected: - virtual bool - DoExecute (Args& args, CommandReturnObject &result) + bool + DoExecute (Args& args, CommandReturnObject &result) override { if (args.GetArgumentCount() == 1) { @@ -622,20 +621,19 @@ public: m_option_group.Finalize(); } - virtual - ~CommandObjectTargetDelete () + ~CommandObjectTargetDelete () override { } Options * - GetOptions () + GetOptions () override { return &m_option_group; } protected: - virtual bool - DoExecute (Args& args, CommandReturnObject &result) + bool + DoExecute (Args& args, CommandReturnObject &result) override { const size_t argc = args.GetArgumentCount(); std::vector<TargetSP> delete_target_list; @@ -777,8 +775,7 @@ public: m_option_group.Finalize(); } - virtual - ~CommandObjectTargetVariable () + ~CommandObjectTargetVariable () override { } @@ -850,7 +847,7 @@ public: } Options * - GetOptions () + GetOptions () override { return &m_option_group; } @@ -896,8 +893,8 @@ protected: } } - virtual bool - DoExecute (Args& args, CommandReturnObject &result) + bool + DoExecute (Args& args, CommandReturnObject &result) override { Target *target = m_exe_ctx.GetTargetPtr(); const size_t argc = args.GetArgumentCount(); @@ -1134,14 +1131,13 @@ public: m_arguments.push_back (arg); } - ~CommandObjectTargetModulesSearchPathsAdd () + ~CommandObjectTargetModulesSearchPathsAdd () override { } protected: bool - DoExecute (Args& command, - CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target) @@ -1161,6 +1157,12 @@ protected: if (from[0] && to[0]) { + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); + if (log) + { + log->Printf ("target modules search path adding ImageSearchPath pair: '%s' -> '%s'", + from, to); + } bool last_pair = ((argc - i) == 2); target->GetImageSearchPathList().Append (ConstString(from), ConstString(to), @@ -1201,14 +1203,13 @@ public: { } - ~CommandObjectTargetModulesSearchPathsClear () + ~CommandObjectTargetModulesSearchPathsClear () override { } protected: bool - DoExecute (Args& command, - CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target) @@ -1271,20 +1272,19 @@ public: m_arguments.push_back (arg2); } - ~CommandObjectTargetModulesSearchPathsInsert () + ~CommandObjectTargetModulesSearchPathsInsert () override { } protected: bool - DoExecute (Args& command, - CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target) { size_t argc = command.GetArgumentCount(); - // check for at least 3 arguments and an odd nubmer of parameters + // check for at least 3 arguments and an odd number of parameters if (argc >= 3 && argc & 1) { bool success = false; @@ -1360,14 +1360,13 @@ public: { } - ~CommandObjectTargetModulesSearchPathsList () + ~CommandObjectTargetModulesSearchPathsList () override { } protected: bool - DoExecute (Args& command, - CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target) @@ -1417,14 +1416,13 @@ public: m_arguments.push_back (arg); } - ~CommandObjectTargetModulesSearchPathsQuery () + ~CommandObjectTargetModulesSearchPathsQuery () override { } protected: bool - DoExecute (Args& command, - CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target) @@ -1462,15 +1460,18 @@ DumpModuleArchitecture (Stream &strm, Module *module, bool full_triple, uint32_t { if (module) { - const char *arch_cstr; + StreamString arch_strm; + if (full_triple) - arch_cstr = module->GetArchitecture().GetTriple().str().c_str(); + module->GetArchitecture().DumpTriple(arch_strm); else - arch_cstr = module->GetArchitecture().GetArchitectureName(); + arch_strm.PutCString(module->GetArchitecture().GetArchitectureName()); + std::string arch_str = arch_strm.GetString(); + if (width) - strm.Printf("%-*s", width, arch_cstr); + strm.Printf("%-*s", width, arch_str.c_str()); else - strm.PutCString(arch_cstr); + strm.PutCString(arch_str.c_str()); } } @@ -1865,7 +1866,7 @@ LookupTypeInModule (CommandInterpreter &interpreter, { // Resolve the clang type so that any forward references // to types that haven't yet been parsed will get parsed. - type_sp->GetClangFullType (); + type_sp->GetFullCompilerType (); type_sp->GetDescription (&strm, eDescriptionLevelFull, true); // Print all typedef chains TypeSP typedef_type_sp (type_sp); @@ -1874,7 +1875,7 @@ LookupTypeInModule (CommandInterpreter &interpreter, { strm.EOL(); strm.Printf(" typedef '%s': ", typedef_type_sp->GetName().GetCString()); - typedefed_type_sp->GetClangFullType (); + typedefed_type_sp->GetFullCompilerType (); typedefed_type_sp->GetDescription (&strm, eDescriptionLevelFull, true); typedef_type_sp = typedefed_type_sp; typedefed_type_sp = typedef_type_sp->GetTypedefType(); @@ -1918,7 +1919,7 @@ LookupTypeHere (CommandInterpreter &interpreter, { // Resolve the clang type so that any forward references // to types that haven't yet been parsed will get parsed. - type_sp->GetClangFullType (); + type_sp->GetFullCompilerType (); type_sp->GetDescription (&strm, eDescriptionLevelFull, true); // Print all typedef chains TypeSP typedef_type_sp (type_sp); @@ -1927,7 +1928,7 @@ LookupTypeHere (CommandInterpreter &interpreter, { strm.EOL(); strm.Printf(" typedef '%s': ", typedef_type_sp->GetName().GetCString()); - typedefed_type_sp->GetClangFullType (); + typedefed_type_sp->GetFullCompilerType (); typedefed_type_sp->GetDescription (&strm, eDescriptionLevelFull, true); typedef_type_sp = typedefed_type_sp; typedefed_type_sp = typedef_type_sp->GetTypedefType(); @@ -2056,12 +2057,11 @@ public: m_arguments.push_back (arg); } - virtual - ~CommandObjectTargetModulesModuleAutoComplete () + ~CommandObjectTargetModulesModuleAutoComplete () override { } - virtual int + int HandleArgumentCompletion (Args &input, int &cursor_index, int &cursor_char_position, @@ -2069,7 +2069,7 @@ public: int match_start_point, int max_return_elements, bool &word_complete, - StringList &matches) + StringList &matches) override { // Arguments are the standard module completer. std::string completion_str (input.GetArgumentAtIndex(cursor_index)); @@ -2118,12 +2118,11 @@ public: m_arguments.push_back (arg); } - virtual - ~CommandObjectTargetModulesSourceFileAutoComplete () + ~CommandObjectTargetModulesSourceFileAutoComplete () override { } - virtual int + int HandleArgumentCompletion (Args &input, int &cursor_index, int &cursor_char_position, @@ -2131,7 +2130,7 @@ public: int match_start_point, int max_return_elements, bool &word_complete, - StringList &matches) + StringList &matches) override { // Arguments are the standard source file completer. std::string completion_str (input.GetArgumentAtIndex(cursor_index)); @@ -2165,13 +2164,12 @@ public: { } - virtual - ~CommandObjectTargetModulesDumpSymtab () + ~CommandObjectTargetModulesDumpSymtab () override { } - virtual Options * - GetOptions () + Options * + GetOptions () override { return &m_options; } @@ -2185,13 +2183,12 @@ public: { } - virtual - ~CommandOptions () + ~CommandOptions () override { } - virtual Error - SetOptionValue (uint32_t option_idx, const char *option_arg) + Error + SetOptionValue (uint32_t option_idx, const char *option_arg) override { Error error; const int short_option = m_getopt_table[option_idx].val; @@ -2214,13 +2211,13 @@ public: } void - OptionParsingStarting () + OptionParsingStarting () override { m_sort_order = eSortOrderNone; } const OptionDefinition* - GetDefinitions () + GetDefinitions () override { return g_option_table; } @@ -2232,9 +2229,8 @@ public: }; protected: - virtual bool - DoExecute (Args& command, - CommandReturnObject &result) + bool + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) @@ -2359,15 +2355,13 @@ public: { } - virtual - ~CommandObjectTargetModulesDumpSections () + ~CommandObjectTargetModulesDumpSections () override { } protected: - virtual bool - DoExecute (Args& command, - CommandReturnObject &result) + bool + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) @@ -2465,15 +2459,13 @@ public: { } - virtual - ~CommandObjectTargetModulesDumpSymfile () + ~CommandObjectTargetModulesDumpSymfile () override { } protected: - virtual bool - DoExecute (Args& command, - CommandReturnObject &result) + bool + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) @@ -2568,15 +2560,13 @@ public: { } - virtual - ~CommandObjectTargetModulesDumpLineTable () + ~CommandObjectTargetModulesDumpLineTable () override { } protected: - virtual bool - DoExecute (Args& command, - CommandReturnObject &result) + bool + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_exe_ctx.GetTargetPtr(); uint32_t total_num_dumped = 0; @@ -2657,8 +2647,7 @@ public: LoadSubCommand ("line-table", CommandObjectSP (new CommandObjectTargetModulesDumpLineTable (interpreter))); } - virtual - ~CommandObjectTargetModulesDump() + ~CommandObjectTargetModulesDump() override { } }; @@ -2679,18 +2668,17 @@ public: m_option_group.Finalize(); } - virtual - ~CommandObjectTargetModulesAdd () + ~CommandObjectTargetModulesAdd () override { } - virtual Options * - GetOptions () + Options * + GetOptions () override { return &m_option_group; } - virtual int + int HandleArgumentCompletion (Args &input, int &cursor_index, int &cursor_char_position, @@ -2698,7 +2686,7 @@ public: int match_start_point, int max_return_elements, bool &word_complete, - StringList &matches) + StringList &matches) override { std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); @@ -2719,9 +2707,8 @@ protected: OptionGroupUUID m_uuid_option_group; OptionGroupFile m_symbol_file; - virtual bool - DoExecute (Args& args, - CommandReturnObject &result) + bool + DoExecute (Args& args, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) @@ -2882,21 +2869,19 @@ public: m_option_group.Finalize(); } - virtual - ~CommandObjectTargetModulesLoad () + ~CommandObjectTargetModulesLoad () override { } - virtual Options * - GetOptions () + Options * + GetOptions () override { return &m_option_group; } protected: - virtual bool - DoExecute (Args& args, - CommandReturnObject &result) + bool + DoExecute (Args& args, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) @@ -3139,13 +3124,12 @@ public: { } - virtual - ~CommandOptions () + ~CommandOptions () override { } - virtual Error - SetOptionValue (uint32_t option_idx, const char *option_arg) + Error + SetOptionValue (uint32_t option_idx, const char *option_arg) override { Error error; @@ -3170,7 +3154,7 @@ public: } void - OptionParsingStarting () + OptionParsingStarting () override { m_format_array.clear(); m_use_global_module_list = false; @@ -3178,7 +3162,7 @@ public: } const OptionDefinition* - GetDefinitions () + GetDefinitions () override { return g_option_table; } @@ -3203,22 +3187,19 @@ public: { } - virtual - ~CommandObjectTargetModulesList () + ~CommandObjectTargetModulesList () override { } - virtual Options * - GetOptions () + GetOptions () override { return &m_options; } protected: - virtual bool - DoExecute (Args& command, - CommandReturnObject &result) + bool + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); const bool use_global_module_list = m_options.m_use_global_module_list; @@ -3584,13 +3565,12 @@ public: { } - virtual - ~CommandOptions () + ~CommandOptions () override { } - virtual Error - SetOptionValue (uint32_t option_idx, const char *option_arg) + Error + SetOptionValue (uint32_t option_idx, const char *option_arg) override { Error error; @@ -3625,7 +3605,7 @@ public: } void - OptionParsingStarting () + OptionParsingStarting () override { m_type = eLookupTypeInvalid; m_str.clear(); @@ -3633,7 +3613,7 @@ public: } const OptionDefinition* - GetDefinitions () + GetDefinitions () override { return g_option_table; } @@ -3662,22 +3642,19 @@ public: { } - virtual - ~CommandObjectTargetModulesShowUnwind () + ~CommandObjectTargetModulesShowUnwind () override { } - virtual Options * - GetOptions () + GetOptions () override { return &m_options; } protected: bool - DoExecute (Args& command, - CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_exe_ctx.GetTargetPtr(); Process *process = m_exe_ctx.GetProcessPtr(); @@ -3813,6 +3790,14 @@ protected: result.GetOutputStream().Printf("\n"); } + UnwindPlanSP arm_unwind_sp = func_unwinders_sp->GetArmUnwindUnwindPlan(*target, 0); + if (arm_unwind_sp) + { + result.GetOutputStream().Printf("ARM.exidx unwind UnwindPlan:\n"); + arm_unwind_sp->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS); + result.GetOutputStream().Printf("\n"); + } + UnwindPlanSP compact_unwind_sp = func_unwinders_sp->GetCompactUnwindUnwindPlan(*target, 0); if (compact_unwind_sp) { @@ -3891,13 +3876,12 @@ public: OptionParsingStarting(); } - virtual - ~CommandOptions () + ~CommandOptions () override { } - virtual Error - SetOptionValue (uint32_t option_idx, const char *option_arg) + Error + SetOptionValue (uint32_t option_idx, const char *option_arg) override { Error error; @@ -3974,7 +3958,7 @@ public: } void - OptionParsingStarting () + OptionParsingStarting () override { m_type = eLookupTypeInvalid; m_str.clear(); @@ -3989,7 +3973,7 @@ public: } const OptionDefinition* - GetDefinitions () + GetDefinitions () override { return g_option_table; } @@ -4031,13 +4015,12 @@ public: m_arguments.push_back (arg); } - virtual - ~CommandObjectTargetModulesLookup () + ~CommandObjectTargetModulesLookup () override { } - virtual Options * - GetOptions () + Options * + GetOptions () override { return &m_options; } @@ -4191,9 +4174,8 @@ public: } protected: - virtual bool - DoExecute (Args& command, - CommandReturnObject &result) + bool + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); if (target == NULL) @@ -4339,7 +4321,7 @@ public: LoadSubCommand ("query", CommandObjectSP (new CommandObjectTargetModulesSearchPathsQuery (interpreter))); } - ~CommandObjectTargetModulesImageSearchPaths() + ~CommandObjectTargetModulesImageSearchPaths() override { } }; @@ -4373,8 +4355,8 @@ public: LoadSubCommand ("show-unwind", CommandObjectSP (new CommandObjectTargetModulesShowUnwind (interpreter))); } - virtual - ~CommandObjectTargetModules() + + ~CommandObjectTargetModules() override { } @@ -4406,12 +4388,11 @@ public: m_option_group.Finalize(); } - virtual - ~CommandObjectTargetSymbolsAdd () + ~CommandObjectTargetSymbolsAdd () override { } - virtual int + int HandleArgumentCompletion (Args &input, int &cursor_index, int &cursor_char_position, @@ -4419,7 +4400,7 @@ public: int match_start_point, int max_return_elements, bool &word_complete, - StringList &matches) + StringList &matches) override { std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); @@ -4435,8 +4416,8 @@ public: return matches.GetSize(); } - virtual Options * - GetOptions () + Options * + GetOptions () override { return &m_option_group; } @@ -4614,9 +4595,8 @@ protected: return false; } - virtual bool - DoExecute (Args& args, - CommandReturnObject &result) + bool + DoExecute (Args& args, CommandReturnObject &result) override { Target *target = m_exe_ctx.GetTargetPtr(); result.SetStatus (eReturnStatusFailed); @@ -4834,8 +4814,8 @@ public: LoadSubCommand ("add", CommandObjectSP (new CommandObjectTargetSymbolsAdd (interpreter))); } - virtual - ~CommandObjectTargetSymbols() + + ~CommandObjectTargetSymbols() override { } @@ -4874,16 +4854,16 @@ public: { } - ~CommandOptions () {} + ~CommandOptions () override {} const OptionDefinition* - GetDefinitions () + GetDefinitions () override { return g_option_table; } - virtual Error - SetOptionValue (uint32_t option_idx, const char *option_arg) + Error + SetOptionValue (uint32_t option_idx, const char *option_arg) override { Error error; const int short_option = m_getopt_table[option_idx].val; @@ -4970,7 +4950,7 @@ public: } void - OptionParsingStarting () + OptionParsingStarting () override { m_class_name.clear(); m_function_name.clear(); @@ -5015,7 +4995,7 @@ public: }; Options * - GetOptions () + GetOptions () override { return &m_options; } @@ -5030,13 +5010,13 @@ public: { } - ~CommandObjectTargetStopHookAdd () + ~CommandObjectTargetStopHookAdd () override { } protected: - virtual void - IOHandlerActivated (IOHandler &io_handler) + void + IOHandlerActivated (IOHandler &io_handler) override { StreamFileSP output_sp(io_handler.GetOutputStreamFile()); if (output_sp) @@ -5046,8 +5026,8 @@ protected: } } - virtual void - IOHandlerInputComplete (IOHandler &io_handler, std::string &line) + void + IOHandlerInputComplete (IOHandler &io_handler, std::string &line) override { if (m_stop_hook_sp) { @@ -5079,7 +5059,7 @@ protected: } bool - DoExecute (Args& command, CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { m_stop_hook_sp.reset(); @@ -5227,13 +5207,13 @@ public: { } - ~CommandObjectTargetStopHookDelete () + ~CommandObjectTargetStopHookDelete () override { } protected: bool - DoExecute (Args& command, CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = GetSelectedOrDummyTarget(); if (target) @@ -5303,13 +5283,13 @@ public: { } - ~CommandObjectTargetStopHookEnableDisable () + ~CommandObjectTargetStopHookEnableDisable () override { } protected: bool - DoExecute (Args& command, CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = GetSelectedOrDummyTarget(); if (target) @@ -5373,13 +5353,13 @@ public: { } - ~CommandObjectTargetStopHookList () + ~CommandObjectTargetStopHookList () override { } protected: bool - DoExecute (Args& command, CommandReturnObject &result) + DoExecute (Args& command, CommandReturnObject &result) override { Target *target = GetSelectedOrDummyTarget(); if (!target) @@ -5439,7 +5419,7 @@ public: LoadSubCommand ("list", CommandObjectSP (new CommandObjectTargetStopHookList (interpreter))); } - ~CommandObjectMultiwordTargetStopHooks() + ~CommandObjectMultiwordTargetStopHooks() override { } }; |