1 //===-- DNBThreadResumeActions.h --------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // Created by Greg Clayton on 03/13/2010 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_DNBTHREADRESUMEACTIONS_H 14 #define LLDB_TOOLS_DEBUGSERVER_SOURCE_DNBTHREADRESUMEACTIONS_H 15 16 #include <vector> 17 18 #include "DNBDefs.h" 19 20 class DNBThreadResumeActions { 21 public: 22 DNBThreadResumeActions(); 23 24 DNBThreadResumeActions(nub_state_t default_action, int signal); 25 26 DNBThreadResumeActions(const DNBThreadResumeAction *actions, 27 size_t num_actions); 28 IsEmpty()29 bool IsEmpty() const { return m_actions.empty(); } 30 31 void Append(const DNBThreadResumeAction &action); 32 33 void AppendAction(nub_thread_t tid, nub_state_t state, int signal = 0, 34 nub_addr_t addr = INVALID_NUB_ADDRESS); 35 AppendResumeAll()36 void AppendResumeAll() { AppendAction(INVALID_NUB_THREAD, eStateRunning); } 37 AppendSuspendAll()38 void AppendSuspendAll() { AppendAction(INVALID_NUB_THREAD, eStateStopped); } 39 AppendStepAll()40 void AppendStepAll() { AppendAction(INVALID_NUB_THREAD, eStateStepping); } 41 42 const DNBThreadResumeAction *GetActionForThread(nub_thread_t tid, 43 bool default_ok) const; 44 45 size_t NumActionsWithState(nub_state_t state) const; 46 47 bool SetDefaultThreadActionIfNeeded(nub_state_t action, int signal); 48 49 void SetSignalHandledForThread(nub_thread_t tid) const; 50 GetFirst()51 const DNBThreadResumeAction *GetFirst() const { return m_actions.data(); } 52 GetSize()53 size_t GetSize() const { return m_actions.size(); } 54 Clear()55 void Clear() { 56 m_actions.clear(); 57 m_signal_handled.clear(); 58 } 59 60 protected: 61 std::vector<DNBThreadResumeAction> m_actions; 62 mutable std::vector<bool> m_signal_handled; 63 }; 64 65 #endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_DNBTHREADRESUMEACTIONS_H 66