Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- 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 | |
| 20 | using namespace lldb; |
| 21 | using namespace lldb_private; |
| 22 | |
| 23 | //---------------------------------------------------------------------- |
| 24 | // ThreadPlanContinue: Continue plan |
| 25 | //---------------------------------------------------------------------- |
| 26 | |
| 27 | ThreadPlanContinue::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 | |
| 35 | ThreadPlanContinue::~ThreadPlanContinue () |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | void |
| 40 | ThreadPlanContinue::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 | |
| 50 | bool |
| 51 | ThreadPlanContinue::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 | |
| 58 | bool |
| 59 | ThreadPlanContinue::PlanExplainsStop () |
| 60 | { |
| 61 | return true; |
| 62 | } |
| 63 | |
| 64 | bool |
| 65 | ThreadPlanContinue::ShouldStop (Event *event_ptr) |
| 66 | { |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | bool |
| 71 | ThreadPlanContinue::IsImmediate () const |
| 72 | { |
| 73 | return m_immediate; |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | bool |
| 78 | ThreadPlanContinue::StopOthers () |
| 79 | { |
| 80 | return m_stop_others; |
| 81 | } |
| 82 | |
| 83 | StateType |
| 84 | ThreadPlanContinue::RunState () |
| 85 | { |
| 86 | return eStateRunning; |
| 87 | } |
| 88 | |
| 89 | bool |
| 90 | ThreadPlanContinue::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 | |
| 100 | bool |
| 101 | ThreadPlanContinue::WillStop () |
| 102 | { |
| 103 | return true; |
| 104 | } |
| 105 | |
| 106 | bool |
| 107 | ThreadPlanContinue::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 | } |