summaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp166
1 files changed, 103 insertions, 63 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 1ee80503f5693..e55b255001798 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1,4 +1,4 @@
-//===-- CommandInterpreter.cpp ----------------------------------*- C++ -*-===//
+//===-- CommandInterpreter.cpp --------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -116,8 +116,7 @@ CommandInterpreter::CommandInterpreter(Debugger &debugger,
m_skip_lldbinit_files(false), m_skip_app_init_files(false),
m_command_io_handler_sp(), m_comment_char('#'),
m_batch_command_mode(false), m_truncation_warning(eNoTruncation),
- m_command_source_depth(0), m_num_errors(0), m_quit_requested(false),
- m_stopped_for_crash(false) {
+ m_command_source_depth(0), m_result() {
SetEventName(eBroadcastBitThreadShouldExit, "thread-should-exit");
SetEventName(eBroadcastBitResetPrompt, "reset-prompt");
SetEventName(eBroadcastBitQuitCommandReceived, "quit");
@@ -210,7 +209,7 @@ void CommandInterpreter::Initialize() {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
- CommandReturnObject result;
+ CommandReturnObject result(m_debugger.GetUseColor());
LoadCommandDictionary();
@@ -357,7 +356,7 @@ void CommandInterpreter::Initialize() {
AddAlias("p", cmd_obj_sp, "--")->SetHelpLong("");
AddAlias("print", cmd_obj_sp, "--")->SetHelpLong("");
AddAlias("call", cmd_obj_sp, "--")->SetHelpLong("");
- if (auto po = AddAlias("po", cmd_obj_sp, "-O --")) {
+ if (auto *po = AddAlias("po", cmd_obj_sp, "-O --")) {
po->SetHelp("Evaluate an expression on the current thread. Displays any "
"returned value with formatting "
"controlled by the type's author.");
@@ -382,6 +381,16 @@ void CommandInterpreter::Initialize() {
}
}
+ cmd_obj_sp = GetCommandSPExact("platform shell", false);
+ if (cmd_obj_sp) {
+ CommandAlias *shell_alias = AddAlias("shell", cmd_obj_sp, " --host --");
+ if (shell_alias) {
+ shell_alias->SetHelp("Run a shell command on the host.");
+ shell_alias->SetHelpLong("");
+ shell_alias->SetSyntax("shell <shell-command>");
+ }
+ }
+
cmd_obj_sp = GetCommandSPExact("process kill", false);
if (cmd_obj_sp) {
AddAlias("kill", cmd_obj_sp);
@@ -500,7 +509,10 @@ void CommandInterpreter::LoadCommandDictionary() {
m_command_dict["language"] =
CommandObjectSP(new CommandObjectLanguage(*this));
+ // clang-format off
const char *break_regexes[][2] = {
+ {"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
+ "breakpoint set --file '%1' --line %2 --column %3"},
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
"breakpoint set --file '%1' --line %2"},
{"^/([^/]+)/$", "breakpoint set --source-pattern-regexp '%1'"},
@@ -515,6 +527,7 @@ void CommandInterpreter::LoadCommandDictionary() {
"breakpoint set --name '%1' --skip-prologue=0"},
{"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
"breakpoint set --name '%1'"}};
+ // clang-format on
size_t num_regexes = llvm::array_lengthof(break_regexes);
@@ -523,6 +536,9 @@ void CommandInterpreter::LoadCommandDictionary() {
*this, "_regexp-break",
"Set a breakpoint using one of several shorthand formats.",
"\n"
+ "_regexp-break <filename>:<linenum>:<colnum>\n"
+ " main.c:12:21 // Break at line 12 and column "
+ "21 of main.c\n\n"
"_regexp-break <filename>:<linenum>\n"
" main.c:12 // Break at line 12 of "
"main.c\n\n"
@@ -546,7 +562,7 @@ void CommandInterpreter::LoadCommandDictionary() {
"current file\n"
" // containing text 'break "
"here'.\n",
- 2,
+ 3,
CommandCompletions::eSymbolCompletion |
CommandCompletions::eSourceFileCompletion,
false));
@@ -564,7 +580,8 @@ void CommandInterpreter::LoadCommandDictionary() {
if (success) {
CommandObjectSP break_regex_cmd_sp(break_regex_cmd_up.release());
- m_command_dict[break_regex_cmd_sp->GetCommandName()] = break_regex_cmd_sp;
+ m_command_dict[std::string(break_regex_cmd_sp->GetCommandName())] =
+ break_regex_cmd_sp;
}
}
@@ -573,6 +590,9 @@ void CommandInterpreter::LoadCommandDictionary() {
*this, "_regexp-tbreak",
"Set a one-shot breakpoint using one of several shorthand formats.",
"\n"
+ "_regexp-break <filename>:<linenum>:<colnum>\n"
+ " main.c:12:21 // Break at line 12 and column "
+ "21 of main.c\n\n"
"_regexp-break <filename>:<linenum>\n"
" main.c:12 // Break at line 12 of "
"main.c\n\n"
@@ -621,7 +641,7 @@ void CommandInterpreter::LoadCommandDictionary() {
if (success) {
CommandObjectSP tbreak_regex_cmd_sp(tbreak_regex_cmd_up.release());
- m_command_dict[tbreak_regex_cmd_sp->GetCommandName()] =
+ m_command_dict[std::string(tbreak_regex_cmd_sp->GetCommandName())] =
tbreak_regex_cmd_sp;
}
}
@@ -641,7 +661,7 @@ void CommandInterpreter::LoadCommandDictionary() {
"process attach --name '%1'") &&
attach_regex_cmd_up->AddRegexCommand("^$", "process attach")) {
CommandObjectSP attach_regex_cmd_sp(attach_regex_cmd_up.release());
- m_command_dict[attach_regex_cmd_sp->GetCommandName()] =
+ m_command_dict[std::string(attach_regex_cmd_sp->GetCommandName())] =
attach_regex_cmd_sp;
}
}
@@ -657,7 +677,8 @@ void CommandInterpreter::LoadCommandDictionary() {
down_regex_cmd_up->AddRegexCommand("^([0-9]+)$",
"frame select -r -%1")) {
CommandObjectSP down_regex_cmd_sp(down_regex_cmd_up.release());
- m_command_dict[down_regex_cmd_sp->GetCommandName()] = down_regex_cmd_sp;
+ m_command_dict[std::string(down_regex_cmd_sp->GetCommandName())] =
+ down_regex_cmd_sp;
}
}
@@ -671,7 +692,8 @@ void CommandInterpreter::LoadCommandDictionary() {
if (up_regex_cmd_up->AddRegexCommand("^$", "frame select -r 1") &&
up_regex_cmd_up->AddRegexCommand("^([0-9]+)$", "frame select -r %1")) {
CommandObjectSP up_regex_cmd_sp(up_regex_cmd_up.release());
- m_command_dict[up_regex_cmd_sp->GetCommandName()] = up_regex_cmd_sp;
+ m_command_dict[std::string(up_regex_cmd_sp->GetCommandName())] =
+ up_regex_cmd_sp;
}
}
@@ -684,7 +706,7 @@ void CommandInterpreter::LoadCommandDictionary() {
if (display_regex_cmd_up->AddRegexCommand(
"^(.+)$", "target stop-hook add -o \"expr -- %1\"")) {
CommandObjectSP display_regex_cmd_sp(display_regex_cmd_up.release());
- m_command_dict[display_regex_cmd_sp->GetCommandName()] =
+ m_command_dict[std::string(display_regex_cmd_sp->GetCommandName())] =
display_regex_cmd_sp;
}
}
@@ -699,7 +721,7 @@ void CommandInterpreter::LoadCommandDictionary() {
if (undisplay_regex_cmd_up->AddRegexCommand("^([0-9]+)$",
"target stop-hook delete %1")) {
CommandObjectSP undisplay_regex_cmd_sp(undisplay_regex_cmd_up.release());
- m_command_dict[undisplay_regex_cmd_sp->GetCommandName()] =
+ m_command_dict[std::string(undisplay_regex_cmd_sp->GetCommandName())] =
undisplay_regex_cmd_sp;
}
}
@@ -718,7 +740,7 @@ void CommandInterpreter::LoadCommandDictionary() {
"^([[:digit:]]+)$",
"process connect --plugin gdb-remote connect://localhost:%1")) {
CommandObjectSP command_sp(connect_gdb_remote_cmd_up.release());
- m_command_dict[command_sp->GetCommandName()] = command_sp;
+ m_command_dict[std::string(command_sp->GetCommandName())] = command_sp;
}
}
@@ -736,7 +758,7 @@ void CommandInterpreter::LoadCommandDictionary() {
connect_kdp_remote_cmd_up->AddRegexCommand(
"^(.+)$", "process connect --plugin kdp-remote udp://%1:41139")) {
CommandObjectSP command_sp(connect_kdp_remote_cmd_up.release());
- m_command_dict[command_sp->GetCommandName()] = command_sp;
+ m_command_dict[std::string(command_sp->GetCommandName())] = command_sp;
}
}
@@ -761,7 +783,7 @@ void CommandInterpreter::LoadCommandDictionary() {
bt_regex_cmd_up->AddRegexCommand("^all[[:space:]]*$", "thread backtrace all") &&
bt_regex_cmd_up->AddRegexCommand("^[[:space:]]*$", "thread backtrace")) {
CommandObjectSP command_sp(bt_regex_cmd_up.release());
- m_command_dict[command_sp->GetCommandName()] = command_sp;
+ m_command_dict[std::string(command_sp->GetCommandName())] = command_sp;
}
}
@@ -797,7 +819,8 @@ void CommandInterpreter::LoadCommandDictionary() {
"source list --name \"%1\"") &&
list_regex_cmd_up->AddRegexCommand("^$", "source list")) {
CommandObjectSP list_regex_cmd_sp(list_regex_cmd_up.release());
- m_command_dict[list_regex_cmd_sp->GetCommandName()] = list_regex_cmd_sp;
+ m_command_dict[std::string(list_regex_cmd_sp->GetCommandName())] =
+ list_regex_cmd_sp;
}
}
@@ -815,7 +838,8 @@ void CommandInterpreter::LoadCommandDictionary() {
env_regex_cmd_up->AddRegexCommand("^([A-Za-z_][A-Za-z_0-9]*=.*)$",
"settings set target.env-vars %1")) {
CommandObjectSP env_regex_cmd_sp(env_regex_cmd_up.release());
- m_command_dict[env_regex_cmd_sp->GetCommandName()] = env_regex_cmd_sp;
+ m_command_dict[std::string(env_regex_cmd_sp->GetCommandName())] =
+ env_regex_cmd_sp;
}
}
@@ -838,7 +862,8 @@ void CommandInterpreter::LoadCommandDictionary() {
jump_regex_cmd_up->AddRegexCommand("^([+\\-][0-9]+)$",
"thread jump --by %1")) {
CommandObjectSP jump_regex_cmd_sp(jump_regex_cmd_up.release());
- m_command_dict[jump_regex_cmd_sp->GetCommandName()] = jump_regex_cmd_sp;
+ m_command_dict[std::string(jump_regex_cmd_sp->GetCommandName())] =
+ jump_regex_cmd_sp;
}
}
}
@@ -863,7 +888,7 @@ CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str, bool include_aliases,
StringList *descriptions) const {
CommandObjectSP command_sp;
- std::string cmd = cmd_str;
+ std::string cmd = std::string(cmd_str);
if (HasCommands()) {
auto pos = m_command_dict.find(cmd);
@@ -992,18 +1017,18 @@ bool CommandInterpreter::AddUserCommand(llvm::StringRef name,
if (CommandExists(name)) {
if (!can_replace)
return false;
- if (!m_command_dict[name]->IsRemovable())
+ if (!m_command_dict[std::string(name)]->IsRemovable())
return false;
}
if (UserCommandExists(name)) {
if (!can_replace)
return false;
- if (!m_user_dict[name]->IsRemovable())
+ if (!m_user_dict[std::string(name)]->IsRemovable())
return false;
}
- m_user_dict[name] = cmd_sp;
+ m_user_dict[std::string(name)] = cmd_sp;
return true;
}
return false;
@@ -1089,14 +1114,15 @@ CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str,
}
bool CommandInterpreter::CommandExists(llvm::StringRef cmd) const {
- return m_command_dict.find(cmd) != m_command_dict.end();
+ return m_command_dict.find(std::string(cmd)) != m_command_dict.end();
}
bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd,
std::string &full_name) const {
- bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end());
+ bool exact_match =
+ (m_alias_dict.find(std::string(cmd)) != m_alias_dict.end());
if (exact_match) {
- full_name.assign(cmd);
+ full_name.assign(std::string(cmd));
return exact_match;
} else {
StringList matches;
@@ -1122,11 +1148,11 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd,
}
bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const {
- return m_alias_dict.find(cmd) != m_alias_dict.end();
+ return m_alias_dict.find(std::string(cmd)) != m_alias_dict.end();
}
bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const {
- return m_user_dict.find(cmd) != m_user_dict.end();
+ return m_user_dict.find(std::string(cmd)) != m_user_dict.end();
}
CommandAlias *
@@ -1141,7 +1167,8 @@ CommandInterpreter::AddAlias(llvm::StringRef alias_name,
new CommandAlias(*this, command_obj_sp, args_string, alias_name));
if (command_alias_up && command_alias_up->IsValid()) {
- m_alias_dict[alias_name] = CommandObjectSP(command_alias_up.get());
+ m_alias_dict[std::string(alias_name)] =
+ CommandObjectSP(command_alias_up.get());
return command_alias_up.release();
}
@@ -1149,7 +1176,7 @@ CommandInterpreter::AddAlias(llvm::StringRef alias_name,
}
bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) {
- auto pos = m_alias_dict.find(alias_name);
+ auto pos = m_alias_dict.find(std::string(alias_name));
if (pos != m_alias_dict.end()) {
m_alias_dict.erase(pos);
return true;
@@ -1158,7 +1185,7 @@ bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) {
}
bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd) {
- auto pos = m_command_dict.find(cmd);
+ auto pos = m_command_dict.find(std::string(cmd));
if (pos != m_command_dict.end()) {
if (pos->second->IsRemovable()) {
// Only regular expression objects or python commands are removable
@@ -1169,7 +1196,8 @@ bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd) {
return false;
}
bool CommandInterpreter::RemoveUser(llvm::StringRef alias_name) {
- CommandObject::CommandMap::iterator pos = m_user_dict.find(alias_name);
+ CommandObject::CommandMap::iterator pos =
+ m_user_dict.find(std::string(alias_name));
if (pos != m_user_dict.end()) {
m_user_dict.erase(pos);
return true;
@@ -1253,7 +1281,8 @@ CommandObject *CommandInterpreter::GetCommandObjectForCommand(
end = command_string.find_first_of(k_white_space, start);
if (end == std::string::npos)
end = command_string.size();
- std::string cmd_word = command_string.substr(start, end - start);
+ std::string cmd_word =
+ std::string(command_string.substr(start, end - start));
if (cmd_obj == nullptr)
// Since cmd_obj is NULL we are on our first time through this loop.
@@ -1311,10 +1340,10 @@ static size_t FindArgumentTerminator(const std::string &s) {
if (pos == std::string::npos)
break;
if (pos > 0) {
- if (isspace(s[pos - 1])) {
+ if (llvm::isSpace(s[pos - 1])) {
// Check if the string ends "\s--" (where \s is a space character) or
// if we have "\s--\s".
- if ((pos + 2 >= s_len) || isspace(s[pos + 2])) {
+ if ((pos + 2 >= s_len) || llvm::isSpace(s[pos + 2])) {
return pos;
}
}
@@ -1394,7 +1423,7 @@ CommandObject *CommandInterpreter::BuildAliasResult(
((CommandAlias *)alias_cmd_obj)->Desugar();
OptionArgVectorSP option_arg_vector_sp = desugared.second;
alias_cmd_obj = desugared.first.get();
- std::string alias_name_str = alias_name;
+ std::string alias_name_str = std::string(alias_name);
if ((cmd_args.GetArgumentCount() == 0) ||
(alias_name_str != cmd_args.GetArgumentAtIndex(0)))
cmd_args.Unshift(alias_name_str);
@@ -1402,7 +1431,7 @@ CommandObject *CommandInterpreter::BuildAliasResult(
result_str.Printf("%s", alias_cmd_obj->GetCommandName().str().c_str());
if (!option_arg_vector_sp.get()) {
- alias_result = result_str.GetString();
+ alias_result = std::string(result_str.GetString());
return alias_cmd_obj;
}
OptionArgVector *option_arg_vector = option_arg_vector_sp.get();
@@ -1443,7 +1472,7 @@ CommandObject *CommandInterpreter::BuildAliasResult(
}
}
- alias_result = result_str.GetString();
+ alias_result = std::string(result_str.GetString());
return alias_cmd_obj;
}
@@ -1527,7 +1556,7 @@ Status CommandInterpreter::PreprocessCommand(std::string &command) {
scalar.GetValue(&value_strm, show_type);
size_t value_string_size = value_strm.GetSize();
if (value_string_size) {
- command.insert(start_backtick, value_strm.GetString());
+ command.insert(start_backtick, std::string(value_strm.GetString()));
pos = start_backtick + value_string_size;
continue;
} else {
@@ -1591,6 +1620,11 @@ Status CommandInterpreter::PreprocessCommand(std::string &command) {
"expression '%s'",
expr_str.c_str());
break;
+ case eExpressionThreadVanished:
+ error.SetErrorStringWithFormat(
+ "expression thread vanished for the expression '%s'",
+ expr_str.c_str());
+ break;
}
}
}
@@ -1652,8 +1686,8 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
search_str = search_str.drop_front(non_space);
if (auto hist_str = m_command_history.FindString(search_str)) {
add_to_history = false;
- command_string = *hist_str;
- original_command_string = *hist_str;
+ command_string = std::string(*hist_str);
+ original_command_string = std::string(*hist_str);
} else {
result.AppendErrorWithFormat("Could not find entry: %s in history",
command_string.c_str());
@@ -1817,6 +1851,8 @@ void CommandInterpreter::HandleCompletionMatches(CompletionRequest &request) {
void CommandInterpreter::HandleCompletion(CompletionRequest &request) {
+ UpdateExecutionContext(nullptr);
+
// Don't complete comments, and if the line we are completing is just the
// history repeat character, substitute the appropriate history line.
llvm::StringRef first_arg = request.GetParsedLine().GetArgumentAtIndex(0);
@@ -1854,7 +1890,7 @@ bool CommandInterpreter::Confirm(llvm::StringRef message, bool default_answer) {
IOHandlerConfirm *confirm =
new IOHandlerConfirm(m_debugger, message, default_answer);
IOHandlerSP io_handler_sp(confirm);
- m_debugger.RunIOHandler(io_handler_sp);
+ m_debugger.RunIOHandlerSync(io_handler_sp);
return confirm->GetResponse();
}
@@ -1862,7 +1898,7 @@ const CommandAlias *
CommandInterpreter::GetAlias(llvm::StringRef alias_name) const {
OptionArgVectorSP ret_val;
- auto pos = m_alias_dict.find(alias_name);
+ auto pos = m_alias_dict.find(std::string(alias_name));
if (pos != m_alias_dict.end())
return (CommandAlias *)pos->second.get();
@@ -2228,7 +2264,7 @@ void CommandInterpreter::HandleCommands(const StringList &commands,
m_debugger.GetPrompt().str().c_str(), cmd);
}
- CommandReturnObject tmp_result;
+ CommandReturnObject tmp_result(m_debugger.GetUseColor());
// If override_context is not NULL, pass no_context_switching = true for
// HandleCommand() since we updated our context already.
@@ -2477,7 +2513,7 @@ void CommandInterpreter::HandleCommandsFromFile(
m_command_source_depth++;
- debugger.RunIOHandler(io_handler_sp);
+ debugger.RunIOHandlerSync(io_handler_sp);
if (!m_command_source_flags.empty())
m_command_source_flags.pop_back();
m_command_source_depth--;
@@ -2756,7 +2792,7 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
StartHandlingCommand();
- lldb_private::CommandReturnObject result;
+ lldb_private::CommandReturnObject result(m_debugger.GetUseColor());
HandleCommand(line.c_str(), eLazyBoolCalculate, result);
// Now emit the command output text from the command we just executed
@@ -2794,23 +2830,26 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
break;
case eReturnStatusFailed:
- m_num_errors++;
- if (io_handler.GetFlags().Test(eHandleCommandFlagStopOnError))
+ m_result.IncrementNumberOfErrors();
+ if (io_handler.GetFlags().Test(eHandleCommandFlagStopOnError)) {
+ m_result.SetResult(lldb::eCommandInterpreterResultCommandError);
io_handler.SetIsDone(true);
+ }
break;
case eReturnStatusQuit:
- m_quit_requested = true;
+ m_result.SetResult(lldb::eCommandInterpreterResultQuitRequested);
io_handler.SetIsDone(true);
break;
}
// Finally, if we're going to stop on crash, check that here:
- if (!m_quit_requested && result.GetDidChangeProcessState() &&
+ if (m_result.IsResult(lldb::eCommandInterpreterResultSuccess) &&
+ result.GetDidChangeProcessState() &&
io_handler.GetFlags().Test(eHandleCommandFlagStopOnCrash) &&
DidProcessStopAbnormally()) {
io_handler.SetIsDone(true);
- m_stopped_for_crash = true;
+ m_result.SetResult(lldb::eCommandInterpreterResultInferiorCrash);
}
}
@@ -2854,7 +2893,7 @@ void CommandInterpreter::GetLLDBCommandsFromIOHandler(
if (io_handler_sp) {
io_handler_sp->SetUserData(baton);
- debugger.PushIOHandler(io_handler_sp);
+ debugger.RunIOHandlerAsync(io_handler_sp);
}
}
@@ -2874,7 +2913,7 @@ void CommandInterpreter::GetPythonCommandsFromIOHandler(
if (io_handler_sp) {
io_handler_sp->SetUserData(baton);
- debugger.PushIOHandler(io_handler_sp);
+ debugger.RunIOHandlerAsync(io_handler_sp);
}
}
@@ -2928,26 +2967,27 @@ CommandInterpreter::GetIOHandler(bool force_create,
return m_command_io_handler_sp;
}
-void CommandInterpreter::RunCommandInterpreter(
- bool auto_handle_events, bool spawn_thread,
+CommandInterpreterRunResult CommandInterpreter::RunCommandInterpreter(
CommandInterpreterRunOptions &options) {
// Always re-create the command interpreter when we run it in case any file
// handles have changed.
bool force_create = true;
- m_debugger.PushIOHandler(GetIOHandler(force_create, &options));
- m_stopped_for_crash = false;
+ m_debugger.RunIOHandlerAsync(GetIOHandler(force_create, &options));
+ m_result = CommandInterpreterRunResult();
- if (auto_handle_events)
+ if (options.GetAutoHandleEvents())
m_debugger.StartEventHandlerThread();
- if (spawn_thread) {
+ if (options.GetSpawnThread()) {
m_debugger.StartIOHandlerThread();
} else {
- m_debugger.ExecuteIOHandlers();
+ m_debugger.RunIOHandlers();
- if (auto_handle_events)
+ if (options.GetAutoHandleEvents())
m_debugger.StopEventHandlerThread();
}
+
+ return m_result;
}
CommandObject *
@@ -3073,7 +3113,7 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line,
std::string gdb_format_option("--gdb-format=");
gdb_format_option += (suffix.c_str() + 1);
- std::string cmd = revised_command_line.GetString();
+ std::string cmd = std::string(revised_command_line.GetString());
size_t arg_terminator_idx = FindArgumentTerminator(cmd);
if (arg_terminator_idx != std::string::npos) {
// Insert the gdb format option before the "--" that terminates
@@ -3114,7 +3154,7 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line,
revised_command_line.Printf(" %s", scratch_command.c_str());
if (cmd_obj != nullptr)
- command_line = revised_command_line.GetString();
+ command_line = std::string(revised_command_line.GetString());
return cmd_obj;
}