diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index aeaca59d1e0a..1bb24dee0192 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -10,9 +10,9 @@ #include "CommandObjectTarget.h" // C Includes -#include - // C++ Includes +#include + // Other libraries and framework includes // Project includes #include "lldb/Interpreter/Args.h" @@ -58,8 +58,6 @@ using namespace lldb; using namespace lldb_private; - - static void DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bool show_stopped_process_status, Stream &strm) { @@ -128,7 +126,7 @@ DumpTargetList (TargetList &target_list, bool show_stopped_process_status, Strea { TargetSP selected_target_sp (target_list.GetSelectedTarget()); strm.PutCString ("Current targets:\n"); - for (uint32_t i=0; iGetExecutableSearchPaths ().Append (core_file_dir); - ProcessSP process_sp (target_sp->CreateProcess (m_interpreter.GetDebugger().GetListener(), NULL, &core_file)); + ProcessSP process_sp(target_sp->CreateProcess(m_interpreter.GetDebugger().GetListener(), nullptr, &core_file)); if (process_sp) { @@ -470,17 +467,14 @@ class CommandObjectTargetList : public CommandObjectParsed { public: CommandObjectTargetList (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "target list", - "List all current targets in the current debug session.", - NULL, - 0) + CommandObjectParsed(interpreter, + "target list", + "List all current targets in the current debug session.", + nullptr) { } - ~CommandObjectTargetList () override - { - } + ~CommandObjectTargetList() override = default; protected: bool @@ -506,7 +500,6 @@ protected: } }; - #pragma mark CommandObjectTargetSelect //---------------------------------------------------------------------- @@ -517,17 +510,14 @@ class CommandObjectTargetSelect : public CommandObjectParsed { public: CommandObjectTargetSelect (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "target select", - "Select a target as the current target by target index.", - NULL, - 0) + CommandObjectParsed(interpreter, + "target select", + "Select a target as the current target by target index.", + nullptr) { } - ~CommandObjectTargetSelect () override - { - } + ~CommandObjectTargetSelect() override = default; protected: bool @@ -566,7 +556,8 @@ protected: result.AppendErrorWithFormat ("index %u is out of range, valid target indexes are 0 - %u\n", target_idx, num_targets - 1); - } else + } + else { result.AppendErrorWithFormat ("index %u is out of range since there are no active targets\n", target_idx); @@ -599,11 +590,10 @@ class CommandObjectTargetDelete : public CommandObjectParsed { public: CommandObjectTargetDelete (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "target delete", - "Delete one or more targets by target index.", - NULL, - 0), + CommandObjectParsed(interpreter, + "target delete", + "Delete one or more targets by target index.", + nullptr), m_option_group(interpreter), m_all_option(LLDB_OPT_SET_1, false, "all", 'a', "Delete all targets.", false, true), m_cleanup_option( @@ -621,9 +611,7 @@ public: m_option_group.Finalize(); } - ~CommandObjectTargetDelete () override - { - } + ~CommandObjectTargetDelete() override = default; Options * GetOptions () override @@ -724,7 +712,6 @@ protected: OptionGroupBoolean m_cleanup_option; }; - #pragma mark CommandObjectTargetVariable //---------------------------------------------------------------------- @@ -738,11 +725,11 @@ class CommandObjectTargetVariable : public CommandObjectParsed public: CommandObjectTargetVariable (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "target variable", - "Read global variable(s) prior to, or while running your binary.", - NULL, - eCommandRequiresTarget), + CommandObjectParsed(interpreter, + "target variable", + "Read global variable(s) prior to, or while running your binary.", + nullptr, + eCommandRequiresTarget), m_option_group (interpreter), m_option_variable (false), // Don't include frame options m_option_format (eFormatDefault), @@ -775,17 +762,15 @@ public: m_option_group.Finalize(); } - ~CommandObjectTargetVariable () override - { - } + ~CommandObjectTargetVariable() override = default; void DumpValueObject (Stream &s, VariableSP &var_sp, ValueObjectSP &valobj_sp, const char *root_name) { DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions()); - if (false == valobj_sp->GetTargetSP()->GetDisplayRuntimeSupportValues() && - true == valobj_sp->IsRuntimeSupportValue()) + if (!valobj_sp->GetTargetSP()->GetDisplayRuntimeSupportValues() && + valobj_sp->IsRuntimeSupportValue()) return; switch (var_sp->GetScope()) @@ -879,7 +864,7 @@ protected: sc.comp_unit->GetPath().c_str()); } - for (uint32_t i=0; iGetSymbolContext (eSymbolContextCompUnit); @@ -1093,21 +1078,18 @@ protected: OptionGroupFileList m_option_compile_units; OptionGroupFileList m_option_shared_libraries; OptionGroupValueObjectDisplay m_varobj_options; - }; - #pragma mark CommandObjectTargetModulesSearchPathsAdd class CommandObjectTargetModulesSearchPathsAdd : public CommandObjectParsed { public: - CommandObjectTargetModulesSearchPathsAdd (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "target modules search-paths add", - "Add new image search paths substitution pairs to the current target.", - NULL) + CommandObjectParsed(interpreter, + "target modules search-paths add", + "Add new image search paths substitution pairs to the current target.", + nullptr) { CommandArgumentEntry arg; CommandArgumentData old_prefix_arg; @@ -1131,9 +1113,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectTargetModulesSearchPathsAdd () override - { - } + ~CommandObjectTargetModulesSearchPathsAdd() override = default; protected: bool @@ -1150,7 +1130,7 @@ protected: } else { - for (size_t i=0; iGetSymtab(); if (symtab) { - uint32_t i; std::vector match_indexes; ConstString symbol_name (name); uint32_t num_matches = 0; @@ -1741,7 +1705,7 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod DumpFullpath (strm, &module->GetFileSpec(), 0); strm.PutCString(":\n"); strm.IndentMore (); - for (i=0; i < num_matches; ++i) + for (uint32_t i = 0; i < num_matches; ++i) { Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]); if (symbol && symbol->ValueIsAddress()) @@ -1761,15 +1725,14 @@ LookupSymbolInModule (CommandInterpreter &interpreter, Stream &strm, Module *mod return 0; } - static void DumpSymbolContextList (ExecutionContextScope *exe_scope, Stream &strm, SymbolContextList &sc_list, bool verbose) { strm.IndentMore (); - uint32_t i; + const uint32_t num_matches = sc_list.GetSize(); - for (i=0; iFindFunctions (function_name, - NULL, - eFunctionNameTypeAuto, - include_symbols, - include_inlines, - append, - sc_list); + num_matches = module->FindFunctions(function_name, + nullptr, + eFunctionNameTypeAuto, + include_symbols, + include_inlines, + append, + sc_list); } if (num_matches) @@ -1972,7 +1935,6 @@ LookupFileAndLineInModule (CommandInterpreter &interpreter, return 0; } - static size_t FindModulesByName (Target *target, const char *module_name, @@ -2059,9 +2021,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectTargetModulesModuleAutoComplete () override - { - } + ~CommandObjectTargetModulesModuleAutoComplete() override = default; int HandleArgumentCompletion (Args &input, @@ -2077,14 +2037,14 @@ public: std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eModuleCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eModuleCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); return matches.GetSize(); } }; @@ -2120,9 +2080,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectTargetModulesSourceFileAutoComplete () override - { - } + ~CommandObjectTargetModulesSourceFileAutoComplete() override = default; int HandleArgumentCompletion (Args &input, @@ -2138,37 +2096,33 @@ public: std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eSourceFileCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eSourceFileCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); return matches.GetSize(); } }; - #pragma mark CommandObjectTargetModulesDumpSymtab - class CommandObjectTargetModulesDumpSymtab : public CommandObjectTargetModulesModuleAutoComplete { public: CommandObjectTargetModulesDumpSymtab (CommandInterpreter &interpreter) : - CommandObjectTargetModulesModuleAutoComplete (interpreter, - "target modules dump symtab", - "Dump the symbol table from one or more target modules.", - NULL), - m_options (interpreter) + CommandObjectTargetModulesModuleAutoComplete(interpreter, + "target modules dump symtab", + "Dump the symbol table from one or more target modules.", + nullptr), + m_options(interpreter) { } - ~CommandObjectTargetModulesDumpSymtab () override - { - } + ~CommandObjectTargetModulesDumpSymtab() override = default; Options * GetOptions () override @@ -2185,9 +2139,7 @@ public: { } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -2207,7 +2159,6 @@ public: default: error.SetErrorStringWithFormat("invalid short option character '%c'", short_option); break; - } return error; } @@ -2235,7 +2186,7 @@ protected: DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - if (target == NULL) + if (target == nullptr) { result.AppendError ("invalid target, create a debug target using the 'target create' command"); result.SetStatus (eReturnStatusFailed); @@ -2282,13 +2233,13 @@ protected: { // Dump specified images (by basename or fullpath) const char *arg_cstr; - for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx) + for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx) { ModuleList module_list; const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, true); if (num_matches > 0) { - for (size_t i=0; i ...]") - NULL) + CommandObjectTargetModulesModuleAutoComplete(interpreter, + "target modules dump sections", + "Dump the sections from one or more target modules.", + //"target modules dump sections [ ...]") + nullptr) { } - ~CommandObjectTargetModulesDumpSections () override - { - } + ~CommandObjectTargetModulesDumpSections() override = default; protected: bool DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - if (target == NULL) + if (target == nullptr) { result.AppendError ("invalid target, create a debug target using the 'target create' command"); result.SetStatus (eReturnStatusFailed); @@ -2404,13 +2352,13 @@ protected: { // Dump specified images (by basename or fullpath) const char *arg_cstr; - for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx) + for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx) { ModuleList module_list; const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, true); if (num_matches > 0) { - for (size_t i=0; i ...]") - NULL) + CommandObjectTargetModulesModuleAutoComplete(interpreter, + "target modules dump symfile", + "Dump the debug symbol file for one or more target modules.", + //"target modules dump symfile [ ...]") + nullptr) { } - ~CommandObjectTargetModulesDumpSymfile () override - { - } + ~CommandObjectTargetModulesDumpSymfile() override = default; protected: bool DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - if (target == NULL) + if (target == nullptr) { result.AppendError ("invalid target, create a debug target using the 'target create' command"); result.SetStatus (eReturnStatusFailed); @@ -2510,13 +2455,13 @@ protected: { // Dump specified images (by basename or fullpath) const char *arg_cstr; - for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx) + for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx) { ModuleList module_list; const size_t num_matches = FindModulesByName (target, arg_cstr, module_list, true); if (num_matches > 0) { - for (size_t i=0; iGetFileSpec().GetPath (path, sizeof(path))) result.AppendMessageWithFormat("%s\n", path); @@ -3127,9 +3061,7 @@ public: { } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -3150,7 +3082,7 @@ public: { unsigned long width = 0; if (option_arg) - width = strtoul (option_arg, NULL, 0); + width = strtoul(option_arg, nullptr, 0); m_format_array.push_back(std::make_pair(short_option, width)); } return error; @@ -3190,9 +3122,7 @@ public: { } - ~CommandObjectTargetModulesList () override - { - } + ~CommandObjectTargetModulesList() override = default; Options * GetOptions () override @@ -3210,7 +3140,7 @@ protected: // object which might lock its contents below (through the "module_list_ptr" // variable). ModuleList module_list; - if (target == NULL && use_global_module_list == false) + if (target == nullptr && !use_global_module_list) { result.AppendError ("invalid target, create a debug target using the 'target create' command"); result.SetStatus (eReturnStatusFailed); @@ -3261,10 +3191,10 @@ protected: } size_t num_modules = 0; - Mutex::Locker locker; // This locker will be locked on the mutex in module_list_ptr if it is non-NULL. + Mutex::Locker locker; // This locker will be locked on the mutex in module_list_ptr if it is non-nullptr. // Otherwise it will lock the AllocationModuleCollectionMutex when accessing // the global module list directly. - const ModuleList *module_list_ptr = NULL; + const ModuleList *module_list_ptr = nullptr; const size_t argc = command.GetArgumentCount(); if (argc == 0) { @@ -3280,7 +3210,7 @@ protected: } else { - for (size_t i=0; iGetMutex()); num_modules = module_list_ptr->GetSize(); @@ -3354,8 +3284,7 @@ protected: void PrintModule (Target *target, Module *module, int indent, Stream &strm) { - - if (module == NULL) + if (module == nullptr) { strm.PutCString("Null module"); return; @@ -3371,7 +3300,7 @@ protected: } const size_t num_entries = m_options.m_format_array.size(); bool print_space = false; - for (size_t i=0; iGetABI().get(); - if (process == NULL) + if (process == nullptr) { result.AppendError ("You must have a process running to use this command."); result.SetStatus (eReturnStatusFailed); @@ -3681,7 +3602,7 @@ protected: } ThreadSP thread(threads.GetThreadAtIndex(0)); - if (thread.get() == NULL) + if (!thread) { result.AppendError ("The process must be paused to use this command."); result.SetStatus (eReturnStatusFailed); @@ -3728,9 +3649,9 @@ protected: { SymbolContext sc; sc_list.GetContextAtIndex(idx, sc); - if (sc.symbol == NULL && sc.function == NULL) + if (sc.symbol == nullptr && sc.function == nullptr) continue; - if (sc.module_sp.get() == NULL || sc.module_sp->GetObjectFile() == NULL) + if (!sc.module_sp || sc.module_sp->GetObjectFile() == nullptr) continue; AddressRange range; if (!sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range)) @@ -3745,37 +3666,36 @@ protected: start_addr = abi->FixCodeAddress(start_addr); FuncUnwindersSP func_unwinders_sp (sc.module_sp->GetObjectFile()->GetUnwindTable().GetUncachedFuncUnwindersContainingAddress(start_addr, sc)); - if (func_unwinders_sp.get() == NULL) + if (!func_unwinders_sp) continue; result.GetOutputStream().Printf("UNWIND PLANS for %s`%s (start addr 0x%" PRIx64 ")\n\n", sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(), funcname.AsCString(), start_addr); - UnwindPlanSP non_callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtNonCallSite(*target, *thread.get(), -1); - if (non_callsite_unwind_plan.get()) + UnwindPlanSP non_callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtNonCallSite(*target, *thread, -1); + if (non_callsite_unwind_plan) { result.GetOutputStream().Printf("Asynchronous (not restricted to call-sites) UnwindPlan is '%s'\n", non_callsite_unwind_plan->GetSourceName().AsCString()); } UnwindPlanSP callsite_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(*target, -1); - if (callsite_unwind_plan.get()) + if (callsite_unwind_plan) { result.GetOutputStream().Printf("Synchronous (restricted to call-sites) UnwindPlan is '%s'\n", callsite_unwind_plan->GetSourceName().AsCString()); } - UnwindPlanSP fast_unwind_plan = func_unwinders_sp->GetUnwindPlanFastUnwind(*target, *thread.get()); - if (fast_unwind_plan.get()) + UnwindPlanSP fast_unwind_plan = func_unwinders_sp->GetUnwindPlanFastUnwind(*target, *thread); + if (fast_unwind_plan) { result.GetOutputStream().Printf("Fast UnwindPlan is '%s'\n", fast_unwind_plan->GetSourceName().AsCString()); } result.GetOutputStream().Printf("\n"); - UnwindPlanSP assembly_sp = func_unwinders_sp->GetAssemblyUnwindPlan(*target, *thread.get(), 0); + UnwindPlanSP assembly_sp = func_unwinders_sp->GetAssemblyUnwindPlan(*target, *thread, 0); if (assembly_sp) { result.GetOutputStream().Printf("Assembly language inspection UnwindPlan:\n"); assembly_sp->Dump(result.GetOutputStream(), thread.get(), LLDB_INVALID_ADDRESS); result.GetOutputStream().Printf("\n"); } - UnwindPlanSP ehframe_sp = func_unwinders_sp->GetEHFrameUnwindPlan(*target, 0); if (ehframe_sp) @@ -3785,7 +3705,7 @@ protected: result.GetOutputStream().Printf("\n"); } - UnwindPlanSP ehframe_augmented_sp = func_unwinders_sp->GetEHFrameAugmentedUnwindPlan(*target, *thread.get(), 0); + UnwindPlanSP ehframe_augmented_sp = func_unwinders_sp->GetEHFrameAugmentedUnwindPlan(*target, *thread, 0); if (ehframe_augmented_sp) { result.GetOutputStream().Printf("eh_frame augmented UnwindPlan:\n"); @@ -3847,9 +3767,9 @@ protected: OptionDefinition CommandObjectTargetModulesShowUnwind::CommandOptions::g_option_table[] = { - { LLDB_OPT_SET_1, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFunctionName, "Show unwind instructions for a function or symbol name."}, - { LLDB_OPT_SET_2, false, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Show unwind instructions for a function or symbol containing an address"}, - { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } + { LLDB_OPT_SET_1, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "Show unwind instructions for a function or symbol name."}, + { LLDB_OPT_SET_2, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Show unwind instructions for a function or symbol containing an address"}, + { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; //---------------------------------------------------------------------- @@ -3879,9 +3799,7 @@ public: OptionParsingStarting(); } - ~CommandOptions () override - { - } + ~CommandOptions() override = default; Error SetOptionValue (uint32_t option_idx, const char *option_arg) override @@ -3997,11 +3915,11 @@ public: }; CommandObjectTargetModulesLookup (CommandInterpreter &interpreter) : - CommandObjectParsed (interpreter, - "target modules lookup", - "Look up information within executable and dependent shared library images.", - NULL, - eCommandRequiresTarget), + CommandObjectParsed(interpreter, + "target modules lookup", + "Look up information within executable and dependent shared library images.", + nullptr, + eCommandRequiresTarget), m_options (interpreter) { CommandArgumentEntry arg; @@ -4018,9 +3936,7 @@ public: m_arguments.push_back (arg); } - ~CommandObjectTargetModulesLookup () override - { - } + ~CommandObjectTargetModulesLookup() override = default; Options * GetOptions () override @@ -4181,7 +4097,7 @@ protected: DoExecute (Args& command, CommandReturnObject &result) override { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - if (target == NULL) + if (target == nullptr) { result.AppendError ("invalid target, create a debug target using the 'target create' command"); result.SetStatus (eReturnStatusFailed); @@ -4222,7 +4138,7 @@ protected: const size_t num_modules = target_modules.GetSize(); if (num_modules > 0) { - for (i = 0; i from any addresses before doing the lookup."}, + { LLDB_OPT_SET_1, true, "address", 'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddressOrExpression, "Lookup an address in one or more target modules."}, + { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "When looking up an address subtract from any addresses before doing the lookup."}, { LLDB_OPT_SET_2| LLDB_OPT_SET_4 | LLDB_OPT_SET_5 /* FIXME: re-enable this for types when the LookupTypeInModule actually uses the regex option: | LLDB_OPT_SET_6 */ , - false, "regex", 'r', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "The argument for name lookups are regular expressions."}, - { LLDB_OPT_SET_2, true, "symbol", 's', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."}, - { LLDB_OPT_SET_3, true, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."}, - { LLDB_OPT_SET_3, false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."}, + false, "regex", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "The argument for name lookups are regular expressions."}, + { LLDB_OPT_SET_2, true, "symbol", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeSymbol, "Lookup a symbol by name in the symbol tables in one or more target modules."}, + { LLDB_OPT_SET_3, true, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFilename, "Lookup a file by fullpath or basename in one or more target modules."}, + { LLDB_OPT_SET_3, false, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Lookup a line number in a file (must be used in conjunction with --file)."}, { LLDB_OPT_SET_FROM_TO(3,5), - false, "no-inlines", 'i', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."}, - { LLDB_OPT_SET_4, true, "function", 'F', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."}, - { LLDB_OPT_SET_5, true, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFunctionOrSymbol, "Lookup a function or symbol by name in one or more target modules."}, - { LLDB_OPT_SET_6, true, "type", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."}, - { LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Enable verbose lookup information."}, - { LLDB_OPT_SET_ALL, false, "all", 'A', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available."}, - { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } + false, "no-inlines", 'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Ignore inline entries (must be used in conjunction with --file or --function)."}, + { LLDB_OPT_SET_4, true, "function", 'F', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionName, "Lookup a function by name in the debug symbols in one or more target modules."}, + { LLDB_OPT_SET_5, true, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFunctionOrSymbol, "Lookup a function or symbol by name in one or more target modules."}, + { LLDB_OPT_SET_6, true, "type", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName, "Lookup a type by name in the debug symbols in one or more target modules."}, + { LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose lookup information."}, + { LLDB_OPT_SET_ALL, false, "all", 'A', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Print all matches, not just the best match, if a best match is available."}, + { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; - #pragma mark CommandObjectMultiwordImageSearchPaths //------------------------------------------------------------------------- @@ -4324,13 +4239,9 @@ public: LoadSubCommand ("query", CommandObjectSP (new CommandObjectTargetModulesSearchPathsQuery (interpreter))); } - ~CommandObjectTargetModulesImageSearchPaths() override - { - } + ~CommandObjectTargetModulesImageSearchPaths() override = default; }; - - #pragma mark CommandObjectTargetModules //------------------------------------------------------------------------- @@ -4359,9 +4270,7 @@ public: } - ~CommandObjectTargetModules() override - { - } + ~CommandObjectTargetModules() override = default; private: //------------------------------------------------------------------ @@ -4370,8 +4279,6 @@ private: DISALLOW_COPY_AND_ASSIGN (CommandObjectTargetModules); }; - - class CommandObjectTargetSymbolsAdd : public CommandObjectParsed { public: @@ -4391,9 +4298,7 @@ public: m_option_group.Finalize(); } - ~CommandObjectTargetSymbolsAdd () override - { - } + ~CommandObjectTargetSymbolsAdd() override = default; int HandleArgumentCompletion (Args &input, @@ -4408,14 +4313,14 @@ public: std::string completion_str (input.GetArgumentAtIndex(cursor_index)); completion_str.erase (cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter, - CommandCompletions::eDiskFileCompletion, - completion_str.c_str(), - match_start_point, - max_return_elements, - NULL, - word_complete, - matches); + CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::eDiskFileCompletion, + completion_str.c_str(), + match_start_point, + max_return_elements, + nullptr, + word_complete, + matches); return matches.GetSize(); } @@ -4475,7 +4380,7 @@ protected: // No matches yet, iterate through the module specs to find a UUID value that // we can match up to an image in our target const size_t num_symfile_module_specs = symfile_module_specs.GetSize(); - for (size_t i=0; iGetPlatform()); - for (size_t i=0; i ...") { LoadSubCommand ("add", CommandObjectSP (new CommandObjectTargetSymbolsAdd (interpreter))); - } - ~CommandObjectTargetSymbols() override - { - } + ~CommandObjectTargetSymbols() override = default; private: //------------------------------------------------------------------ @@ -4829,7 +4730,6 @@ private: DISALLOW_COPY_AND_ASSIGN (CommandObjectTargetSymbols); }; - #pragma mark CommandObjectTargetStopHookAdd //------------------------------------------------------------------------- @@ -4841,7 +4741,6 @@ class CommandObjectTargetStopHookAdd : public IOHandlerDelegateMultiline { public: - class CommandOptions : public Options { public: @@ -4857,7 +4756,7 @@ public: { } - ~CommandOptions () override {} + ~CommandOptions() override = default; const OptionDefinition* GetDefinitions () override @@ -4877,7 +4776,7 @@ public: case 'c': m_class_name = option_arg; m_sym_ctx_specified = true; - break; + break; case 'e': m_line_end = StringConvert::ToUInt32 (option_arg, UINT_MAX, 0, &success); @@ -4887,7 +4786,7 @@ public: break; } m_sym_ctx_specified = true; - break; + break; case 'l': m_line_start = StringConvert::ToUInt32 (option_arg, 0, 0, &success); @@ -4897,57 +4796,60 @@ public: break; } m_sym_ctx_specified = true; - break; + break; case 'i': m_no_inlines = true; - break; + break; case 'n': m_function_name = option_arg; m_func_name_type_mask |= eFunctionNameTypeAuto; m_sym_ctx_specified = true; - break; + break; case 'f': m_file_name = option_arg; m_sym_ctx_specified = true; - break; + break; + case 's': m_module_name = option_arg; m_sym_ctx_specified = true; - break; + break; + case 't' : - { m_thread_id = StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0); if (m_thread_id == LLDB_INVALID_THREAD_ID) error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg); m_thread_specified = true; - } - break; + break; + case 'T': m_thread_name = option_arg; m_thread_specified = true; - break; + break; + case 'q': m_queue_name = option_arg; m_thread_specified = true; break; + case 'x': - { m_thread_index = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0); if (m_thread_id == UINT32_MAX) error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg); m_thread_specified = true; - } - break; + break; + case 'o': m_use_one_liner = true; m_one_liner = option_arg; - break; + break; + default: error.SetErrorStringWithFormat ("unrecognized option %c.", short_option); - break; + break; } return error; } @@ -4975,7 +4877,6 @@ public: m_one_liner.clear(); } - static OptionDefinition g_option_table[]; std::string m_class_name; @@ -4997,12 +4898,6 @@ public: std::string m_one_liner; }; - Options * - GetOptions () override - { - return &m_options; - } - CommandObjectTargetStopHookAdd (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "target stop-hook add", @@ -5013,8 +4908,12 @@ public: { } - ~CommandObjectTargetStopHookAdd () override + ~CommandObjectTargetStopHookAdd() override = default; + + Options * + GetOptions () override { + return &m_options; } protected: @@ -5108,7 +5007,7 @@ protected: } } - if (specifier_ap.get()) + if (specifier_ap) new_hook_sp->SetSpecifier (specifier_ap.release()); // Next see if any of the thread options have been entered: @@ -5143,10 +5042,10 @@ protected: else { m_stop_hook_sp = new_hook_sp; - m_interpreter.GetLLDBCommandsFromIOHandler ("> ", // Prompt - *this, // IOHandlerDelegate - true, // Run IOHandler in async mode - NULL); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions + m_interpreter.GetLLDBCommandsFromIOHandler("> ", // Prompt + *this, // IOHandlerDelegate + true, // Run IOHandler in async mode + nullptr); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions } result.SetStatus (eReturnStatusSuccessFinishNoResult); @@ -5159,6 +5058,7 @@ protected: return result.Succeeded(); } + private: CommandOptions m_options; Target::StopHookSP m_stop_hook_sp; @@ -5167,29 +5067,29 @@ private: OptionDefinition CommandObjectTargetStopHookAdd::CommandOptions::g_option_table[] = { - { LLDB_OPT_SET_ALL, false, "one-liner", 'o', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeOneLiner, + { LLDB_OPT_SET_ALL, false, "one-liner", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner, "Specify a one-line breakpoint command inline. Be sure to surround it with quotes." }, - { LLDB_OPT_SET_ALL, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eModuleCompletion, eArgTypeShlibName, + { LLDB_OPT_SET_ALL, false, "shlib", 's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Set the module within which the stop-hook is to be run."}, - { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadIndex, + { LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The stop hook is run only for the thread whose index matches this argument."}, - { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadID, + { LLDB_OPT_SET_ALL, false, "thread-id", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadID, "The stop hook is run only for the thread whose TID matches this argument."}, - { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadName, + { LLDB_OPT_SET_ALL, false, "thread-name", 'T', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadName, "The stop hook is run only for the thread whose thread name matches this argument."}, - { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeQueueName, + { LLDB_OPT_SET_ALL, false, "queue-name", 'q', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeQueueName, "The stop hook is run only for threads in the queue whose name is given by this argument."}, - { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, + { LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specify the source file within which the stop-hook is to be run." }, - { LLDB_OPT_SET_1, false, "start-line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, + { LLDB_OPT_SET_1, false, "start-line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Set the start of the line range for which the stop-hook is to be run."}, - { LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, + { LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Set the end of the line range for which the stop-hook is to be run."}, - { LLDB_OPT_SET_2, false, "classname", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeClassName, + { LLDB_OPT_SET_2, false, "classname", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeClassName, "Specify the class within which the stop-hook is to be run." }, - { LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, + { LLDB_OPT_SET_3, false, "name", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion, eArgTypeFunctionName, "Set the function name within which the stop hook will be run." }, - { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } + { 0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr } }; #pragma mark CommandObjectTargetStopHookDelete @@ -5201,7 +5101,6 @@ CommandObjectTargetStopHookAdd::CommandOptions::g_option_table[] = class CommandObjectTargetStopHookDelete : public CommandObjectParsed { public: - CommandObjectTargetStopHookDelete (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "target stop-hook delete", @@ -5210,9 +5109,7 @@ public: { } - ~CommandObjectTargetStopHookDelete () override - { - } + ~CommandObjectTargetStopHookDelete() override = default; protected: bool @@ -5267,6 +5164,7 @@ protected: return result.Succeeded(); } }; + #pragma mark CommandObjectTargetStopHookEnableDisable //------------------------------------------------------------------------- @@ -5276,7 +5174,6 @@ protected: class CommandObjectTargetStopHookEnableDisable : public CommandObjectParsed { public: - CommandObjectTargetStopHookEnableDisable (CommandInterpreter &interpreter, bool enable, const char *name, const char *help, const char *syntax) : CommandObjectParsed (interpreter, name, @@ -5286,9 +5183,7 @@ public: { } - ~CommandObjectTargetStopHookEnableDisable () override - { - } + ~CommandObjectTargetStopHookEnableDisable() override = default; protected: bool @@ -5347,7 +5242,6 @@ private: class CommandObjectTargetStopHookList : public CommandObjectParsed { public: - CommandObjectTargetStopHookList (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "target stop-hook list", @@ -5356,9 +5250,7 @@ public: { } - ~CommandObjectTargetStopHookList () override - { - } + ~CommandObjectTargetStopHookList() override = default; protected: bool @@ -5393,6 +5285,7 @@ protected: }; #pragma mark CommandObjectMultiwordTargetStopHooks + //------------------------------------------------------------------------- // CommandObjectMultiwordTargetStopHooks //------------------------------------------------------------------------- @@ -5400,7 +5293,6 @@ protected: class CommandObjectMultiwordTargetStopHooks : public CommandObjectMultiword { public: - CommandObjectMultiwordTargetStopHooks (CommandInterpreter &interpreter) : CommandObjectMultiword (interpreter, "target stop-hook", @@ -5422,13 +5314,9 @@ public: LoadSubCommand ("list", CommandObjectSP (new CommandObjectTargetStopHookList (interpreter))); } - ~CommandObjectMultiwordTargetStopHooks() override - { - } + ~CommandObjectMultiwordTargetStopHooks() override = default; }; - - #pragma mark CommandObjectMultiwordTarget //------------------------------------------------------------------------- @@ -5441,7 +5329,6 @@ CommandObjectMultiwordTarget::CommandObjectMultiwordTarget (CommandInterpreter & "A set of commands for operating on debugger targets.", "target []") { - LoadSubCommand ("create", CommandObjectSP (new CommandObjectTargetCreate (interpreter))); LoadSubCommand ("delete", CommandObjectSP (new CommandObjectTargetDelete (interpreter))); LoadSubCommand ("list", CommandObjectSP (new CommandObjectTargetList (interpreter))); @@ -5452,8 +5339,4 @@ CommandObjectMultiwordTarget::CommandObjectMultiwordTarget (CommandInterpreter & LoadSubCommand ("variable", CommandObjectSP (new CommandObjectTargetVariable (interpreter))); } -CommandObjectMultiwordTarget::~CommandObjectMultiwordTarget () -{ -} - - +CommandObjectMultiwordTarget::~CommandObjectMultiwordTarget() = default;