diff options
| author | Caroline Tice <ctice@apple.com> | 2010-09-04 00:03:46 +0000 |
|---|---|---|
| committer | Caroline Tice <ctice@apple.com> | 2010-09-04 00:03:46 +0000 |
| commit | 3df9a8dfd7714dd6d03d5e1a93dbbfee736946bc (patch) | |
| tree | 5855b97cff85c66d8e0236d43ed974c031a5bf3b /lldb/source/API | |
| parent | 070ebd93d2765e5f88e9739edb673a1fee5cbe9c (diff) | |
| download | llvm-3df9a8dfd7714dd6d03d5e1a93dbbfee736946bc.tar.gz llvm-3df9a8dfd7714dd6d03d5e1a93dbbfee736946bc.tar.bz2 llvm-3df9a8dfd7714dd6d03d5e1a93dbbfee736946bc.zip | |
This is a very large commit that completely re-does the way lldb
handles user settable internal variables (the equivalent of set/show
variables in gdb). In addition to the basic infrastructure (most of
which is defined in UserSettingsController.{h,cpp}, there are examples
of two classes that have been set up to contain user settable
variables (the Debugger and Process classes). The 'settings' command
has been modified to be a command-subcommand structure, and the 'set',
'show' and 'append' commands have been moved into this sub-commabnd
structure. The old StateVariable class has been completely replaced
by this, and the state variable dictionary has been removed from the
Command Interpreter. Places that formerly accessed the state variable
mechanism have been modified to access the variables in this new
structure instead (checking the term-width; getting/checking the
prompt; etc.)
Variables are attached to classes; there are two basic "flavors" of
variables that can be set: "global" variables (static/class-wide), and
"instance" variables (one per instance of the class). The whole thing
has been set up so that any global or instance variable can be set at
any time (e.g. on start up, in your .lldbinit file), whether or not
any instances actually exist (there's a whole pending and default
values mechanism to help deal with that).
llvm-svn: 113041
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 36 | ||||
| -rw-r--r-- | lldb/source/API/SBDebugger.cpp | 34 |
2 files changed, 48 insertions, 22 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index b2cb639284ad..c40d7cc37e5c 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -107,17 +107,17 @@ SBCommandInterpreter::HandleCompletion (const char *current_line, return num_completions; } -const char ** -SBCommandInterpreter::GetEnvironmentVariables () -{ - if (m_opaque_ptr) - { - const Args *env_vars = m_opaque_ptr->GetEnvironmentVariables(); - if (env_vars) - return env_vars->GetConstArgumentVector (); - } - return NULL; -} +//const char ** +//SBCommandInterpreter::GetEnvironmentVariables () +//{ +// if (m_opaque_ptr) +// { +// //const Args *env_vars = m_opaque_ptr->GetEnvironmentVariables(); +// //if (env_vars) +// // return env_vars->GetConstArgumentVector (); +// } +// return NULL; +//} bool SBCommandInterpreter::HasCommands () @@ -151,13 +151,13 @@ SBCommandInterpreter::HasAliasOptions () return false; } -bool -SBCommandInterpreter::HasInterpreterVariables () -{ - if (m_opaque_ptr) - return m_opaque_ptr->HasInterpreterVariables (); - return false; -} +//bool +//SBCommandInterpreter::HasInterpreterVariables () +//{ +// if (m_opaque_ptr) +// return m_opaque_ptr->HasInterpreterVariables (); +// return false; +//} SBProcess SBCommandInterpreter::GetProcess () diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index fe2b99a2dc28..7af39038c9b8 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -22,11 +22,12 @@ #include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBEvent.h" #include "lldb/API/SBFrame.h" -#include "lldb/API/SBTarget.h" +#include "lldb/API/SBInputReader.h" #include "lldb/API/SBProcess.h" -#include "lldb/API/SBThread.h" #include "lldb/API/SBSourceManager.h" -#include "lldb/API/SBInputReader.h" +#include "lldb/API/SBStringList.h" +#include "lldb/API/SBTarget.h" +#include "lldb/API/SBThread.h" using namespace lldb; using namespace lldb_private; @@ -564,6 +565,32 @@ SBDebugger::FindDebuggerWithID (int id) return sb_debugger; } +SBError +SBDebugger::SetInternalVariable (const char *var_name, const char *value) +{ + lldb::UserSettingsControllerSP root_settings_controller = lldb_private::Debugger::GetSettingsController(); + + Error err = root_settings_controller->SetVariable (var_name, value, lldb::eVarSetOperationAssign, false); + SBError sb_error; + sb_error.SetError (err); + + return sb_error; +} + +lldb::SBStringList +SBDebugger::GetInternalVariableValue (const char *var_name) +{ + SBStringList ret_value; + lldb::UserSettingsControllerSP root_settings_controller = lldb_private::Debugger::GetSettingsController(); + + lldb::SettableVariableType var_type; + StringList value = root_settings_controller->GetVariable (var_name, var_type); + for (int i = 0; i < value.GetSize(); ++i) + ret_value.AppendString (value.GetStringAtIndex(i)); + + return ret_value; +} + bool SBDebugger::SetUseExternalEditor (bool value) { @@ -582,4 +609,3 @@ SBDebugger::UseExternalEditor () return false; } - |
