summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/ThreadPlanContinue.cpp
blob: 63d8a3323d03167af31abace77114245d5130f9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//===-- ThreadPlanContinue.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/ThreadPlanContinue.h"

// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private-log.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"

using namespace lldb;
using namespace lldb_private;

//----------------------------------------------------------------------
// ThreadPlanContinue: Continue plan
//----------------------------------------------------------------------

ThreadPlanContinue::ThreadPlanContinue (Thread &thread, bool stop_others, Vote stop_vote, Vote run_vote, bool immediate) :
    ThreadPlan ("Continue after previous plan", thread, stop_vote, run_vote),
    m_stop_others (stop_others),
    m_did_run (false),
    m_immediate (immediate)
{
}

ThreadPlanContinue::~ThreadPlanContinue ()
{
}

void
ThreadPlanContinue::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
    if (level == lldb::eDescriptionLevelBrief)
        s->Printf ("continue");
    else
    {
        s->Printf ("Continue from the previous plan");
    }
}

bool
ThreadPlanContinue::ValidatePlan (Stream *error)
{
    // Since we read the instruction we're stepping over from the thread,
    // this plan will always work.
    return true;
}

bool
ThreadPlanContinue::PlanExplainsStop ()
{
    return true;
}

bool
ThreadPlanContinue::ShouldStop (Event *event_ptr)
{
    return false;
}

bool
ThreadPlanContinue::IsImmediate () const
{
    return m_immediate;
    return false;
}

bool
ThreadPlanContinue::StopOthers ()
{
    return m_stop_others;
}

StateType
ThreadPlanContinue::RunState ()
{
    return eStateRunning;
}

bool
ThreadPlanContinue::WillResume (StateType resume_state, bool current_plan)
{
    ThreadPlan::WillResume (resume_state, current_plan);
    if (current_plan)
    {
        m_did_run = true;
    }
    return true;
}

bool
ThreadPlanContinue::WillStop ()
{
    return true;
}

bool
ThreadPlanContinue::MischiefManaged ()
{
    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);

    if (m_did_run)
    {
        if (log)
            log->Printf("Completed continue plan.");
        ThreadPlan::MischiefManaged ();
        return true;
    }
    else
        return false;
}
OpenPOWER on IntegriCloud