From bd82a5d2cc9451c15f66d5dc8475fc6e01c19332 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Sun, 23 Jan 2011 05:56:20 +0000 Subject: Added a new variant of SBTarget::Launch() that deprectates the old one that takes separate file handles for stdin, stdout, and stder and also allows for the working directory to be specified. Added support to "process launch" to a new option: --working-dir=PATH. We can now set the working directory. If this is not set, it defaults to that of the process that has LLDB loaded. Added the working directory to the host LaunchInNewTerminal function to allows the current working directory to be set in processes that are spawned in their own terminal. Also hooked this up to the lldb_private::Process and all mac plug-ins. The linux plug-in had its API changed, but nothing is making use of it yet. Modfied "debugserver" and "darwin-debug" to also handle the current working directory options and modified the code in LLDB that spawns these tools to pass the info along. Fixed ProcessGDBRemote to properly pass along all file handles for stdin, stdout and stderr. After clearing the default values for the stdin/out/err file handles for process to be NULL, we had a crasher in UserSettingsController::UpdateStringVariable which is now fixed. Also fixed the setting of boolean values to be able to be set as "true", "yes", "on", "1" for true (case insensitive) and "false", "no", "off", or "0" for false. Fixed debugserver to properly handle files for STDIN, STDOUT and STDERR that are not already opened. Previous to this fix debugserver would only correctly open and dupe file handles for the slave side of a pseudo terminal. It now correctly handles getting STDIN for the inferior from a file, and spitting STDOUT and STDERR out to files. Also made sure the file handles were correctly opened with the NOCTTY flag for terminals. llvm-svn: 124060 --- lldb/source/Core/UserSettingsController.cpp | 42 +++++++++++++++++++---------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'lldb/source/Core/UserSettingsController.cpp') diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index 6cd1f3ccfd8..ea7d84e9494 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -1946,9 +1946,17 @@ UserSettingsController::UpdateStringVariable (lldb::VarSetOperationType op, Error &err) { if (op == lldb::eVarSetOperationAssign) - string_var = new_value; + { + if (new_value && new_value[0]) + string_var.assign (new_value); + else + string_var.clear(); + } else if (op == lldb::eVarSetOperationAppend) - string_var.append (new_value); + { + if (new_value && new_value[0]) + string_var.append (new_value); + } else if (op == lldb::eVarSetOperationClear) string_var.clear(); else @@ -1964,19 +1972,25 @@ UserSettingsController::UpdateBooleanVariable (lldb::VarSetOperationType op, if (op != lldb::eVarSetOperationAssign) err.SetErrorString ("Invalid operation for Boolean variable. Cannot update value.\n"); + if (new_value && new_value[0]) + { + if ((::strcasecmp(new_value, "true") == 0) || + (::strcasecmp(new_value, "yes") == 0) || + (::strcasecmp(new_value, "on") == 0) || + (::strcasecmp(new_value, "1") == 0)) + bool_var = true; + else + if ((::strcasecmp(new_value, "false") == 0) || + (::strcasecmp(new_value, "no") == 0) || + (::strcasecmp(new_value, "off") == 0) || + (::strcasecmp(new_value, "0") == 0)) + bool_var = false; + else + err.SetErrorStringWithFormat ("Invalid boolean value '%s'\n", new_value); + } + else + err.SetErrorString ("Invalid value. Cannot perform update.\n"); - if ((new_value == NULL) - || (new_value[0] == '\0')) - err.SetErrorString ("Invalid value. Cannot perform update.\n"); - - std::string bool_val_str (new_value); - - std::transform (bool_val_str.begin(), bool_val_str.end(), bool_val_str.begin(), ::tolower); - - if (bool_val_str == "true") - bool_var = true; - else if (bool_val_str == "false") - bool_var = false; } void -- cgit v1.2.3