From 57179860a0547afc482171ef304976c7761a3fd8 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sat, 27 Apr 2019 06:19:42 +0000 Subject: [PATCH] [CommandObject] Use GetDebugger() helper method (NFC) In r359354 a GetDebugger() method was added to the CommandObject class, so that we didn't have to go through the command interpreter to obtain the script interpreter. This patch simplifies other call sites where m_interpreter.GetDebugger() was used, and replaces them with a shorter call to the new method. llvm-svn: 359373 --- lldb/source/Commands/CommandObjectApropos.cpp | 2 +- lldb/source/Commands/CommandObjectBreakpoint.cpp | 2 +- .../Commands/CommandObjectBreakpointCommand.cpp | 2 +- lldb/source/Commands/CommandObjectCommands.cpp | 15 ++---- lldb/source/Commands/CommandObjectDisassemble.cpp | 14 ++--- lldb/source/Commands/CommandObjectExpression.cpp | 3 +- lldb/source/Commands/CommandObjectGUI.cpp | 2 +- lldb/source/Commands/CommandObjectLog.cpp | 6 +-- lldb/source/Commands/CommandObjectPlatform.cpp | 60 ++++++++++------------ lldb/source/Commands/CommandObjectPlugin.cpp | 2 +- lldb/source/Commands/CommandObjectProcess.cpp | 16 +++--- lldb/source/Commands/CommandObjectSettings.cpp | 45 ++++++++-------- lldb/source/Commands/CommandObjectSource.cpp | 5 +- lldb/source/Commands/CommandObjectTarget.cpp | 45 ++++++++-------- lldb/source/Commands/CommandObjectThread.cpp | 4 +- lldb/source/Commands/CommandObjectType.cpp | 2 +- lldb/source/Commands/CommandObjectWatchpoint.cpp | 16 +++--- .../Commands/CommandObjectWatchpointCommand.cpp | 6 +-- 18 files changed, 116 insertions(+), 131 deletions(-) diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp index 0ee47c8..957de47 100644 --- a/lldb/source/Commands/CommandObjectApropos.cpp +++ b/lldb/source/Commands/CommandObjectApropos.cpp @@ -80,7 +80,7 @@ bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) { std::vector properties; const size_t num_properties = - m_interpreter.GetDebugger().Apropos(search_word, properties); + GetDebugger().Apropos(search_word, properties); if (num_properties) { const bool dump_qualified_name = true; result.AppendMessageWithFormatv( diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index 82b3fc3..d4ec326 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -897,7 +897,7 @@ protected: const bool show_locations = false; bp_sp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial, show_locations); - if (target == m_interpreter.GetDebugger().GetDummyTarget()) + if (target == GetDebugger().GetDummyTarget()) output_stream.Printf("Breakpoint set in dummy target, will get copied " "into future targets.\n"); else { diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 9ae1065..3f9d83c 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -630,7 +630,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("There is not a current executable; there are no " diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 45427753..cd0c2f1 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -985,11 +985,8 @@ protected: llvm::StringRef bytes_strref(lines[i]); Status error = AppendRegexSubstitution(bytes_strref, check_only); if (error.Fail()) { - if (!m_interpreter.GetDebugger() - .GetCommandInterpreter() - .GetBatchCommandMode()) { - StreamSP out_stream = - m_interpreter.GetDebugger().GetAsyncOutputStream(); + if (!GetDebugger().GetCommandInterpreter().GetBatchCommandMode()) { + StreamSP out_stream = GetDebugger().GetAsyncOutputStream(); out_stream->Printf("error: %s\n", error.AsCString()); } } @@ -1018,7 +1015,7 @@ protected: true); if (argc == 1) { - Debugger &debugger = m_interpreter.GetDebugger(); + Debugger &debugger = GetDebugger(); bool color_prompt = debugger.GetUseColor(); const bool multiple_lines = true; // Get multiple lines IOHandlerSP io_handler_sp(new IOHandlerEditline( @@ -1462,8 +1459,7 @@ protected: }; bool DoExecute(Args &command, CommandReturnObject &result) override { - if (m_interpreter.GetDebugger().GetScriptLanguage() != - lldb::eScriptLanguagePython) { + if (GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython) { result.AppendError("only scripting language supported for module " "importing is currently Python"); result.SetStatus(eReturnStatusFailed); @@ -1676,8 +1672,7 @@ protected: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - if (m_interpreter.GetDebugger().GetScriptLanguage() != - lldb::eScriptLanguagePython) { + if (GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython) { result.AppendError("only scripting language supported for scripted " "commands is currently Python"); result.SetStatus(eReturnStatusFailed); diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index b32d849..5972555 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -245,7 +245,7 @@ CommandObjectDisassemble::~CommandObjectDisassemble() = default; bool CommandObjectDisassemble::DoExecute(Args &command, CommandReturnObject &result) { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -320,8 +320,8 @@ bool CommandObjectDisassemble::DoExecute(Args &command, ConstString name(m_options.func_name.c_str()); if (Disassembler::Disassemble( - m_interpreter.GetDebugger(), m_options.arch, plugin_name, - flavor_string, m_exe_ctx, name, + GetDebugger(), m_options.arch, plugin_name, flavor_string, + m_exe_ctx, name, nullptr, // Module * m_options.num_instructions, m_options.show_mixed, m_options.show_mixed ? m_options.num_lines_context : 0, options, @@ -484,8 +484,8 @@ bool CommandObjectDisassemble::DoExecute(Args &command, bool print_sc_header = ranges.size() > 1; for (AddressRange cur_range : ranges) { if (Disassembler::Disassemble( - m_interpreter.GetDebugger(), m_options.arch, plugin_name, - flavor_string, m_exe_ctx, cur_range.GetBaseAddress(), + GetDebugger(), m_options.arch, plugin_name, flavor_string, + m_exe_ctx, cur_range.GetBaseAddress(), m_options.num_instructions, m_options.show_mixed, m_options.show_mixed ? m_options.num_lines_context : 0, options, result.GetOutputStream())) { @@ -532,8 +532,8 @@ bool CommandObjectDisassemble::DoExecute(Args &command, cur_range.SetByteSize(DEFAULT_DISASM_BYTE_SIZE); if (Disassembler::Disassemble( - m_interpreter.GetDebugger(), m_options.arch, plugin_name, - flavor_string, m_exe_ctx, cur_range, m_options.num_instructions, + GetDebugger(), m_options.arch, plugin_name, flavor_string, + m_exe_ctx, cur_range, m_options.num_instructions, m_options.show_mixed, m_options.show_mixed ? m_options.num_lines_context : 0, options, result.GetOutputStream())) { diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index d59b781..dc77a2e 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -482,8 +482,7 @@ bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr, } else { if (result_valobj_sp->GetError().GetError() == UserExpression::kNoResult) { - if (format != eFormatVoid && - m_interpreter.GetDebugger().GetNotifyVoid()) { + if (format != eFormatVoid && GetDebugger().GetNotifyVoid()) { error_stream->PutCString("(void)\n"); } diff --git a/lldb/source/Commands/CommandObjectGUI.cpp b/lldb/source/Commands/CommandObjectGUI.cpp index 48046cd..21ed510 100644 --- a/lldb/source/Commands/CommandObjectGUI.cpp +++ b/lldb/source/Commands/CommandObjectGUI.cpp @@ -26,7 +26,7 @@ CommandObjectGUI::~CommandObjectGUI() {} bool CommandObjectGUI::DoExecute(Args &args, CommandReturnObject &result) { #ifndef LLDB_DISABLE_CURSES if (args.GetArgumentCount() == 0) { - Debugger &debugger = m_interpreter.GetDebugger(); + Debugger &debugger = GetDebugger(); lldb::StreamFileSP input_sp = debugger.GetInputFile(); if (input_sp && input_sp->GetFile().GetIsRealTerminal() && diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 1add4b2..2ad61de 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -168,9 +168,9 @@ protected: std::string error; llvm::raw_string_ostream error_stream(error); - bool success = m_interpreter.GetDebugger().EnableLog( - channel, args.GetArgumentArrayRef(), log_file, m_options.log_options, - error_stream); + bool success = + GetDebugger().EnableLog(channel, args.GetArgumentArrayRef(), log_file, + m_options.log_options, error_stream); result.GetErrorStream() << error_stream.str(); if (success) diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index b5812df..0007ae6 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -191,8 +191,7 @@ protected: PlatformSP platform_sp(m_platform_options.CreatePlatformWithOptions( m_interpreter, ArchSpec(), select, error, platform_arch)); if (platform_sp) { - m_interpreter.GetDebugger().GetPlatformList().SetSelectedPlatform( - platform_sp); + GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp); platform_sp->GetStatus(result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); @@ -271,14 +270,13 @@ protected: bool DoExecute(Args &args, CommandReturnObject &result) override { Stream &ostrm = result.GetOutputStream(); - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); PlatformSP platform_sp; if (target) { platform_sp = target->GetPlatform(); } if (!platform_sp) { - platform_sp = - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform(); + platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform(); } if (platform_sp) { platform_sp->GetStatus(ostrm); @@ -307,15 +305,14 @@ protected: Stream &ostrm = result.GetOutputStream(); PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { Status error(platform_sp->ConnectRemote(args)); if (error.Success()) { platform_sp->GetStatus(ostrm); result.SetStatus(eReturnStatusSuccessFinishResult); - platform_sp->ConnectToWaitingProcesses(m_interpreter.GetDebugger(), - error); + platform_sp->ConnectToWaitingProcesses(GetDebugger(), error); if (error.Fail()) { result.AppendError(error.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -333,7 +330,7 @@ protected: Options *GetOptions() override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); OptionGroupOptions *m_platform_options = nullptr; if (platform_sp) { m_platform_options = platform_sp->GetConnectionOptions(m_interpreter); @@ -357,7 +354,7 @@ public: protected: bool DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { if (args.GetArgumentCount() == 0) { Status error; @@ -424,7 +421,7 @@ public: protected: bool DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { if (m_option_working_dir.GetOptionValue().OptionWasSet()) platform_sp->SetWorkingDirectory( @@ -460,7 +457,7 @@ public: bool DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { std::string cmd_line; args.GetCommandString(cmd_line); @@ -509,7 +506,7 @@ public: bool DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { Status error; std::string cmd_line; @@ -563,7 +560,7 @@ public: bool DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { std::string cmd_line; args.GetCommandString(cmd_line); @@ -607,7 +604,7 @@ public: bool DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { std::string cmd_line; args.GetCommandString(cmd_line); @@ -700,7 +697,7 @@ public: bool DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { std::string cmd_line; args.GetCommandString(cmd_line); @@ -845,7 +842,7 @@ public: } PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { const char *remote_file_path = args.GetArgumentAtIndex(0); const char *local_file_path = args.GetArgumentAtIndex(1); @@ -910,7 +907,7 @@ public: } PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { std::string remote_file_path(args.GetArgumentAtIndex(0)); user_id_t size = platform_sp->GetFileSize(FileSpec(remote_file_path)); @@ -953,7 +950,7 @@ public: FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString()); PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { Status error(platform_sp->PutFile(src_fs, dst_fs)); if (error.Success()) { @@ -986,14 +983,13 @@ public: protected: bool DoExecute(Args &args, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); PlatformSP platform_sp; if (target) { platform_sp = target->GetPlatform(); } if (!platform_sp) { - platform_sp = - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform(); + platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform(); } if (platform_sp) { @@ -1024,7 +1020,7 @@ protected: } if (m_options.launch_info.GetExecutableFile()) { - Debugger &debugger = m_interpreter.GetDebugger(); + Debugger &debugger = GetDebugger(); if (argc == 0) target->GetRunArguments(m_options.launch_info.GetArguments()); @@ -1094,14 +1090,13 @@ public: protected: bool DoExecute(Args &args, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); PlatformSP platform_sp; if (target) { platform_sp = target->GetPlatform(); } if (!platform_sp) { - platform_sp = - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform(); + platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform(); } if (platform_sp) { @@ -1384,14 +1379,13 @@ public: protected: bool DoExecute(Args &args, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); PlatformSP platform_sp; if (target) { platform_sp = target->GetPlatform(); } if (!platform_sp) { - platform_sp = - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform(); + platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform(); } if (platform_sp) { @@ -1567,11 +1561,11 @@ public: bool DoExecute(Args &command, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { Status err; ProcessSP remote_process_sp = platform_sp->Attach( - m_options.attach_info, m_interpreter.GetDebugger(), nullptr, err); + m_options.attach_info, GetDebugger(), nullptr, err); if (err.Fail()) { result.AppendError(err.AsCString()); result.SetStatus(eReturnStatusFailed); @@ -1699,7 +1693,7 @@ public: return false; PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); Status error; if (platform_sp) { FileSpec working_dir{}; @@ -1771,7 +1765,7 @@ public: return false; } PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); if (!platform_sp) { result.AppendError("no platform currently selected"); result.SetStatus(eReturnStatusFailed); diff --git a/lldb/source/Commands/CommandObjectPlugin.cpp b/lldb/source/Commands/CommandObjectPlugin.cpp index 1cc96f1..89e01ba 100644 --- a/lldb/source/Commands/CommandObjectPlugin.cpp +++ b/lldb/source/Commands/CommandObjectPlugin.cpp @@ -61,7 +61,7 @@ protected: FileSpec dylib_fspec(command[0].ref); FileSystem::Instance().Resolve(dylib_fspec); - if (m_interpreter.GetDebugger().LoadPlugin(dylib_fspec, error)) + if (GetDebugger().LoadPlugin(dylib_fspec, error)) result.SetStatus(eReturnStatusSuccessFinishResult); else { result.AppendError(error.AsCString()); diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 53d8176..c8fa71b 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -147,7 +147,7 @@ public: protected: bool DoExecute(Args &launch_args, CommandReturnObject &result) override { - Debugger &debugger = m_interpreter.GetDebugger(); + Debugger &debugger = GetDebugger(); Target *target = debugger.GetSelectedTarget().get(); // If our listener is nullptr, users aren't allows to launch ModuleSP exe_module_sp = target->GetExecutableModule(); @@ -430,9 +430,9 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { PlatformSP platform_sp( - m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); + GetDebugger().GetPlatformList().GetSelectedPlatform()); - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); // N.B. The attach should be synchronous. It doesn't help much to get the // prompt back between initiating the attach and the target actually // stopping. So even if the interpreter is set to be asynchronous, we wait @@ -449,8 +449,8 @@ protected: TargetSP new_target_sp; Status error; - error = m_interpreter.GetDebugger().GetTargetList().CreateTarget( - m_interpreter.GetDebugger(), "", "", eLoadDependentsNo, + error = GetDebugger().GetTargetList().CreateTarget( + GetDebugger(), "", "", eLoadDependentsNo, nullptr, // No platform options new_target_sp); target = new_target_sp.get(); @@ -458,7 +458,7 @@ protected: result.AppendError(error.AsCString("Error creating target")); return false; } - m_interpreter.GetDebugger().GetTargetList().SetSelectedTarget(target); + GetDebugger().GetTargetList().SetSelectedTarget(target); } // Record the old executable module, we want to issue a warning if the @@ -889,7 +889,7 @@ protected: plugin_name = m_options.plugin_name.c_str(); Status error; - Debugger &debugger = m_interpreter.GetDebugger(); + Debugger &debugger = GetDebugger(); PlatformSP platform_sp = m_interpreter.GetPlatform(true); ProcessSP process_sp = platform_sp->ConnectProcess( command.GetArgumentAtIndex(0), plugin_name, debugger, @@ -1460,7 +1460,7 @@ public: protected: bool DoExecute(Args &signal_args, CommandReturnObject &result) override { - TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget(); + TargetSP target_sp = GetDebugger().GetSelectedTarget(); if (!target_sp) { result.AppendError("No current target;" diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index e7f8d2a..806b0c1 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -161,9 +161,8 @@ insert-before or insert-after."); const char *setting_var_name = request.GetParsedLine().GetArgumentAtIndex(setting_var_idx); Status error; - lldb::OptionValueSP value_sp( - m_interpreter.GetDebugger().GetPropertyValue( - &m_exe_ctx, setting_var_name, false, error)); + lldb::OptionValueSP value_sp(GetDebugger().GetPropertyValue( + &m_exe_ctx, setting_var_name, false, error)); if (value_sp) { value_sp->AutoComplete(m_interpreter, request); } @@ -202,7 +201,7 @@ protected: // A missing value corresponds to clearing the setting when "force" is // specified. if (argc == 1 && m_options.m_force) { - Status error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef())); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -220,8 +219,8 @@ protected: Status error; if (m_options.m_global) { - error = m_interpreter.GetDebugger().SetPropertyValue( - nullptr, eVarSetOperationAssign, var_name, var_value_cstr); + error = GetDebugger().SetPropertyValue(nullptr, eVarSetOperationAssign, + var_name, var_value_cstr); } if (error.Success()) { @@ -232,8 +231,8 @@ protected: // if we did not clear the command's exe_ctx first ExecutionContext exe_ctx(m_exe_ctx); m_exe_ctx.Clear(); - error = m_interpreter.GetDebugger().SetPropertyValue( - &exe_ctx, eVarSetOperationAssign, var_name, var_value_cstr); + error = GetDebugger().SetPropertyValue(&exe_ctx, eVarSetOperationAssign, + var_name, var_value_cstr); } if (error.Fail()) { @@ -292,7 +291,7 @@ protected: if (!args.empty()) { for (const auto &arg : args) { - Status error(m_interpreter.GetDebugger().DumpPropertyValue( + Status error(GetDebugger().DumpPropertyValue( &m_exe_ctx, result.GetOutputStream(), arg.ref, OptionValue::eDumpGroupValue)); if (error.Success()) { @@ -303,8 +302,8 @@ protected: } } } else { - m_interpreter.GetDebugger().DumpAllPropertyValues( - &m_exe_ctx, result.GetOutputStream(), OptionValue::eDumpGroupValue); + GetDebugger().DumpAllPropertyValues(&m_exe_ctx, result.GetOutputStream(), + OptionValue::eDumpGroupValue); } return result.Succeeded(); @@ -415,13 +414,13 @@ protected: ExecutionContext clean_ctx; if (args.empty()) { - m_interpreter.GetDebugger().DumpAllPropertyValues( - &clean_ctx, out_file, OptionValue::eDumpGroupExport); + GetDebugger().DumpAllPropertyValues(&clean_ctx, out_file, + OptionValue::eDumpGroupExport); return result.Succeeded(); } for (const auto &arg : args) { - Status error(m_interpreter.GetDebugger().DumpPropertyValue( + Status error(GetDebugger().DumpPropertyValue( &clean_ctx, out_file, arg.ref, OptionValue::eDumpGroupExport)); if (!error.Success()) { result.AppendError(error.AsCString()); @@ -565,7 +564,7 @@ protected: const char *property_path = args.GetArgumentAtIndex(i); const Property *property = - m_interpreter.GetDebugger().GetValueProperties()->GetPropertyAtPath( + GetDebugger().GetValueProperties()->GetPropertyAtPath( &m_exe_ctx, will_modify, property_path); if (property) { @@ -578,8 +577,8 @@ protected: } } } else { - m_interpreter.GetDebugger().DumpAllDescriptions(m_interpreter, - result.GetOutputStream()); + GetDebugger().DumpAllDescriptions(m_interpreter, + result.GetOutputStream()); } return result.Succeeded(); @@ -672,7 +671,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Status error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationRemove, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -772,7 +771,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Status error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationReplace, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -878,7 +877,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Status error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationInsertBefore, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -981,7 +980,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Status error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationInsertAfter, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -1075,7 +1074,7 @@ protected: const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false); - Status error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationAppend, var_name, var_value_cstr)); if (error.Fail()) { result.AppendError(error.AsCString()); @@ -1143,7 +1142,7 @@ protected: return false; } - Status error(m_interpreter.GetDebugger().SetPropertyValue( + Status error(GetDebugger().SetPropertyValue( &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef())); if (error.Fail()) { result.AppendError(error.AsCString()); diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 2afb012..1b515d0 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -572,7 +572,7 @@ protected: Target *target = m_exe_ctx.GetTargetPtr(); if (target == nullptr) { - target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command."); @@ -1132,8 +1132,7 @@ protected: m_options.num_lines >= 10 ? 5 : m_options.num_lines / 2; const uint32_t column = - (m_interpreter.GetDebugger().GetStopShowColumn() != - eStopShowColumnNone) + (GetDebugger().GetStopShowColumn() != eStopShowColumnNone) ? sc.line_entry.column : 0; target->GetSourceManager().DisplaySourceLinesWithLineNumbers( diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index bc59557..ebc6873 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -314,7 +314,7 @@ protected: bool must_set_platform_path = false; - Debugger &debugger = m_interpreter.GetDebugger(); + Debugger &debugger = GetDebugger(); TargetSP target_sp; llvm::StringRef arch_cstr = m_arch_option.GetArchitectureName(); @@ -413,8 +413,7 @@ protected: target_sp->AppendExecutableSearchPaths(core_file_dir); ProcessSP process_sp(target_sp->CreateProcess( - m_interpreter.GetDebugger().GetListener(), llvm::StringRef(), - &core_file)); + GetDebugger().GetListener(), llvm::StringRef(), &core_file)); if (process_sp) { // Seems weird that we Launch a core file, but that is what we @@ -492,7 +491,7 @@ protected: Stream &strm = result.GetOutputStream(); bool show_stopped_process_status = false; - if (DumpTargetList(m_interpreter.GetDebugger().GetTargetList(), + if (DumpTargetList(GetDebugger().GetTargetList(), show_stopped_process_status, strm) == 0) { strm.PutCString("No targets.\n"); } @@ -527,7 +526,7 @@ protected: uint32_t target_idx = StringConvert::ToUInt32(target_idx_arg, UINT32_MAX, 0, &success); if (success) { - TargetList &target_list = m_interpreter.GetDebugger().GetTargetList(); + TargetList &target_list = GetDebugger().GetTargetList(); const uint32_t num_targets = target_list.GetNumTargets(); if (target_idx < num_targets) { TargetSP target_sp(target_list.GetTargetAtIndex(target_idx)); @@ -603,7 +602,7 @@ protected: bool DoExecute(Args &args, CommandReturnObject &result) override { const size_t argc = args.GetArgumentCount(); std::vector delete_target_list; - TargetList &target_list = m_interpreter.GetDebugger().GetTargetList(); + TargetList &target_list = GetDebugger().GetTargetList(); TargetSP target_sp; if (m_all_option.GetOptionValue()) { @@ -1054,7 +1053,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target) { const size_t argc = command.GetArgumentCount(); if (argc & 1) { @@ -1108,7 +1107,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target) { bool notify = true; target->GetImageSearchPathList().Clear(notify); @@ -1169,7 +1168,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target) { size_t argc = command.GetArgumentCount(); // check for at least 3 arguments and an odd number of parameters @@ -1237,7 +1236,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target) { if (command.GetArgumentCount() != 0) { result.AppendError("list takes no arguments\n"); @@ -1283,7 +1282,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target) { if (command.GetArgumentCount() != 1) { result.AppendError("query requires one argument\n"); @@ -1909,7 +1908,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -2025,7 +2024,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -2126,7 +2125,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -2219,7 +2218,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -2296,7 +2295,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -2551,7 +2550,7 @@ protected: OptionGroupFile m_symbol_file; bool DoExecute(Args &args, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -2714,7 +2713,7 @@ public: protected: bool DoExecute(Args &args, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); const bool load = m_load_option.GetOptionValue().GetCurrentValue(); const bool set_pc = m_pc_option.GetOptionValue().GetCurrentValue(); if (target == nullptr) { @@ -3049,7 +3048,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); const bool use_global_module_list = m_options.m_use_global_module_list; // Define a local module list here to ensure it lives longer than any // "locker" object which might lock its contents below (through the @@ -3929,7 +3928,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); @@ -4711,7 +4710,7 @@ protected: m_stop_hook_sp->GetID()); error_sp->Flush(); } - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target) target->RemoveStopHookByID(m_stop_hook_sp->GetID()); } else { @@ -4738,8 +4737,8 @@ protected: // First step, make the specifier. std::unique_ptr specifier_up; if (m_options.m_sym_ctx_specified) { - specifier_up.reset(new SymbolContextSpecifier( - m_interpreter.GetDebugger().GetSelectedTarget())); + specifier_up.reset( + new SymbolContextSpecifier(GetDebugger().GetSelectedTarget())); if (!m_options.m_module_name.empty()) { specifier_up->AddSpecification( diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index e41733f..00f52d5 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -836,7 +836,7 @@ public: bool DoExecute(Args &command, CommandReturnObject &result) override { bool synchronous_execution = m_interpreter.GetSynchronous(); - if (!m_interpreter.GetDebugger().GetSelectedTarget()) { + if (!GetDebugger().GetSelectedTarget()) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); result.SetStatus(eReturnStatusFailed); @@ -1116,7 +1116,7 @@ protected: bool DoExecute(Args &command, CommandReturnObject &result) override { bool synchronous_execution = m_interpreter.GetSynchronous(); - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("invalid target, create a debug target using the " "'target create' command"); diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 64150f0..d9fa210 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -2956,7 +2956,7 @@ public: protected: bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override { - TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget(); + TargetSP target_sp = GetDebugger().GetSelectedTarget(); Thread *thread = GetDefaultThread(); if (!thread) { result.AppendError("no default thread"); diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index 6c38320..3c3bd2d 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -225,7 +225,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("Invalid target. No current target or watchpoints."); result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -313,7 +313,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (!CheckTargetForWatchpointOperations(target, result)) return false; @@ -383,7 +383,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (!CheckTargetForWatchpointOperations(target, result)) return false; @@ -455,7 +455,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (!CheckTargetForWatchpointOperations(target, result)) return false; @@ -577,7 +577,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (!CheckTargetForWatchpointOperations(target, result)) return false; @@ -704,7 +704,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (!CheckTargetForWatchpointOperations(target, result)) return false; @@ -822,7 +822,7 @@ protected: } bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); StackFrame *frame = m_exe_ctx.GetFramePtr(); // If no argument is present, issue an error message. There's no way to @@ -1007,7 +1007,7 @@ protected: m_option_group.NotifyOptionParsingStarting( &exe_ctx); // This is a raw command, so notify the option group - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); StackFrame *frame = m_exe_ctx.GetFramePtr(); OptionsWithRaw args(raw_command); diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index 8894d2c..3c8eb59 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -387,7 +387,7 @@ are no syntax errors may indicate that a function was declared but never called. protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("There is not a current executable; there are no " @@ -504,7 +504,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("There is not a current executable; there are no " @@ -583,7 +583,7 @@ public: protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); + Target *target = GetDebugger().GetSelectedTarget().get(); if (target == nullptr) { result.AppendError("There is not a current executable; there are no " -- 2.7.4