summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp49
-rw-r--r--lldb/source/Interpreter/CommandObject.cpp19
-rw-r--r--lldb/source/Interpreter/CommandReturnObject.cpp18
3 files changed, 53 insertions, 33 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index a6906709340..fbe47d2c210 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -92,27 +92,27 @@ CommandInterpreter::Initialize ()
LoadCommandDictionary ();
// Set up some initial aliases.
- result.Clear(); HandleCommand ("command alias q quit", false, result);
- result.Clear(); HandleCommand ("command alias run process launch --", false, result);
- result.Clear(); HandleCommand ("command alias r process launch --", false, result);
- result.Clear(); HandleCommand ("command alias c process continue", false, result);
- result.Clear(); HandleCommand ("command alias continue process continue", false, result);
- result.Clear(); HandleCommand ("command alias expr expression", false, result);
- result.Clear(); HandleCommand ("command alias exit quit", false, result);
- result.Clear(); HandleCommand ("command alias b regexp-break", false, result);
- result.Clear(); HandleCommand ("command alias bt thread backtrace", false, result);
- result.Clear(); HandleCommand ("command alias si thread step-inst", false, result);
- result.Clear(); HandleCommand ("command alias step thread step-in", false, result);
- result.Clear(); HandleCommand ("command alias s thread step-in", false, result);
- result.Clear(); HandleCommand ("command alias next thread step-over", false, result);
- result.Clear(); HandleCommand ("command alias n thread step-over", false, result);
- result.Clear(); HandleCommand ("command alias finish thread step-out", false, result);
- result.Clear(); HandleCommand ("command alias x memory read", false, result);
- result.Clear(); HandleCommand ("command alias l source list", false, result);
- result.Clear(); HandleCommand ("command alias list source list", false, result);
- result.Clear(); HandleCommand ("command alias p frame variable", false, result);
- result.Clear(); HandleCommand ("command alias print frame variable", false, result);
- result.Clear(); HandleCommand ("command alias po expression -o --", false, result);
+ HandleCommand ("command alias q quit", false, result);
+ HandleCommand ("command alias run process launch --", false, result);
+ HandleCommand ("command alias r process launch --", false, result);
+ HandleCommand ("command alias c process continue", false, result);
+ HandleCommand ("command alias continue process continue", false, result);
+ HandleCommand ("command alias expr expression", false, result);
+ HandleCommand ("command alias exit quit", false, result);
+ HandleCommand ("command alias b regexp-break", false, result);
+ HandleCommand ("command alias bt thread backtrace", false, result);
+ HandleCommand ("command alias si thread step-inst", false, result);
+ HandleCommand ("command alias step thread step-in", false, result);
+ HandleCommand ("command alias s thread step-in", false, result);
+ HandleCommand ("command alias next thread step-over", false, result);
+ HandleCommand ("command alias n thread step-over", false, result);
+ HandleCommand ("command alias finish thread step-out", false, result);
+ HandleCommand ("command alias x memory read", false, result);
+ HandleCommand ("command alias l source list", false, result);
+ HandleCommand ("command alias list source list", false, result);
+ HandleCommand ("command alias p frame variable", false, result);
+ HandleCommand ("command alias print frame variable", false, result);
+ HandleCommand ("command alias po expression -o --", false, result);
}
const char *
@@ -1517,9 +1517,6 @@ CommandInterpreter::HandleCommands (StringList &commands,
CommandReturnObject &result)
{
size_t num_lines = commands.GetSize();
- CommandReturnObject tmp_result;
- tmp_result.SetImmediateOutputStream (result.GetImmediateOutputStream ());
- tmp_result.SetImmediateErrorStream (result.GetImmediateErrorStream ());
// If we are going to continue past a "continue" then we need to run the commands synchronously.
// Make sure you reset this value anywhere you return from the function.
@@ -1543,7 +1540,6 @@ CommandInterpreter::HandleCommands (StringList &commands,
if (cmd[0] == '\0')
continue;
- tmp_result.Clear();
if (echo_commands)
{
result.AppendMessageWithFormat ("%s %s\n",
@@ -1551,6 +1547,9 @@ CommandInterpreter::HandleCommands (StringList &commands,
cmd);
}
+ CommandReturnObject tmp_result;
+ tmp_result.SetImmediateOutputStream (result.GetImmediateOutputStream ());
+ tmp_result.SetImmediateErrorStream (result.GetImmediateErrorStream ());
bool success = HandleCommand(cmd, false, tmp_result, NULL);
if (print_results)
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index 2f88a4893c0..b0446d05a45 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -600,6 +600,23 @@ BreakpointIDRangeHelpTextCallback ()
return "A 'breakpoint id list' is a manner of specifying multiple breakpoints. This can be done through several mechanisms. The easiest way is to just enter a space-separated list of breakpoint ids. To specify all the breakpoint locations under a major breakpoint, you can use the major breakpoint number followed by '.*', eg. '5.*' means all the locations under breakpoint 5. You can also indicate a range of breakpoints by using <start-bp-id> - <end-bp-id>. The start-bp-id and end-bp-id for a range can be any valid breakpoint ids. It is not legal, however, to specify a range using specific locations that cross major breakpoint numbers. I.e. 3.2 - 3.7 is legal; 2 - 5 is legal; but 3.2 - 4.4 is not legal.";
}
+const char *
+CommandObject::GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type)
+{
+ if (arg_type >=0 && arg_type < eArgTypeLastArg)
+ return g_arguments_data[arg_type].arg_name;
+ return NULL;
+
+}
+
+const char *
+CommandObject::GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type)
+{
+ if (arg_type >=0 && arg_type < eArgTypeLastArg)
+ return g_arguments_data[arg_type].help_text;
+ return NULL;
+}
+
CommandObject::ArgumentTableEntry
CommandObject::g_arguments_data[] =
{
@@ -667,6 +684,8 @@ CommandObject::g_arguments_data[] =
const CommandObject::ArgumentTableEntry*
CommandObject::GetArgumentTable ()
{
+ // If this assertion fires, then the table above is out of date with the CommandArgumentType enumeration
+ assert ((sizeof (CommandObject::g_arguments_data) / sizeof (CommandObject::ArgumentTableEntry)) == eArgTypeLastArg);
return CommandObject::g_arguments_data;
}
diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp
index 3faf912bd7d..9d32279edab 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -19,10 +19,8 @@ using namespace lldb;
using namespace lldb_private;
CommandReturnObject::CommandReturnObject () :
- m_error_stream_string_sp (),
- m_output_stream_string_sp (),
- m_output_stream (),
- m_error_stream (),
+ m_out_stream (),
+ m_err_stream (),
m_status (eReturnStatusStarted),
m_did_change_process_state (false)
{
@@ -145,11 +143,15 @@ CommandReturnObject::HasResult ()
void
CommandReturnObject::Clear()
{
- if (m_output_stream_string_sp)
- static_cast<StreamString *>(m_output_stream_string_sp.get())->Clear();
- if (m_error_stream_string_sp)
- static_cast<StreamString *>(m_error_stream_string_sp.get())->Clear();
+ lldb::StreamSP stream_sp;
+ stream_sp = m_out_stream.GetStreamAtIndex (eStreamStringIndex);
+ if (stream_sp)
+ static_cast<StreamString *>(stream_sp.get())->Clear();
+ stream_sp = m_err_stream.GetStreamAtIndex (eStreamStringIndex);
+ if (stream_sp)
+ static_cast<StreamString *>(stream_sp.get())->Clear();
m_status = eReturnStatusStarted;
+ m_did_change_process_state = false;
}
bool
OpenPOWER on IntegriCloud