1 //===-- POSIXStopInfo.h -----------------------------------------*- 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 #ifndef liblldb_POSIXStopInfo_H_
11 #define liblldb_POSIXStopInfo_H_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Target/StopInfo.h"
18 
19 #include "POSIXThread.h"
20 #include "ProcessMessage.h"
21 
22 //===----------------------------------------------------------------------===//
23 /// @class POSIXStopInfo
24 /// @brief Simple base class for all POSIX-specific StopInfo objects.
25 ///
26 class POSIXStopInfo
27     : public lldb_private::StopInfo
28 {
29 public:
POSIXStopInfo(lldb_private::Thread & thread,uint32_t status)30     POSIXStopInfo(lldb_private::Thread &thread, uint32_t status)
31         : StopInfo(thread, status)
32         { }
33 };
34 
35 //===----------------------------------------------------------------------===//
36 /// @class POSIXLimboStopInfo
37 /// @brief Represents the stop state of a process ready to exit.
38 ///
39 class POSIXLimboStopInfo
40     : public POSIXStopInfo
41 {
42 public:
POSIXLimboStopInfo(POSIXThread & thread)43     POSIXLimboStopInfo(POSIXThread &thread)
44         : POSIXStopInfo(thread, 0)
45         { }
46 
47     ~POSIXLimboStopInfo();
48 
49     lldb::StopReason
50     GetStopReason() const;
51 
52     const char *
53     GetDescription();
54 
55     bool
56     ShouldStop(lldb_private::Event *event_ptr);
57 
58     bool
59     ShouldNotify(lldb_private::Event *event_ptr);
60 };
61 
62 
63 //===----------------------------------------------------------------------===//
64 /// @class POSIXCrashStopInfo
65 /// @brief Represents the stop state of process that is ready to crash.
66 ///
67 class POSIXCrashStopInfo
68     : public POSIXStopInfo
69 {
70 public:
POSIXCrashStopInfo(POSIXThread & thread,uint32_t status,ProcessMessage::CrashReason reason,lldb::addr_t fault_addr)71     POSIXCrashStopInfo(POSIXThread &thread, uint32_t status,
72                        ProcessMessage::CrashReason reason,
73                        lldb::addr_t fault_addr)
74         : POSIXStopInfo(thread, status),
75           m_crash_reason(reason),
76           m_fault_addr(fault_addr)
77         { }
78 
79     ~POSIXCrashStopInfo();
80 
81     lldb::StopReason
82     GetStopReason() const;
83 
84     const char *
85     GetDescription();
86 
87 private:
88     ProcessMessage::CrashReason m_crash_reason;
89     lldb::addr_t m_fault_addr;
90 };
91 
92 //===----------------------------------------------------------------------===//
93 /// @class POSIXNewThreadStopInfo
94 /// @brief Represents the stop state of process when a new thread is spawned.
95 ///
96 
97 class POSIXNewThreadStopInfo
98     : public POSIXStopInfo
99 {
100 public:
POSIXNewThreadStopInfo(POSIXThread & thread)101     POSIXNewThreadStopInfo (POSIXThread &thread)
102         : POSIXStopInfo (thread, 0)
103         { }
104 
105     ~POSIXNewThreadStopInfo();
106 
107     lldb::StopReason
108     GetStopReason() const;
109 
110     const char *
111     GetDescription();
112 
113     bool
114     ShouldStop(lldb_private::Event *event_ptr);
115 
116     bool
117     ShouldNotify(lldb_private::Event *event_ptr);
118 };
119 
120 #endif
121