2 * Copyright 2013-2016, Rene Gollent, rene@gollent.com.
3 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
4 * Distributed under the terms of the MIT License.
12 #include <Referenceable.h>
13 #include <util/DoublyLinkedList.h>
15 #include "ReturnValueInfo.h"
16 #include "types/Types.h"
24 // general thread state
33 THREAD_STOPPED_UNKNOWN
,
34 THREAD_STOPPED_DEBUGGED
,
35 THREAD_STOPPED_DEBUGGER_CALL
,
36 THREAD_STOPPED_BREAKPOINT
,
37 THREAD_STOPPED_WATCHPOINT
,
38 THREAD_STOPPED_SINGLE_STEP
,
39 THREAD_STOPPED_EXCEPTION
43 class Thread
: public BReferenceable
,
44 public DoublyLinkedListLinkImpl
< ::Thread
> {
46 Thread(Team
* team
, thread_id threadID
);
51 Team
* GetTeam() const { return fTeam
; }
52 thread_id
ID() const { return fID
; }
54 bool IsMainThread() const;
56 const char* Name() const { return fName
.String(); }
57 void SetName(const BString
& name
);
59 uint32
State() const { return fState
; }
60 void SetState(uint32 state
,
61 uint32 reason
= THREAD_STOPPED_UNKNOWN
,
62 const BString
& info
= BString());
64 uint32
StoppedReason() const
65 { return fStoppedReason
; }
66 const BString
& StoppedReasonInfo() const
67 { return fStoppedReasonInfo
; }
69 CpuState
* GetCpuState() const { return fCpuState
; }
70 void SetCpuState(CpuState
* state
);
72 StackTrace
* GetStackTrace() const { return fStackTrace
; }
73 void SetStackTrace(StackTrace
* trace
);
75 bool StopRequestPending() const
76 { return fStopRequestPending
; }
77 void SetStopRequestPending();
80 ReturnValueInfos() const
81 { return fReturnValueInfos
; }
82 status_t
AddReturnValueInfo(ReturnValueInfo
* info
);
83 void ClearReturnValueInfos();
92 bool fStopRequestPending
;
93 uint32 fStoppedReason
;
94 BString fStoppedReasonInfo
;
96 StackTrace
* fStackTrace
;
100 typedef DoublyLinkedList
< ::Thread
> ThreadList
;