blob: 63d8a3323d03167af31abace77114245d5130f9b [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- ThreadPlanContinue.cpp ----------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "lldb/Target/ThreadPlanContinue.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
16#include "lldb/lldb-private-log.h"
17#include "lldb/Core/Log.h"
18#include "lldb/Core/Stream.h"
19
20using namespace lldb;
21using namespace lldb_private;
22
23//----------------------------------------------------------------------
24// ThreadPlanContinue: Continue plan
25//----------------------------------------------------------------------
26
27ThreadPlanContinue::ThreadPlanContinue (Thread &thread, bool stop_others, Vote stop_vote, Vote run_vote, bool immediate) :
28 ThreadPlan ("Continue after previous plan", thread, stop_vote, run_vote),
29 m_stop_others (stop_others),
30 m_did_run (false),
31 m_immediate (immediate)
32{
33}
34
35ThreadPlanContinue::~ThreadPlanContinue ()
36{
37}
38
39void
40ThreadPlanContinue::GetDescription (Stream *s, lldb::DescriptionLevel level)
41{
42 if (level == lldb::eDescriptionLevelBrief)
43 s->Printf ("continue");
44 else
45 {
46 s->Printf ("Continue from the previous plan");
47 }
48}
49
50bool
51ThreadPlanContinue::ValidatePlan (Stream *error)
52{
53 // Since we read the instruction we're stepping over from the thread,
54 // this plan will always work.
55 return true;
56}
57
58bool
59ThreadPlanContinue::PlanExplainsStop ()
60{
61 return true;
62}
63
64bool
65ThreadPlanContinue::ShouldStop (Event *event_ptr)
66{
67 return false;
68}
69
70bool
71ThreadPlanContinue::IsImmediate () const
72{
73 return m_immediate;
74 return false;
75}
76
77bool
78ThreadPlanContinue::StopOthers ()
79{
80 return m_stop_others;
81}
82
83StateType
84ThreadPlanContinue::RunState ()
85{
86 return eStateRunning;
87}
88
89bool
90ThreadPlanContinue::WillResume (StateType resume_state, bool current_plan)
91{
92 ThreadPlan::WillResume (resume_state, current_plan);
93 if (current_plan)
94 {
95 m_did_run = true;
96 }
97 return true;
98}
99
100bool
101ThreadPlanContinue::WillStop ()
102{
103 return true;
104}
105
106bool
107ThreadPlanContinue::MischiefManaged ()
108{
109 Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
110
111 if (m_did_run)
112 {
113 if (log)
114 log->Printf("Completed continue plan.");
115 ThreadPlan::MischiefManaged ();
116 return true;
117 }
118 else
119 return false;
120}