[Lldb-commits] [lldb] r132517 - in /lldb/trunk: include/lldb/Core/Debugger.h source/Breakpoint/BreakpointLocation.cpp source/Commands/CommandObjectBreakpointCommand.cpp source/Core/Debugger.cpp source/Target/Target.cpp
Jim Ingham
jingham at apple.com
Thu Jun 2 16:58:26 PDT 2011
Author: jingham
Date: Thu Jun 2 18:58:26 2011
New Revision: 132517
URL: http://llvm.org/viewvc/llvm-project?rev=132517&view=rev
Log:
Added Debugger::GetAsync{Output/Error}Stream, and use it to print parse errors when we go to run a breakpoint condition.
Modified:
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=132517&r1=132516&r2=132517&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Thu Jun 2 18:58:26 2011
@@ -321,6 +321,12 @@
return m_error_file;
}
+ lldb::StreamSP
+ GetAsyncOutputStream ();
+
+ lldb::StreamSP
+ GetAsyncErrorStream ();
+
CommandInterpreter &
GetCommandInterpreter ()
{
Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=132517&r1=132516&r2=132517&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Thu Jun 2 18:58:26 2011
@@ -16,6 +16,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/BreakpointID.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlan.h"
@@ -219,9 +220,6 @@
if (m_hit_count <= GetIgnoreCount())
return false;
- // Next in order of importance is the condition. See if it is true:
- StreamString errors;
-
// We only run synchronous callbacks in ShouldStop:
context->is_synchronous = true;
should_stop = InvokeCallback (context);
@@ -230,29 +228,40 @@
if (should_stop)
{
+ // We need to make sure the user sees any parse errors in their condition, so we'll hook the
+ // constructor errors up to the debugger's Async I/O.
+
+ StreamString errors;
ThreadPlanSP condition_plan_sp(GetThreadPlanToTestCondition(context->exe_ctx, errors));
- log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
- if (log && errors.GetSize() > 0)
+
+ if (condition_plan_sp == NULL)
{
- log->Printf("Error evaluating condition: \"%s\".\n", errors.GetData());
+ if (log)
+ log->Printf("Error evaluating condition: \"%s\"\n", errors.GetData());
+
+ Debugger &debugger = context->exe_ctx.target->GetDebugger();
+ StreamSP error_sp = debugger.GetAsyncErrorStream ();
+ error_sp->PutCString ("Error parsing breakpoint condition:\n");
+ error_sp->PutCString (errors.GetData());
+ error_sp->EOL();
+ error_sp->Flush();
+
}
- else if (condition_plan_sp != NULL)
+ else
{
+ // Queue our condition, then continue so that we can run it.
context->exe_ctx.thread->QueueThreadPlan(condition_plan_sp, false);
- return false;
+ should_stop = false;
}
}
- if (should_stop)
+ if (log)
{
- log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
- if (log)
- {
- StreamString s;
- GetDescription (&s, lldb::eDescriptionLevelVerbose);
- log->Printf ("Hit breakpoint location: %s\n", s.GetData());
- }
+ StreamString s;
+ GetDescription (&s, lldb::eDescriptionLevelVerbose);
+ log->Printf ("Hit breakpoint location: %s, %s.\n", s.GetData(), should_stop ? "stopping" : "continuing");
}
+
return should_stop;
}
Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=132517&r1=132516&r2=132517&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Thu Jun 2 18:58:26 2011
@@ -803,10 +803,8 @@
// 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.
- StreamSP output_stream (new StreamAsynchronousIO (debugger.GetCommandInterpreter(),
- CommandInterpreter::eBroadcastBitAsynchronousOutputData));
- StreamSP error_stream (new StreamAsynchronousIO (debugger.GetCommandInterpreter(),
- CommandInterpreter::eBroadcastBitAsynchronousErrorData));
+ StreamSP output_stream (debugger.GetAsyncOutputStream());
+ StreamSP error_stream (debugger.GetAsyncErrorStream());
result.SetImmediateOutputStream (output_stream);
result.SetImmediateErrorStream (error_stream);
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=132517&r1=132516&r2=132517&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Jun 2 18:58:26 2011
@@ -13,6 +13,7 @@
#include "lldb/Core/InputReader.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/State.h"
+#include "lldb/Core/StreamAsynchronousIO.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Terminal.h"
@@ -600,6 +601,20 @@
}
}
+StreamSP
+Debugger::GetAsyncOutputStream ()
+{
+ return StreamSP (new StreamAsynchronousIO (GetCommandInterpreter(),
+ CommandInterpreter::eBroadcastBitAsynchronousOutputData));
+}
+
+StreamSP
+Debugger::GetAsyncErrorStream ()
+{
+ return StreamSP (new StreamAsynchronousIO (GetCommandInterpreter(),
+ CommandInterpreter::eBroadcastBitAsynchronousErrorData));
+}
+
DebuggerSP
Debugger::FindDebuggerWithID (lldb::user_id_t id)
{
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=132517&r1=132516&r2=132517&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu Jun 2 18:58:26 2011
@@ -1199,12 +1199,8 @@
if (num_exe_ctx == 0)
return;
- StreamSP output_stream (new StreamAsynchronousIO (m_debugger.GetCommandInterpreter(),
- CommandInterpreter::eBroadcastBitAsynchronousOutputData));
- StreamSP error_stream (new StreamAsynchronousIO (m_debugger.GetCommandInterpreter(),
- CommandInterpreter::eBroadcastBitAsynchronousErrorData));
- result.SetImmediateOutputStream (output_stream);
- result.SetImmediateErrorStream (error_stream);
+ result.SetImmediateOutputStream (m_debugger.GetAsyncOutputStream());
+ result.SetImmediateErrorStream (m_debugger.GetAsyncErrorStream());
bool keep_going = true;
bool hooks_ran = false;
More information about the lldb-commits
mailing list