diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
commit | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch) | |
tree | 4adf86a776049cbf7f69a1929c4babcbbef925eb /lldb/source/Commands/CommandObjectTarget.cpp | |
parent | 7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff) |
Notes
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 465 |
1 files changed, 229 insertions, 236 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index abf7895a7384..8738e850c9f7 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -24,7 +24,6 @@ #include "lldb/Interpreter/OptionGroupBoolean.h" #include "lldb/Interpreter/OptionGroupFile.h" #include "lldb/Interpreter/OptionGroupFormat.h" -#include "lldb/Interpreter/OptionGroupPlatform.h" #include "lldb/Interpreter/OptionGroupString.h" #include "lldb/Interpreter/OptionGroupUInt64.h" #include "lldb/Interpreter/OptionGroupUUID.h" @@ -53,7 +52,6 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/FormatAdapters.h" -#include <cerrno> using namespace lldb; using namespace lldb_private; @@ -78,7 +76,7 @@ static void DumpTargetInfo(uint32_t target_idx, Target *target, uint32_t properties = 0; if (target_arch.IsValid()) { strm.Printf("%sarch=", properties++ > 0 ? ", " : " ( "); - target_arch.DumpTriple(strm); + target_arch.DumpTriple(strm.AsRawOstream()); properties++; } PlatformSP platform_sp(target->GetPlatform()); @@ -107,11 +105,11 @@ static void DumpTargetInfo(uint32_t target_idx, Target *target, const uint32_t start_frame = 0; const uint32_t num_frames = 1; const uint32_t num_frames_with_source = 1; - const bool stop_format = false; + const bool stop_format = false; process_sp->GetStatus(strm); process_sp->GetThreadStatus(strm, only_threads_with_stop_reason, - start_frame, num_frames, - num_frames_with_source, stop_format); + start_frame, num_frames, num_frames_with_source, + stop_format); } } @@ -398,8 +396,8 @@ protected: debugger.GetTargetList().SetSelectedTarget(target_sp.get()); if (must_set_platform_path) { ModuleSpec main_module_spec(file_spec); - ModuleSP module_sp = target_sp->GetOrCreateModule(main_module_spec, - true /* notify */); + ModuleSP module_sp = + target_sp->GetOrCreateModule(main_module_spec, true /* notify */); if (module_sp) module_sp->SetPlatformFileSpec(remote_file); } @@ -812,32 +810,28 @@ protected: void DumpGlobalVariableList(const ExecutionContext &exe_ctx, const SymbolContext &sc, const VariableList &variable_list, Stream &s) { - size_t count = variable_list.GetSize(); - if (count > 0) { - if (sc.module_sp) { - if (sc.comp_unit) { - s.Printf("Global variables for %s in %s:\n", - sc.comp_unit->GetPath().c_str(), - sc.module_sp->GetFileSpec().GetPath().c_str()); - } else { - s.Printf("Global variables for %s\n", - sc.module_sp->GetFileSpec().GetPath().c_str()); - } - } else if (sc.comp_unit) { - s.Printf("Global variables for %s\n", sc.comp_unit->GetPath().c_str()); + if (variable_list.Empty()) + return; + if (sc.module_sp) { + if (sc.comp_unit) { + s.Format("Global variables for {0} in {1}:\n", + sc.comp_unit->GetPrimaryFile(), sc.module_sp->GetFileSpec()); + } else { + s.Printf("Global variables for %s\n", + sc.module_sp->GetFileSpec().GetPath().c_str()); } + } else if (sc.comp_unit) { + s.Format("Global variables for {0}\n", sc.comp_unit->GetPrimaryFile()); + } - for (uint32_t i = 0; i < count; ++i) { - VariableSP var_sp(variable_list.GetVariableAtIndex(i)); - if (var_sp) { - ValueObjectSP valobj_sp(ValueObjectVariable::Create( - exe_ctx.GetBestExecutionContextScope(), var_sp)); + for (VariableSP var_sp : variable_list) { + if (!var_sp) + continue; + ValueObjectSP valobj_sp(ValueObjectVariable::Create( + exe_ctx.GetBestExecutionContextScope(), var_sp)); - if (valobj_sp) - DumpValueObject(s, var_sp, valobj_sp, - var_sp->GetName().GetCString()); - } - } + if (valobj_sp) + DumpValueObject(s, var_sp, valobj_sp, var_sp->GetName().GetCString()); } } @@ -929,9 +923,9 @@ protected: if (!success) { if (frame) { if (comp_unit) - result.AppendErrorWithFormat( - "no global variables in current compile unit: %s\n", - comp_unit->GetPath().c_str()); + result.AppendErrorWithFormatv( + "no global variables in current compile unit: {0}\n", + comp_unit->GetPrimaryFile()); else result.AppendErrorWithFormat( "no debug information for frame %u\n", @@ -1295,7 +1289,7 @@ static void DumpModuleArchitecture(Stream &strm, Module *module, StreamString arch_strm; if (full_triple) - module->GetArchitecture().DumpTriple(arch_strm); + module->GetArchitecture().DumpTriple(arch_strm.AsRawOstream()); else arch_strm.PutCString(module->GetArchitecture().GetArchitectureName()); std::string arch_str = arch_strm.GetString(); @@ -1330,8 +1324,8 @@ static uint32_t DumpCompileUnitLineTable(CommandInterpreter &interpreter, if (i > 0) strm << "\n\n"; - strm << "Line table for " << *static_cast<FileSpec *>(sc.comp_unit) - << " in `" << module->GetFileSpec().GetFilename() << "\n"; + strm << "Line table for " << sc.comp_unit->GetPrimaryFile() << " in `" + << module->GetFileSpec().GetFilename() << "\n"; LineTable *line_table = sc.comp_unit->GetLineTable(); if (line_table) line_table->GetDescription( @@ -1353,7 +1347,7 @@ static void DumpFullpath(Stream &strm, const FileSpec *file_spec_ptr, strm.Printf("%-*s", width, fullpath.c_str()); return; } else { - file_spec_ptr->Dump(&strm); + file_spec_ptr->Dump(strm.AsRawOstream()); return; } } @@ -1420,12 +1414,13 @@ static size_t DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list) { } static void DumpModuleSymtab(CommandInterpreter &interpreter, Stream &strm, - Module *module, SortOrder sort_order) { + Module *module, SortOrder sort_order, + Mangled::NamePreference name_preference) { if (!module) return; if (Symtab *symtab = module->GetSymtab()) symtab->Dump(&strm, interpreter.GetExecutionContext().GetTargetPtr(), - sort_order); + sort_order, name_preference); } static void DumpModuleSections(CommandInterpreter &interpreter, Stream &strm, @@ -1970,6 +1965,11 @@ public: const int short_option = m_getopt_table[option_idx].val; switch (short_option) { + case 'm': + m_prefer_mangled.SetCurrentValue(true); + m_prefer_mangled.SetOptionWasSet(); + break; + case 's': m_sort_order = (SortOrder)OptionArgParser::ToOptionEnum( option_arg, GetDefinitions()[option_idx].enum_values, @@ -1984,6 +1984,7 @@ public: void OptionParsingStarting(ExecutionContext *execution_context) override { m_sort_order = eSortOrderNone; + m_prefer_mangled.Clear(); } llvm::ArrayRef<OptionDefinition> GetDefinitions() override { @@ -1991,12 +1992,16 @@ public: } SortOrder m_sort_order; + OptionValueBoolean m_prefer_mangled = {false, false}; }; protected: bool DoExecute(Args &command, CommandReturnObject &result) override { Target *target = &GetSelectedTarget(); uint32_t num_dumped = 0; + Mangled::NamePreference name_preference = + (m_options.m_prefer_mangled ? Mangled::ePreferMangled + : Mangled::ePreferDemangled); uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize(); result.GetOutputStream().SetAddressByteSize(addr_byte_size); @@ -2022,7 +2027,7 @@ protected: DumpModuleSymtab( m_interpreter, result.GetOutputStream(), target->GetImages().GetModulePointerAtIndexUnlocked(image_idx), - m_options.m_sort_order); + m_options.m_sort_order, name_preference); } } else { result.AppendError("the target has no associated executable images"); @@ -2050,7 +2055,7 @@ protected: break; num_dumped++; DumpModuleSymtab(m_interpreter, result.GetOutputStream(), module, - m_options.m_sort_order); + m_options.m_sort_order, name_preference); } } } else @@ -3139,18 +3144,17 @@ protected: Address base_addr(objfile->GetBaseAddress()); if (base_addr.IsValid()) { if (target && !target->GetSectionLoadList().IsEmpty()) { - lldb::addr_t load_addr = - base_addr.GetLoadAddress(target); + lldb::addr_t load_addr = base_addr.GetLoadAddress(target); if (load_addr == LLDB_INVALID_ADDRESS) { base_addr.Dump(&strm, target, - Address::DumpStyleModuleWithFileAddress, - Address::DumpStyleFileAddress); + Address::DumpStyleModuleWithFileAddress, + Address::DumpStyleFileAddress); } else { if (format_char == 'o') { // Show the offset of slide for the image - strm.Printf( - "0x%*.*" PRIx64, addr_nibble_width, addr_nibble_width, - load_addr - base_addr.GetFileAddress()); + strm.Printf("0x%*.*" PRIx64, addr_nibble_width, + addr_nibble_width, + load_addr - base_addr.GetFileAddress()); } else { // Show the load address of the image strm.Printf("0x%*.*" PRIx64, addr_nibble_width, @@ -3452,8 +3456,7 @@ protected: } UnwindPlanSP of_unwind_augmented_sp = - func_unwinders_sp->GetObjectFileAugmentedUnwindPlan(*target, - *thread); + func_unwinders_sp->GetObjectFileAugmentedUnwindPlan(*target, *thread); if (of_unwind_augmented_sp) { result.GetOutputStream().Printf("object file augmented UnwindPlan:\n"); of_unwind_augmented_sp->Dump(result.GetOutputStream(), thread.get(), @@ -3751,7 +3754,7 @@ public: break; } - return true; + return false; } bool LookupInModule(CommandInterpreter &interpreter, Module *module, @@ -4035,169 +4038,165 @@ protected: bool AddModuleSymbols(Target *target, ModuleSpec &module_spec, bool &flush, CommandReturnObject &result) { const FileSpec &symbol_fspec = module_spec.GetSymbolFileSpec(); - if (symbol_fspec) { - char symfile_path[PATH_MAX]; - symbol_fspec.GetPath(symfile_path, sizeof(symfile_path)); + if (!symbol_fspec) { + result.AppendError( + "one or more executable image paths must be specified"); + result.SetStatus(eReturnStatusFailed); + return false; + } - if (!module_spec.GetUUID().IsValid()) { - if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec()) - module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename(); - } - // We now have a module that represents a symbol file that can be used - // for a module that might exist in the current target, so we need to - // find that module in the target - ModuleList matching_module_list; - - size_t num_matches = 0; - // First extract all module specs from the symbol file - lldb_private::ModuleSpecList symfile_module_specs; - if (ObjectFile::GetModuleSpecifications(module_spec.GetSymbolFileSpec(), - 0, 0, symfile_module_specs)) { - // Now extract the module spec that matches the target architecture - ModuleSpec target_arch_module_spec; - ModuleSpec symfile_module_spec; - target_arch_module_spec.GetArchitecture() = target->GetArchitecture(); - if (symfile_module_specs.FindMatchingModuleSpec(target_arch_module_spec, - symfile_module_spec)) { - // See if it has a UUID? - if (symfile_module_spec.GetUUID().IsValid()) { - // It has a UUID, look for this UUID in the target modules - ModuleSpec symfile_uuid_module_spec; - symfile_uuid_module_spec.GetUUID() = symfile_module_spec.GetUUID(); - target->GetImages().FindModules(symfile_uuid_module_spec, - matching_module_list); - num_matches = matching_module_list.GetSize(); - } + char symfile_path[PATH_MAX]; + symbol_fspec.GetPath(symfile_path, sizeof(symfile_path)); + + if (!module_spec.GetUUID().IsValid()) { + if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec()) + module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename(); + } + + // We now have a module that represents a symbol file that can be used + // for a module that might exist in the current target, so we need to + // find that module in the target + ModuleList matching_module_list; + + size_t num_matches = 0; + // First extract all module specs from the symbol file + lldb_private::ModuleSpecList symfile_module_specs; + if (ObjectFile::GetModuleSpecifications(module_spec.GetSymbolFileSpec(), + 0, 0, symfile_module_specs)) { + // Now extract the module spec that matches the target architecture + ModuleSpec target_arch_module_spec; + ModuleSpec symfile_module_spec; + target_arch_module_spec.GetArchitecture() = target->GetArchitecture(); + if (symfile_module_specs.FindMatchingModuleSpec(target_arch_module_spec, + symfile_module_spec)) { + // See if it has a UUID? + if (symfile_module_spec.GetUUID().IsValid()) { + // It has a UUID, look for this UUID in the target modules + ModuleSpec symfile_uuid_module_spec; + symfile_uuid_module_spec.GetUUID() = symfile_module_spec.GetUUID(); + target->GetImages().FindModules(symfile_uuid_module_spec, + matching_module_list); + num_matches = matching_module_list.GetSize(); } + } - if (num_matches == 0) { - // 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; i < num_symfile_module_specs && num_matches == 0; - ++i) { - if (symfile_module_specs.GetModuleSpecAtIndex( - i, symfile_module_spec)) { - if (symfile_module_spec.GetUUID().IsValid()) { - // It has a UUID, look for this UUID in the target modules - ModuleSpec symfile_uuid_module_spec; - symfile_uuid_module_spec.GetUUID() = - symfile_module_spec.GetUUID(); - target->GetImages().FindModules(symfile_uuid_module_spec, - matching_module_list); - num_matches = matching_module_list.GetSize(); - } + if (num_matches == 0) { + // 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; i < num_symfile_module_specs && num_matches == 0; + ++i) { + if (symfile_module_specs.GetModuleSpecAtIndex( + i, symfile_module_spec)) { + if (symfile_module_spec.GetUUID().IsValid()) { + // It has a UUID, look for this UUID in the target modules + ModuleSpec symfile_uuid_module_spec; + symfile_uuid_module_spec.GetUUID() = + symfile_module_spec.GetUUID(); + target->GetImages().FindModules(symfile_uuid_module_spec, + matching_module_list); + num_matches = matching_module_list.GetSize(); } } } } + } - // Just try to match up the file by basename if we have no matches at - // this point - if (num_matches == 0) { - target->GetImages().FindModules(module_spec, matching_module_list); - num_matches = matching_module_list.GetSize(); - } + // Just try to match up the file by basename if we have no matches at + // this point + if (num_matches == 0) { + target->GetImages().FindModules(module_spec, matching_module_list); + num_matches = matching_module_list.GetSize(); + } - while (num_matches == 0) { - ConstString filename_no_extension( - module_spec.GetFileSpec().GetFileNameStrippingExtension()); - // Empty string returned, lets bail - if (!filename_no_extension) - break; + while (num_matches == 0) { + ConstString filename_no_extension( + module_spec.GetFileSpec().GetFileNameStrippingExtension()); + // Empty string returned, let's bail + if (!filename_no_extension) + break; - // Check if there was no extension to strip and the basename is the - // same - if (filename_no_extension == module_spec.GetFileSpec().GetFilename()) - break; + // Check if there was no extension to strip and the basename is the same + if (filename_no_extension == module_spec.GetFileSpec().GetFilename()) + break; - // Replace basename with one less extension - module_spec.GetFileSpec().GetFilename() = filename_no_extension; + // Replace basename with one fewer extension + module_spec.GetFileSpec().GetFilename() = filename_no_extension; + target->GetImages().FindModules(module_spec, matching_module_list); + num_matches = matching_module_list.GetSize(); + } - target->GetImages().FindModules(module_spec, matching_module_list); - num_matches = matching_module_list.GetSize(); - } + if (num_matches > 1) { + result.AppendErrorWithFormat("multiple modules match symbol file '%s', " + "use the --uuid option to resolve the " + "ambiguity.\n", + symfile_path); + } else if (num_matches == 1) { + ModuleSP module_sp(matching_module_list.GetModuleAtIndex(0)); + + // The module has not yet created its symbol vendor, we can just give + // the existing target module the symfile path to use for when it + // decides to create it! + module_sp->SetSymbolFileFileSpec(symbol_fspec); + + SymbolFile *symbol_file = + module_sp->GetSymbolFile(true, &result.GetErrorStream()); + if (symbol_file) { + ObjectFile *object_file = symbol_file->GetObjectFile(); + + if (object_file && object_file->GetFileSpec() == symbol_fspec) { + // Provide feedback that the symfile has been successfully added. + const FileSpec &module_fs = module_sp->GetFileSpec(); + result.AppendMessageWithFormat( + "symbol file '%s' has been added to '%s'\n", symfile_path, + module_fs.GetPath().c_str()); - if (num_matches > 1) { - result.AppendErrorWithFormat("multiple modules match symbol file '%s', " - "use the --uuid option to resolve the " - "ambiguity.\n", - symfile_path); - } else if (num_matches == 1) { - ModuleSP module_sp(matching_module_list.GetModuleAtIndex(0)); - - // The module has not yet created its symbol vendor, we can just give - // the existing target module the symfile path to use for when it - // decides to create it! - module_sp->SetSymbolFileFileSpec(symbol_fspec); - - SymbolFile *symbol_file = - module_sp->GetSymbolFile(true, &result.GetErrorStream()); - if (symbol_file) { - ObjectFile *object_file = symbol_file->GetObjectFile(); - - if (object_file && object_file->GetFileSpec() == symbol_fspec) { - // Provide feedback that the symfile has been successfully added. - const FileSpec &module_fs = module_sp->GetFileSpec(); - result.AppendMessageWithFormat( - "symbol file '%s' has been added to '%s'\n", symfile_path, - module_fs.GetPath().c_str()); - - // Let clients know something changed in the module if it is - // currently loaded - ModuleList module_list; - module_list.Append(module_sp); - target->SymbolsDidLoad(module_list); - - // Make sure we load any scripting resources that may be embedded - // in the debug info files in case the platform supports that. - Status error; - StreamString feedback_stream; - module_sp->LoadScriptingResourceInTarget(target, error, - &feedback_stream); - if (error.Fail() && error.AsCString()) - result.AppendWarningWithFormat( - "unable to load scripting data for module %s - error " - "reported was %s", - module_sp->GetFileSpec() - .GetFileNameStrippingExtension() - .GetCString(), - error.AsCString()); - else if (feedback_stream.GetSize()) - result.AppendWarningWithFormat("%s", feedback_stream.GetData()); + // Let clients know something changed in the module if it is + // currently loaded + ModuleList module_list; + module_list.Append(module_sp); + target->SymbolsDidLoad(module_list); - flush = true; - result.SetStatus(eReturnStatusSuccessFinishResult); - return true; - } + // Make sure we load any scripting resources that may be embedded + // in the debug info files in case the platform supports that. + Status error; + StreamString feedback_stream; + module_sp->LoadScriptingResourceInTarget(target, error, + &feedback_stream); + if (error.Fail() && error.AsCString()) + result.AppendWarningWithFormat( + "unable to load scripting data for module %s - error " + "reported was %s", + module_sp->GetFileSpec() + .GetFileNameStrippingExtension() + .GetCString(), + error.AsCString()); + else if (feedback_stream.GetSize()) + result.AppendWarningWithFormat("%s", feedback_stream.GetData()); + + flush = true; + result.SetStatus(eReturnStatusSuccessFinishResult); + return true; } - // Clear the symbol file spec if anything went wrong - module_sp->SetSymbolFileFileSpec(FileSpec()); } + // Clear the symbol file spec if anything went wrong + module_sp->SetSymbolFileFileSpec(FileSpec()); + } - namespace fs = llvm::sys::fs; - if (module_spec.GetUUID().IsValid()) { - StreamString ss_symfile_uuid; - module_spec.GetUUID().Dump(&ss_symfile_uuid); - result.AppendErrorWithFormat( - "symbol file '%s' (%s) does not match any existing module%s\n", - symfile_path, ss_symfile_uuid.GetData(), - !fs::is_regular_file(symbol_fspec.GetPath()) - ? "\n please specify the full path to the symbol file" - : ""); - } else { - result.AppendErrorWithFormat( - "symbol file '%s' does not match any existing module%s\n", - symfile_path, - !fs::is_regular_file(symbol_fspec.GetPath()) - ? "\n please specify the full path to the symbol file" - : ""); - } - } else { - result.AppendError( - "one or more executable image paths must be specified"); + namespace fs = llvm::sys::fs; + StreamString ss_symfile_uuid; + if (module_spec.GetUUID().IsValid()) { + ss_symfile_uuid << " ("; + module_spec.GetUUID().Dump(&ss_symfile_uuid); + ss_symfile_uuid << ')'; } + result.AppendErrorWithFormat( + "symbol file '%s'%s does not match any existing module%s\n", + symfile_path, ss_symfile_uuid.GetData(), + !fs::is_regular_file(symbol_fspec.GetPath()) + ? "\n please specify the full path to the symbol file" + : ""); result.SetStatus(eReturnStatusFailed); return false; } @@ -4450,8 +4449,7 @@ public: error.SetErrorStringWithFormat( "invalid boolean value '%s' passed for -G option", option_arg.str().c_str()); - } - break; + } break; case 'l': if (option_arg.getAsInteger(0, m_line_start)) { error.SetErrorStringWithFormat("invalid start line number: \"%s\"", @@ -4655,48 +4653,43 @@ protected: } } - if (specifier_up) - new_hook_sp->SetSpecifier(specifier_up.release()); + if (specifier_up) + new_hook_sp->SetSpecifier(specifier_up.release()); - // Next see if any of the thread options have been entered: + // Next see if any of the thread options have been entered: - if (m_options.m_thread_specified) { - ThreadSpec *thread_spec = new ThreadSpec(); + if (m_options.m_thread_specified) { + ThreadSpec *thread_spec = new ThreadSpec(); - if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) { - thread_spec->SetTID(m_options.m_thread_id); - } + if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) { + thread_spec->SetTID(m_options.m_thread_id); + } - if (m_options.m_thread_index != UINT32_MAX) - thread_spec->SetIndex(m_options.m_thread_index); + if (m_options.m_thread_index != UINT32_MAX) + thread_spec->SetIndex(m_options.m_thread_index); - if (!m_options.m_thread_name.empty()) - thread_spec->SetName(m_options.m_thread_name.c_str()); + if (!m_options.m_thread_name.empty()) + thread_spec->SetName(m_options.m_thread_name.c_str()); - if (!m_options.m_queue_name.empty()) - thread_spec->SetQueueName(m_options.m_queue_name.c_str()); + if (!m_options.m_queue_name.empty()) + thread_spec->SetQueueName(m_options.m_queue_name.c_str()); - new_hook_sp->SetThreadSpecifier(thread_spec); - } - - new_hook_sp->SetAutoContinue(m_options.m_auto_continue); - if (m_options.m_use_one_liner) { - // Use one-liners. - for (auto cmd : m_options.m_one_liner) - new_hook_sp->GetCommandPointer()->AppendString( - cmd.c_str()); - result.AppendMessageWithFormat("Stop hook #%" PRIu64 " added.\n", - new_hook_sp->GetID()); - } else { - m_stop_hook_sp = new_hook_sp; - 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); + new_hook_sp->SetThreadSpecifier(thread_spec); + } + + new_hook_sp->SetAutoContinue(m_options.m_auto_continue); + if (m_options.m_use_one_liner) { + // Use one-liners. + for (auto cmd : m_options.m_one_liner) + new_hook_sp->GetCommandPointer()->AppendString(cmd.c_str()); + result.AppendMessageWithFormat("Stop hook #%" PRIu64 " added.\n", + new_hook_sp->GetID()); + } else { + m_stop_hook_sp = new_hook_sp; + m_interpreter.GetLLDBCommandsFromIOHandler("> ", // Prompt + *this); // IOHandlerDelegate + } + result.SetStatus(eReturnStatusSuccessFinishNoResult); return result.Succeeded(); } @@ -4751,7 +4744,7 @@ protected: } } } - result.SetStatus(eReturnStatusSuccessFinishNoResult); + result.SetStatus(eReturnStatusSuccessFinishNoResult); return result.Succeeded(); } }; @@ -4798,7 +4791,7 @@ protected: } } } - result.SetStatus(eReturnStatusSuccessFinishNoResult); + result.SetStatus(eReturnStatusSuccessFinishNoResult); return result.Succeeded(); } |