[Lldb-commits] [lldb] r156006 - in /lldb/branches/lldb-platform-work: ./ include/lldb/Breakpoint/ include/lldb/Target/ lldb.xcodeproj/ source/Breakpoint/ source/Commands/ source/Symbol/ source/Target/
Johnny Chen
johnny.chen at apple.com
Wed May 2 10:54:52 PDT 2012
Author: johnny
Date: Wed May 2 12:54:52 2012
New Revision: 156006
URL: http://llvm.org/viewvc/llvm-project?rev=156006&view=rev
Log:
Merge changes from ToT trunk:
svn merge -r 155750:155973 https://johnny@llvm.org/svn/llvm-project/lldb/trunk .
Removed:
lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanTestCondition.h
lldb/branches/lldb-platform-work/source/Target/ThreadPlanTestCondition.cpp
Modified:
lldb/branches/lldb-platform-work/ (props changed)
lldb/branches/lldb-platform-work/include/lldb/Breakpoint/Breakpoint.h
lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointLocation.h
lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h
lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h
lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepInRange.h
lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h
lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepRange.h
lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
lldb/branches/lldb-platform-work/source/Breakpoint/Breakpoint.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointOptions.cpp
lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp
lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp
lldb/branches/lldb-platform-work/source/Target/Thread.cpp
lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp
lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepInRange.cpp
lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp
lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp
Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 2 12:54:52 2012
@@ -1 +1 @@
-/lldb/trunk:154223-155750
+/lldb/trunk:154223-155973
Modified: lldb/branches/lldb-platform-work/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Breakpoint/Breakpoint.h?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Breakpoint/Breakpoint.h Wed May 2 12:54:52 2012
@@ -412,25 +412,6 @@
void SetCondition (const char *condition);
//------------------------------------------------------------------
- /// Test the breakpoint condition in the Execution context passed in.
- ///
- /// @param[in] exe_ctx
- /// The execution context in which to evaluate this expression.
- ///
- /// @param[in] break_loc_sp
- /// A shared pointer to the location that we are testing thsi condition for.
- ///
- /// @param[in] error
- /// Error messages will be written to this stream.
- ///
- /// @return
- /// A thread plan to run to test the condition or NULL if no condition.
- //------------------------------------------------------------------
- ThreadPlan *GetThreadPlanToTestCondition (ExecutionContext &exe_ctx,
- lldb::BreakpointLocationSP break_loc_sp,
- Stream &error);
-
- //------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
Modified: lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointLocation.h?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointLocation.h Wed May 2 12:54:52 2012
@@ -167,23 +167,7 @@
//------------------------------------------------------------------
void
SetCondition (const char *condition);
-
- //------------------------------------------------------------------
- /// Test the breakpoint location's condition in the Execution context passed in.
- ///
- /// @param[in] exe_ctx
- /// The execution context in which to evaluate this expression.
- ///
- /// @param[in] error
- /// Error messages will be written to this stream.
- ///
- /// @return
- /// A thread plan to run to test the condition, or NULL if there is no condition.
- //------------------------------------------------------------------
- ThreadPlan *
- GetThreadPlanToTestCondition (ExecutionContext &exe_ctx,
- Stream &error);
-
+
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
Modified: lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Breakpoint/BreakpointOptions.h Wed May 2 12:54:52 2012
@@ -177,25 +177,6 @@
void SetCondition (const char *condition);
//------------------------------------------------------------------
- /// Test the breakpoint condition in the Execution context passed in.
- ///
- /// @param[in] exe_ctx
- /// The execution context in which to evaluate this expression.
- ///
- /// @param[in] break_loc_sp
- /// A shared pointer to the location that we are testing thsi condition for.
- ///
- /// @param[in] error
- /// Error messages will be written to this stream.
- ///
- /// @return
- /// A thread plan to run to test the condition, or NULL if there is no thread plan.
- //------------------------------------------------------------------
- ThreadPlan *GetThreadPlanToTestCondition (ExecutionContext &exe_ctx,
- const lldb::BreakpointLocationSP& break_loc_sp,
- Stream &error);
-
- //------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// @return
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlan.h Wed May 2 12:54:52 2012
@@ -142,6 +142,16 @@
// all threads will be called, the stop event is placed on the Process's public broadcaster, and
// control returns to the upper layers of the debugger.
//
+// Reporting the stop:
+//
+// When the process stops, the thread is given a StopReason, in the form of a StopInfo object. If there is a completed
+// plan corresponding to the stop, then the "actual" stop reason will be suppressed, and instead a StopInfoThreadPlan
+// object will be cons'ed up from the highest completed plan in the stack. However, if the plan doesn't want to be
+// the stop reason, then it can call SetPlanComplete and pass in "false" for the "success" parameter. In that case,
+// the real stop reason will be used instead. One exapmle of this is the "StepRangeStepIn" thread plan. If it stops
+// because of a crash or breakpoint hit, it wants to unship itself, because it isn't so useful to have step in keep going
+// after a breakpoint hit. But it can't be the reason for the stop or no-one would see that they had hit a breakpoint.
+//
// Automatically Resuming:
//
// If ShouldStop for all threads returns "false", then the target process will resume. This then cycles back to
@@ -396,7 +406,13 @@
IsPlanComplete();
void
- SetPlanComplete ();
+ SetPlanComplete (bool success = true);
+
+ bool
+ PlanSucceeded ()
+ {
+ return m_plan_succeeded;
+ }
virtual bool
IsBasePlan()
@@ -489,6 +505,7 @@
bool m_plan_private;
bool m_okay_to_discard;
bool m_is_master_plan;
+ bool m_plan_succeeded;
lldb::ThreadPlanTracerSP m_tracer_sp;
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepInRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepInRange.h?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepInRange.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepInRange.h Wed May 2 12:54:52 2012
@@ -49,6 +49,9 @@
static void
SetDefaultFlagValue (uint32_t new_value);
+ virtual bool
+ PlanExplainsStop ();
+
protected:
virtual void
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepOverRange.h Wed May 2 12:54:52 2012
@@ -35,6 +35,7 @@
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
virtual bool ShouldStop (Event *event_ptr);
+ virtual bool PlanExplainsStop ();
protected:
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepRange.h?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepRange.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanStepRange.h Wed May 2 12:54:52 2012
@@ -42,7 +42,6 @@
virtual lldb::StateType GetPlanRunState ();
virtual bool WillStop ();
virtual bool MischiefManaged ();
- virtual bool PlanExplainsStop ();
virtual void DidPush ();
Removed: lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanTestCondition.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanTestCondition.h?rev=156005&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanTestCondition.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/ThreadPlanTestCondition.h (removed)
@@ -1,65 +0,0 @@
-//===-- ThreadPlanTestCondition.h -----------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ThreadPlanTestCondition_h_
-#define liblldb_ThreadPlanTestCondition_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/AddressRange.h"
-#include "lldb/Target/ExecutionContext.h"
-#include "lldb/Expression/ClangUserExpression.h"
-#include "lldb/Target/StackID.h"
-#include "lldb/Target/Thread.h"
-#include "lldb/Target/ThreadPlan.h"
-#include "lldb/Target/ThreadPlanShouldStopHere.h"
-
-namespace lldb_private {
-
-class ThreadPlanTestCondition : public ThreadPlan
-{
-public:
- virtual ~ThreadPlanTestCondition ();
-
- ThreadPlanTestCondition (Thread &thread,
- ExecutionContext &exe_ctx,
- ClangUserExpression *expression,
- const lldb::BreakpointLocationSP &break_loc_sp,
- bool stop_others);
-
- virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
- virtual bool ValidatePlan (Stream *error);
- virtual bool PlanExplainsStop ();
- virtual bool ShouldStop (Event *event_ptr);
- virtual Vote ShouldReportStop (Event *event_ptr);
- virtual bool StopOthers ();
- virtual lldb::StateType GetPlanRunState ();
- virtual bool WillStop ();
- virtual bool MischiefManaged ();
- virtual void DidPush ();
-
-protected:
-
-private:
- ClangUserExpression *m_expression;
- ExecutionContext m_exe_ctx;
- lldb::ThreadPlanSP m_expression_plan_sp;
- lldb::BreakpointLocationSP m_break_loc_sp;
- bool m_did_stop;
- bool m_stop_others;
-
- DISALLOW_COPY_AND_ASSIGN (ThreadPlanTestCondition);
-
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ThreadPlanTestCondition_h_
Modified: lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/lldb.xcodeproj/project.pbxproj Wed May 2 12:54:52 2012
@@ -347,7 +347,6 @@
2689010613353E6F00698AC0 /* ThreadPlanRunToAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CAFCE031101218900CA63DB /* ThreadPlanRunToAddress.cpp */; };
2689010713353E6F00698AC0 /* ThreadPlanStepThrough.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847510F50EFC00BB2B04 /* ThreadPlanStepThrough.cpp */; };
2689010813353E6F00698AC0 /* ThreadPlanStepUntil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2660D9FE11922A7F00958FBD /* ThreadPlanStepUntil.cpp */; };
- 2689010913353E6F00698AC0 /* ThreadPlanTestCondition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C1AB23A1263E5F400D0F04A /* ThreadPlanTestCondition.cpp */; };
2689010A13353E6F00698AC0 /* ThreadPlanTracer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CC2A148128C73ED001531C4 /* ThreadPlanTracer.cpp */; };
2689010B13353E6F00698AC0 /* ThreadSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */; };
2689010C13353E6F00698AC0 /* UnixSignals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C00987011500B4300F316B0 /* UnixSignals.cpp */; };
@@ -1348,8 +1347,6 @@
4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSpec.h; path = include/lldb/Target/ThreadSpec.h; sourceTree = "<group>"; };
4C09CB73116BD98B00C7A725 /* CommandCompletions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandCompletions.h; path = include/lldb/Interpreter/CommandCompletions.h; sourceTree = "<group>"; };
4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandCompletions.cpp; path = source/Commands/CommandCompletions.cpp; sourceTree = "<group>"; };
- 4C1AB23A1263E5F400D0F04A /* ThreadPlanTestCondition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanTestCondition.cpp; path = source/Target/ThreadPlanTestCondition.cpp; sourceTree = "<group>"; };
- 4C1AB23E1263E61100D0F04A /* ThreadPlanTestCondition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanTestCondition.h; path = include/lldb/Target/ThreadPlanTestCondition.h; sourceTree = "<group>"; };
4C2FAE2E135E3A70001EDE44 /* SharedCluster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharedCluster.h; path = include/lldb/Utility/SharedCluster.h; sourceTree = "<group>"; };
4C43DEF9110641F300E55CBF /* ThreadPlanShouldStopHere.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanShouldStopHere.h; path = include/lldb/Target/ThreadPlanShouldStopHere.h; sourceTree = "<group>"; };
4C43DEFA110641F300E55CBF /* ThreadPlanShouldStopHere.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanShouldStopHere.cpp; path = source/Target/ThreadPlanShouldStopHere.cpp; sourceTree = "<group>"; };
@@ -2844,8 +2841,6 @@
260C847510F50EFC00BB2B04 /* ThreadPlanStepThrough.cpp */,
4CEDAED311754F5E00E875A6 /* ThreadPlanStepUntil.h */,
2660D9FE11922A7F00958FBD /* ThreadPlanStepUntil.cpp */,
- 4C1AB23E1263E61100D0F04A /* ThreadPlanTestCondition.h */,
- 4C1AB23A1263E5F400D0F04A /* ThreadPlanTestCondition.cpp */,
4CC2A14C128C7409001531C4 /* ThreadPlanTracer.h */,
4CC2A148128C73ED001531C4 /* ThreadPlanTracer.cpp */,
4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */,
@@ -3845,7 +3840,6 @@
2689010613353E6F00698AC0 /* ThreadPlanRunToAddress.cpp in Sources */,
2689010713353E6F00698AC0 /* ThreadPlanStepThrough.cpp in Sources */,
2689010813353E6F00698AC0 /* ThreadPlanStepUntil.cpp in Sources */,
- 2689010913353E6F00698AC0 /* ThreadPlanTestCondition.cpp in Sources */,
2689010A13353E6F00698AC0 /* ThreadPlanTracer.cpp in Sources */,
2689010B13353E6F00698AC0 /* ThreadSpec.cpp in Sources */,
2689010C13353E6F00698AC0 /* UnixSignals.cpp in Sources */,
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/Breakpoint.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/Breakpoint.cpp Wed May 2 12:54:52 2012
@@ -247,12 +247,6 @@
SendBreakpointChangedEvent (eBreakpointEventTypeConditionChanged);
}
-ThreadPlan *
-Breakpoint::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, lldb::BreakpointLocationSP loc_sp, Stream &error)
-{
- return m_options.GetThreadPlanToTestCondition (exe_ctx, loc_sp, error);
-}
-
const char *
Breakpoint::GetConditionText () const
{
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointLocation.cpp Wed May 2 12:54:52 2012
@@ -235,15 +235,6 @@
SendBreakpointLocationChangedEvent (eBreakpointEventTypeConditionChanged);
}
-ThreadPlan *
-BreakpointLocation::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, Stream &error)
-{
- if (m_options_ap.get())
- return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error);
- else
- return m_owner.GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error);
-}
-
const char *
BreakpointLocation::GetConditionText () const
{
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointOptions.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/BreakpointOptions.cpp Wed May 2 12:54:52 2012
@@ -20,7 +20,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadSpec.h"
-#include "lldb/Target/ThreadPlanTestCondition.h"
+#include "lldb/Expression/ClangUserExpression.h"
using namespace lldb;
using namespace lldb_private;
@@ -170,51 +170,6 @@
}
}
-ThreadPlan *
-BreakpointOptions::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx,
- const BreakpointLocationSP &break_loc_sp,
- Stream &error_stream)
-{
- // No condition means we should stop, so return NULL.
- if (!m_condition_ap.get())
- return NULL;
-
- // FIXME: I shouldn't have to do this, the process should handle it for me:
- Process *process = exe_ctx.GetProcessPtr();
- if (!process->GetDynamicCheckers())
- {
- DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions();
-
- StreamString install_errors;
-
- if (!dynamic_checkers->Install(install_errors, exe_ctx))
- {
- error_stream.Printf("Couldn't install dynamic checkers into the execution context: %s\n", install_errors.GetData());
- return NULL;
- }
-
- process->SetDynamicCheckers(dynamic_checkers);
- }
-
- const bool keep_in_memory = false;
-
- if (!m_condition_ap->Parse (error_stream, exe_ctx, eExecutionPolicyAlways, keep_in_memory))
- {
- // Errors mean we should stop.
- return NULL;
- }
- // FIXME: When we can execute static expressions without running the target, we should check that here,
- // and return something to indicate we should stop or just continue.
-
- ThreadPlan *new_plan = new ThreadPlanTestCondition (exe_ctx.GetThreadRef(),
- exe_ctx,
- m_condition_ap.get(),
- break_loc_sp,
- true);
-
- return new_plan;
-}
-
const char *
BreakpointOptions::GetConditionText () const
{
Modified: lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Breakpoint/Watchpoint.cpp Wed May 2 12:54:52 2012
@@ -18,7 +18,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadSpec.h"
-#include "lldb/Target/ThreadPlanTestCondition.h"
+#include "lldb/Expression/ClangUserExpression.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectHelp.cpp Wed May 2 12:54:52 2012
@@ -158,12 +158,24 @@
if ((long_help != NULL)
&& (strlen (long_help) > 0))
output_strm.Printf ("\n%s", long_help);
- // Emit the message about using ' -- ' between the end of the command options and the raw input
- // conditionally, i.e., only if the command object does not want completion.
if (sub_cmd_obj->WantsRawCommandString() && !sub_cmd_obj->WantsCompletion())
{
- m_interpreter.OutputFormattedHelpText (output_strm, "", "", "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
+ // Emit the message about using ' -- ' between the end of the command options and the raw input
+ // conditionally, i.e., only if the command object does not want completion.
+ m_interpreter.OutputFormattedHelpText (output_strm, "", "",
+ "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options"
+ " you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
}
+ else if (sub_cmd_obj->GetNumArgumentEntries() > 0
+ && sub_cmd_obj->GetOptions()
+ && sub_cmd_obj->GetOptions()->NumCommandOptions() > 0)
+ {
+ // Also emit a warning about using "--" in case you are using a command that takes options and arguments.
+ m_interpreter.OutputFormattedHelpText (output_strm, "", "",
+ "\nThis command takes options and arguments, if your arguments look like option specifiers"
+ " you must use '--' to terminate the options before starting to give the arguments.", 1);
+ }
+
// Mark this help command with a success status.
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
Modified: lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/Symtab.cpp Wed May 2 12:54:52 2012
@@ -440,10 +440,35 @@
namespace {
struct SymbolIndexComparator {
const std::vector<Symbol>& symbols;
- SymbolIndexComparator(const std::vector<Symbol>& s) : symbols(s) { }
+ std::vector<lldb::addr_t> &addr_cache;
+
+ // Getting from the symbol to the Address to the File Address involves some work.
+ // Since there are potentially many symbols here, and we're using this for sorting so
+ // we're going to be computing the address many times, cache that in addr_cache.
+ // The array passed in has to be the same size as the symbols array passed into the
+ // member variable symbols, and should be initialized with LLDB_INVALID_ADDRESS.
+ // NOTE: You have to make addr_cache externally and pass it in because std::stable_sort
+ // makes copies of the comparator it is initially passed in, and you end up spending
+ // huge amounts of time copying this array...
+
+ SymbolIndexComparator(const std::vector<Symbol>& s, std::vector<lldb::addr_t> &a) : symbols(s), addr_cache(a) {
+ assert (symbols.size() == addr_cache.size());
+ }
bool operator()(uint32_t index_a, uint32_t index_b) {
- addr_t value_a = symbols[index_a].GetAddress().GetFileAddress();
- addr_t value_b = symbols[index_b].GetAddress().GetFileAddress();
+ addr_t value_a = addr_cache[index_a];
+ if (value_a == LLDB_INVALID_ADDRESS)
+ {
+ value_a = symbols[index_a].GetAddress().GetFileAddress();
+ addr_cache[index_a] = value_a;
+ }
+
+ addr_t value_b = addr_cache[index_b];
+ if (value_b == LLDB_INVALID_ADDRESS)
+ {
+ value_b = symbols[index_b].GetAddress().GetFileAddress();
+ addr_cache[index_b] = value_b;
+ }
+
if (value_a == value_b) {
// The if the values are equal, use the original symbol user ID
@@ -476,7 +501,11 @@
// NOTE: The use of std::stable_sort instead of std::sort here is strictly for performance,
// not correctness. The indexes vector tends to be "close" to sorted, which the
// stable sort handles better.
- std::stable_sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols));
+
+ std::vector<lldb::addr_t> addr_cache(m_symbols.size(), LLDB_INVALID_ADDRESS);
+
+ SymbolIndexComparator comparator(m_symbols, addr_cache);
+ std::stable_sort(indexes.begin(), indexes.end(), comparator);
// Remove any duplicates if requested
if (remove_duplicates)
Modified: lldb/branches/lldb-platform-work/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Thread.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Thread.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Thread.cpp Wed May 2 12:54:52 2012
@@ -97,7 +97,7 @@
Thread::GetStopInfo ()
{
ThreadPlanSP plan_sp (GetCompletedPlan());
- if (plan_sp)
+ if (plan_sp && plan_sp->PlanSucceeded())
return StopInfo::CreateStopReasonWithPlan (plan_sp, GetReturnValueObject());
else
{
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlan.cpp Wed May 2 12:54:52 2012
@@ -37,7 +37,8 @@
m_plan_complete (false),
m_plan_private (false),
m_okay_to_discard (false),
- m_is_master_plan (false)
+ m_is_master_plan (false),
+ m_plan_succeeded(true)
{
SetID (GetNextID());
}
@@ -57,10 +58,11 @@
}
void
-ThreadPlan::SetPlanComplete ()
+ThreadPlan::SetPlanComplete (bool success)
{
Mutex::Locker locker(m_plan_complete_mutex);
m_plan_complete = true;
+ m_plan_succeeded = success;
}
bool
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepInRange.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepInRange.cpp Wed May 2 12:54:52 2012
@@ -295,3 +295,41 @@
return NULL;
}
+
+bool
+ThreadPlanStepInRange::PlanExplainsStop ()
+{
+ // We always explain a stop. Either we've just done a single step, in which
+ // case we'll do our ordinary processing, or we stopped for some
+ // reason that isn't handled by our sub-plans, in which case we want to just stop right
+ // away.
+ // We also set ourselves complete when we stop for this sort of unintended reason, but mark
+ // success as false so we don't end up being the reason for the stop.
+ //
+ // The only variation is that if we are doing "step by running to next branch" in which case
+ // if we hit our branch breakpoint we don't set the plan to complete.
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ StopInfoSP stop_info_sp = GetPrivateStopReason();
+ if (stop_info_sp)
+ {
+ StopReason reason = stop_info_sp->GetStopReason();
+
+ switch (reason)
+ {
+ case eStopReasonBreakpoint:
+ if (NextRangeBreakpointExplainsStop(stop_info_sp))
+ return true;
+ case eStopReasonWatchpoint:
+ case eStopReasonSignal:
+ case eStopReasonException:
+ if (log)
+ log->PutCString ("ThreadPlanStepInRange got asked if it explains the stop for some reason other than step.");
+ SetPlanComplete(false);
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+}
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOverRange.cpp Wed May 2 12:54:52 2012
@@ -170,3 +170,41 @@
else
return false;
}
+
+bool
+ThreadPlanStepOverRange::PlanExplainsStop ()
+{
+ // For crashes, breakpoint hits, signals, etc, let the base plan (or some plan above us)
+ // handle the stop. That way the user can see the stop, step around, and then when they
+ // are done, continue and have their step complete. The exception is if we've hit our
+ // "run to next branch" breakpoint.
+ // Note, unlike the step in range plan, we don't mark ourselves complete if we hit an
+ // unexplained breakpoint/crash.
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+ StopInfoSP stop_info_sp = GetPrivateStopReason();
+ if (stop_info_sp)
+ {
+ StopReason reason = stop_info_sp->GetStopReason();
+
+ switch (reason)
+ {
+ case eStopReasonBreakpoint:
+ if (NextRangeBreakpointExplainsStop(stop_info_sp))
+ return true;
+ else
+ return false;
+ break;
+ case eStopReasonWatchpoint:
+ case eStopReasonSignal:
+ case eStopReasonException:
+ if (log)
+ log->PutCString ("ThreadPlanStepInRange got asked if it explains the stop for some reason other than step.");
+ return false;
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+}
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp?rev=156006&r1=156005&r2=156006&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepRange.cpp Wed May 2 12:54:52 2012
@@ -350,42 +350,6 @@
}
bool
-ThreadPlanStepRange::PlanExplainsStop ()
-{
- // We always explain a stop. Either we've just done a single step, in which
- // case we'll do our ordinary processing, or we stopped for some
- // reason that isn't handled by our sub-plans, in which case we want to just stop right
- // away.
-
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
- StopInfoSP stop_info_sp = GetPrivateStopReason();
- if (stop_info_sp)
- {
- StopReason reason = stop_info_sp->GetStopReason();
-
- switch (reason)
- {
- case eStopReasonBreakpoint:
- if (NextRangeBreakpointExplainsStop(stop_info_sp))
- return true;
- else
- return false;
- break;
- case eStopReasonWatchpoint:
- case eStopReasonSignal:
- case eStopReasonException:
- if (log)
- log->PutCString ("ThreadPlanStepInRange got asked if it explains the stop for some reason other than step.");
- SetPlanComplete();
- break;
- default:
- break;
- }
- }
- return true;
-}
-
-bool
ThreadPlanStepRange::WillStop ()
{
return true;
Removed: lldb/branches/lldb-platform-work/source/Target/ThreadPlanTestCondition.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanTestCondition.cpp?rev=156005&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanTestCondition.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanTestCondition.cpp (removed)
@@ -1,194 +0,0 @@
-//===-- ThreadPlanTestCondition.cpp ---------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Target/ThreadPlanTestCondition.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-
-#include "lldb/lldb-private-log.h"
-#include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Core/Value.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Symbol/Function.h"
-#include "lldb/Symbol/Symbol.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/RegisterContext.h"
-#include "lldb/Target/StopInfo.h"
-#include "lldb/Target/Thread.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-
-//----------------------------------------------------------------------
-// ThreadPlanTestCondition: Step through a stack range, either stepping over or into
-// based on the value of \a type.
-//----------------------------------------------------------------------
-
-ThreadPlanTestCondition::ThreadPlanTestCondition (Thread& thread,
- ExecutionContext &exe_ctx,
- ClangUserExpression *expression,
- const BreakpointLocationSP &break_loc_sp,
- bool stop_others) :
- ThreadPlan (ThreadPlan::eKindTestCondition, "test condition", thread, eVoteNoOpinion, eVoteNoOpinion),
- m_expression (expression),
- m_exe_ctx (exe_ctx),
- m_break_loc_sp (break_loc_sp),
- m_did_stop (false),
- m_stop_others (stop_others)
-{
-}
-
-ThreadPlanTestCondition::~ThreadPlanTestCondition ()
-{
-}
-
-bool
-ThreadPlanTestCondition::ValidatePlan (Stream *error)
-{
- return true;
-}
-
-void
-ThreadPlanTestCondition::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
- if (m_expression)
- s->Printf("Thread plan to test condition: \"%s\".", m_expression->GetUserText());
- else
- s->Printf("Thread plan to test unspecified condition.");
-}
-
-bool
-ThreadPlanTestCondition::ShouldStop (Event *event_ptr)
-{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
- if (m_thread.IsThreadPlanDone(m_expression_plan_sp.get()))
- {
- lldb::ClangExpressionVariableSP expr_result;
- StreamString error_stream;
- m_expression->FinalizeJITExecution(error_stream, m_exe_ctx, expr_result);
-
- ValueObjectSP result_sp (expr_result->GetValueObject());
- if (result_sp)
- {
- // FIXME: This is not the right answer, we should have a "GetValueAsBoolean..."
- Scalar scalar_value;
- if (result_sp->ResolveValue (scalar_value))
- {
- if (scalar_value.ULongLong(1) == 0)
- m_did_stop = false;
- else
- m_did_stop = true;
- }
- if (log)
- log->Printf("Condition successfully evaluated, result is %s.\n", m_did_stop ? "true" : "false");
- }
- else
- {
- if (log)
- log->Printf("Failed to get a result from the expression, error: \"%s\"\n", error_stream.GetData());
- m_did_stop = true;
- }
- }
- else if (m_exe_ctx.GetThreadRef().WasThreadPlanDiscarded (m_expression_plan_sp.get()))
- {
- if (log)
- log->Printf("ExecuteExpression thread plan was discarded.\n");
- m_did_stop = true;
- }
-
- // One tricky bit, somebody might have disabled/deleted the breakpoint while we were running this condition, if so we
- // should just continue. If the breakpoint gets disabled, then its "site" will be null'ed out, so we can't report
- // this as a breakpoint event any more, since we can't reconstruct it's site. So just pass the event on.
- if (!m_break_loc_sp->IsEnabled())
- {
- m_did_stop = false;
- }
- else
- {
- // Now we have to change the event to a breakpoint event and mark it up appropriately:
- Process::ProcessEventData *new_data = new Process::ProcessEventData (m_thread.GetProcess(), eStateStopped);
- event_ptr->SetData(new_data);
- event_ptr->SetType(Process::eBroadcastBitStateChanged);
- SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID (m_thread,
- m_break_loc_sp->GetBreakpointSite()->GetID(),
- m_did_stop));
- if (m_did_stop)
- {
- Process::ProcessEventData::SetRestartedInEvent (event_ptr, false);
- }
- else
- {
- Process::ProcessEventData::SetRestartedInEvent (event_ptr, true);
- }
- }
- SetPlanComplete();
- return m_did_stop;
-}
-
-bool
-ThreadPlanTestCondition::PlanExplainsStop ()
-{
- // We explain all stops, and we just can the execution and return true if we stop for any
- // reason other than that our expression execution is done.
- return true;
-}
-
-Vote
-ThreadPlanTestCondition::ShouldReportStop (Event *event_ptr)
-{
- if (m_did_stop)
- {
- return eVoteYes;
- }
- else
- {
- return eVoteNo;
- }
-}
-
-void
-ThreadPlanTestCondition::DidPush()
-{
- StreamString error_stream;
- m_expression_plan_sp.reset(m_expression->GetThreadPlanToExecuteJITExpression (error_stream, m_exe_ctx));
- m_thread.QueueThreadPlan (m_expression_plan_sp, false);
-}
-
-bool
-ThreadPlanTestCondition::StopOthers ()
-{
- return m_stop_others;
-}
-
-bool
-ThreadPlanTestCondition::WillStop ()
-{
- return true;
-}
-
-StateType
-ThreadPlanTestCondition::GetPlanRunState ()
-{
- return eStateRunning;
-}
-
-bool
-ThreadPlanTestCondition::MischiefManaged ()
-{
- // If we get a stop we're done, we don't puase in the middle of
- // condition execution.
- return true;
-}
More information about the lldb-commits
mailing list