summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBCommandReturnObject.cpp26
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp16
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp20
-rw-r--r--lldb/source/Commands/CommandObjectMultiword.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectRegister.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectVersion.cpp3
-rw-r--r--lldb/source/Core/UserSettingsController.cpp16
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp6
-rw-r--r--lldb/source/Interpreter/CommandReturnObject.cpp37
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp20
12 files changed, 88 insertions, 66 deletions
diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp
index 69dcab68432..8377c1fc3a1 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -63,9 +63,9 @@ SBCommandReturnObject::GetOutput ()
{
if (log)
log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"", m_opaque_ap.get(),
- m_opaque_ap->GetOutputStream().GetData());
+ m_opaque_ap->GetOutputData());
- return m_opaque_ap->GetOutputStream().GetData();
+ return m_opaque_ap->GetOutputData();
}
if (log)
@@ -83,9 +83,9 @@ SBCommandReturnObject::GetError ()
{
if (log)
log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"", m_opaque_ap.get(),
- m_opaque_ap->GetErrorStream().GetData());
+ m_opaque_ap->GetErrorData());
- return m_opaque_ap->GetErrorStream().GetData();
+ return m_opaque_ap->GetErrorData();
}
if (log)
@@ -98,7 +98,7 @@ size_t
SBCommandReturnObject::GetOutputSize ()
{
if (m_opaque_ap.get())
- return m_opaque_ap->GetOutputStream().GetSize();
+ return strlen (m_opaque_ap->GetOutputData());
return 0;
}
@@ -106,7 +106,7 @@ size_t
SBCommandReturnObject::GetErrorSize ()
{
if (m_opaque_ap.get())
- return m_opaque_ap->GetErrorStream().GetSize();
+ return strlen(m_opaque_ap->GetErrorData());
return 0;
}
@@ -234,3 +234,17 @@ SBCommandReturnObject::GetDescription (SBStream &description)
return true;
}
+
+void
+SBCommandReturnObject::SetImmediateOutputFile (FILE *fh)
+{
+ if (m_opaque_ap.get())
+ m_opaque_ap->SetImmediateOutputFile (fh);
+}
+
+void
+SBCommandReturnObject::SetImmediateErrorFile (FILE *fh)
+{
+ if (m_opaque_ap.get())
+ m_opaque_ap->SetImmediateErrorFile (fh);
+}
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index 4dff1420c4e..e291d93df56 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -34,7 +34,7 @@ using namespace lldb;
using namespace lldb_private;
static void
-AddBreakpointDescription (StreamString *s, Breakpoint *bp, lldb::DescriptionLevel level)
+AddBreakpointDescription (Stream *s, Breakpoint *bp, lldb::DescriptionLevel level)
{
s->IndentMore();
bp->GetDescription (s, level, true);
@@ -370,8 +370,8 @@ CommandObjectBreakpointSet::Execute
m_options.m_check_inlines).get();
if (bp)
{
- StreamString &output_stream = result.GetOutputStream();
- output_stream.Printf ("Breakpoint created: ");
+ Stream &output_stream = result.GetOutputStream();
+ result.AppendMessage ("Breakpoint created: ");
bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
output_stream.EOL();
if (bp->GetNumLocations() == 0)
@@ -417,7 +417,7 @@ CommandObjectBreakpointSet::Execute
Breakpoint::Exact).get();
if (bp)
{
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
output_stream.Printf ("Breakpoint created: ");
bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
output_stream.EOL();
@@ -450,7 +450,7 @@ CommandObjectBreakpointSet::Execute
bp = target->CreateBreakpoint (&module_spec, regexp).get();
if (bp)
{
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
output_stream.Printf ("Breakpoint created: ");
bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
output_stream.EOL();
@@ -497,7 +497,7 @@ CommandObjectBreakpointSet::Execute
if (bp && !use_module)
{
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
output_stream.Printf ("Breakpoint created: ");
bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
output_stream.EOL();
@@ -775,7 +775,7 @@ CommandObjectBreakpointList::Execute
return true;
}
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
if (args.GetArgumentCount() == 0)
{
@@ -1212,7 +1212,7 @@ CommandObjectBreakpointClear::Execute
if (num_cleared > 0)
{
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
output_stream.Printf ("%d breakpoints cleared:\n", num_cleared);
output_stream << ss.GetData();
output_stream.EOL();
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index edca869e48a..f88264b6c1b 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -790,15 +790,19 @@ CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction
BreakpointOptions::CommandData *data = (BreakpointOptions::CommandData *) baton;
StringList &commands = data->user_source;
-
+
if (commands.GetSize() > 0)
{
- CommandReturnObject result;
if (context->exe_ctx.target)
{
-
+ CommandReturnObject result;
Debugger &debugger = context->exe_ctx.target->GetDebugger();
-
+ // Rig up the results secondary output stream to the debugger's, so the output will come out synchronously
+ // if the debugger is set up that way.
+
+ result.SetImmediateOutputFile (debugger.GetOutputFile().GetStream());
+ result.SetImmediateErrorFile (debugger.GetErrorFile().GetStream());
+
bool stop_on_continue = true;
bool echo_commands = false;
bool print_results = true;
@@ -810,14 +814,6 @@ CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction
echo_commands,
print_results,
result);
- // Now dump the commands to the debugger's output:
- if (!result.Succeeded())
- {
- debugger.GetErrorFile().Printf ("%s", result.GetErrorStream().GetData());
- }
-
- debugger.GetOutputFile().Printf ("%s", result.GetOutputStream().GetData());
-
}
}
return ret_value;
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index db500a7f66c..e5435fc648a 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -187,7 +187,7 @@ CommandObjectMultiword::GenerateHelpText (CommandReturnObject &result)
// First time through here, generate the help text for the object and
// push it to the return result object as well
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
output_stream.PutCString ("The following subcommands are supported:\n\n");
CommandMap::iterator pos;
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 7329ccbb1d9..22fd6c2406b 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -1483,7 +1483,7 @@ public:
CommandReturnObject &result
)
{
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.process)
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index 4bcf681f633..d9cb5de6fe6 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -65,7 +65,7 @@ public:
CommandReturnObject &result
)
{
- StreamString &output_stream = result.GetOutputStream();
+ Stream &output_stream = result.GetOutputStream();
DataExtractor reg_data;
ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
RegisterContext *reg_context = exe_ctx.GetRegisterContext ();
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index af11fa7bf6f..487cfc96b56 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -131,7 +131,7 @@ lldb_private::DisplayThreadsInfo
if (num_thread_infos_dumped < num_threads)
result.GetOutputStream().Printf("%u of %u threads stopped with reasons:\n", num_thread_infos_dumped, num_threads);
- result.GetOutputStream().GetString().append(strm.GetString());
+ result.AppendMessage (strm.GetString().c_str());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
return num_thread_infos_dumped;
@@ -1379,7 +1379,7 @@ public:
CommandReturnObject &result
)
{
- StreamString &strm = result.GetOutputStream();
+ Stream &strm = result.GetOutputStream();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.process)
diff --git a/lldb/source/Commands/CommandObjectVersion.cpp b/lldb/source/Commands/CommandObjectVersion.cpp
index 5e159e1cbc8..99b92e7a407 100644
--- a/lldb/source/Commands/CommandObjectVersion.cpp
+++ b/lldb/source/Commands/CommandObjectVersion.cpp
@@ -40,8 +40,7 @@ CommandObjectVersion::Execute
CommandReturnObject &result
)
{
- StreamString &output_stream = result.GetOutputStream();
- output_stream.Printf ("%s\n", lldb_private::GetVersion());
+ result.AppendMessageWithFormat ("%s\n", lldb_private::GetVersion());
result.SetStatus (eReturnStatusSuccessFinishResult);
return true;
}
diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp
index f9d6c68dfd3..60c2aa36b13 100644
--- a/lldb/source/Core/UserSettingsController.cpp
+++ b/lldb/source/Core/UserSettingsController.cpp
@@ -22,7 +22,7 @@ using namespace lldb_private;
static void
DumpSettingEntry (CommandInterpreter &interpreter,
- StreamString &result_stream,
+ Stream &result_stream,
const uint32_t max_len,
const SettingEntry &entry)
{
@@ -802,7 +802,7 @@ UserSettingsController::PendingSettingsForInstance (const ConstString &instance_
}
void
-UserSettingsController::GetAllDefaultSettingValues (StreamString &result_stream)
+UserSettingsController::GetAllDefaultSettingValues (Stream &result_stream)
{
std::string parent_prefix;
BuildParentPrefix (parent_prefix);
@@ -845,7 +845,7 @@ UserSettingsController::GetAllDefaultSettingValues (StreamString &result_stream)
}
void
-UserSettingsController::GetAllPendingSettingValues (StreamString &result_stream)
+UserSettingsController::GetAllPendingSettingValues (Stream &result_stream)
{
std::map<std::string, InstanceSettingsSP>::iterator pos;
@@ -913,7 +913,7 @@ UserSettingsController::FindSettingsForInstance (const ConstString &instance_nam
void
UserSettingsController::GetAllInstanceVariableValues (CommandInterpreter &interpreter,
- StreamString &result_stream)
+ Stream &result_stream)
{
std::map<std::string, InstanceSettings *>::iterator pos;
std::string parent_prefix;
@@ -1092,7 +1092,7 @@ void
UserSettingsController::FindAllSettingsDescriptions (CommandInterpreter &interpreter,
UserSettingsControllerSP root,
std::string &current_prefix,
- StreamString &result_stream,
+ Stream &result_stream,
Error &err)
{
// Write out current prefix line.
@@ -1156,7 +1156,7 @@ UserSettingsController::FindSettingsDescriptions (CommandInterpreter &interprete
UserSettingsControllerSP root,
std::string &current_prefix,
const char *search_name,
- StreamString &result_stream,
+ Stream &result_stream,
Error &err)
{
Args names = UserSettingsController::BreakNameIntoPieces (search_name);
@@ -1310,7 +1310,7 @@ UserSettingsController::SearchAllSettingsDescriptions (CommandInterpreter &inter
UserSettingsControllerSP root,
std::string &current_prefix,
const char *search_word,
- StreamString &result_stream)
+ Stream &result_stream)
{
if ((search_word == NULL) || (strlen (search_word) == 0))
return;
@@ -1378,7 +1378,7 @@ void
UserSettingsController::GetAllVariableValues (CommandInterpreter &interpreter,
UserSettingsControllerSP root,
std::string &current_prefix,
- StreamString &result_stream,
+ Stream &result_stream,
Error &err)
{
StreamString description;
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index b6cd3c73818..a6906709340 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1518,6 +1518,8 @@ CommandInterpreter::HandleCommands (StringList &commands,
{
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.
@@ -1554,7 +1556,7 @@ CommandInterpreter::HandleCommands (StringList &commands,
if (print_results)
{
if (tmp_result.Succeeded())
- result.AppendMessageWithFormat("%s", tmp_result.GetOutputStream().GetData());
+ result.AppendMessageWithFormat("%s", tmp_result.GetOutputData());
}
if (!success || !tmp_result.Succeeded())
@@ -1572,7 +1574,7 @@ CommandInterpreter::HandleCommands (StringList &commands,
result.AppendMessageWithFormat ("Command #%d '%s' failed with error: %s.\n",
idx + 1,
cmd,
- tmp_result.GetErrorStream().GetData());
+ tmp_result.GetErrorData());
}
}
diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp
index f634e3c7df5..3faf912bd7d 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -19,6 +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_status (eReturnStatusStarted),
@@ -30,18 +32,6 @@ CommandReturnObject::~CommandReturnObject ()
{
}
-StreamString &
-CommandReturnObject::GetOutputStream ()
-{
- return m_output_stream;
-}
-
-StreamString &
-CommandReturnObject::GetErrorStream ()
-{
- return m_error_stream;
-}
-
void
CommandReturnObject::AppendErrorWithFormat (const char *format, ...)
{
@@ -51,10 +41,9 @@ CommandReturnObject::AppendErrorWithFormat (const char *format, ...)
sstrm.PrintfVarArg(format, args);
va_end (args);
- m_error_stream.Printf("error: %s", sstrm.GetData());
+ GetErrorStream().Printf("error: %s", sstrm.GetData());
}
-
void
CommandReturnObject::AppendMessageWithFormat (const char *format, ...)
{
@@ -64,7 +53,7 @@ CommandReturnObject::AppendMessageWithFormat (const char *format, ...)
sstrm.PrintfVarArg(format, args);
va_end (args);
- m_output_stream.Printf("%s", sstrm.GetData());
+ GetOutputStream().Printf("%s", sstrm.GetData());
}
void
@@ -76,7 +65,7 @@ CommandReturnObject::AppendWarningWithFormat (const char *format, ...)
sstrm.PrintfVarArg(format, args);
va_end (args);
- m_error_stream.Printf("warning: %s", sstrm.GetData());
+ GetErrorStream().Printf("warning: %s", sstrm.GetData());
}
void
@@ -84,7 +73,7 @@ CommandReturnObject::AppendMessage (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_output_stream.Printf("%*.*s\n", len, len, in_string);
+ GetOutputStream().Printf("%*.*s\n", len, len, in_string);
}
void
@@ -92,7 +81,7 @@ CommandReturnObject::AppendWarning (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf("warning: %*.*s\n", len, len, in_string);
+ GetErrorStream().Printf("warning: %*.*s\n", len, len, in_string);
}
// Similar to AppendWarning, but do not prepend 'warning: ' to message, and
@@ -103,7 +92,7 @@ CommandReturnObject::AppendRawWarning (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf("%*.*s", len, len, in_string);
+ GetErrorStream().Printf("%*.*s", len, len, in_string);
}
void
@@ -114,7 +103,7 @@ CommandReturnObject::AppendError (const char *in_string, int len)
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf ("error: %*.*s\n", len, len, in_string);
+ GetErrorStream().Printf ("error: %*.*s\n", len, len, in_string);
}
// Similar to AppendError, but do not prepend 'Error: ' to message, and
@@ -125,7 +114,7 @@ CommandReturnObject::AppendRawError (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf ("%*.*s", len, len, in_string);
+ GetErrorStream().Printf ("%*.*s", len, len, in_string);
}
void
@@ -156,8 +145,10 @@ CommandReturnObject::HasResult ()
void
CommandReturnObject::Clear()
{
- m_output_stream.Clear();
- m_error_stream.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();
m_status = eReturnStatusStarted;
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index a877aeae35f..9b7f20561b7 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -433,6 +433,26 @@ SymbolContext::FindTypeByName (const ConstString &name) const
return return_value;
}
+//SymbolContext
+//SymbolContext::CreateSymbolContextFromDescription (lldb::TargetSP &target_sp,
+// const char *module,
+// const char *comp_unit,
+// const char *function,
+// const char *block_spec
+// const char *line_number,
+// const char *symbol)
+//{
+// SymbolContext sc;
+// sc.target = target_sp;
+//
+// if (module != NULL && module[0] != '0')
+// {
+//
+// }
+//
+// return sc;
+//}
+
//----------------------------------------------------------------------
//
// SymbolContextList
OpenPOWER on IntegriCloud