blob: 1e4ae53e322daa6f11a1580112e2b13c2b55a6b5 [file] [log] [blame]
Todd Fialaaf245d12014-06-30 21:05:18 +00001//===-- NativeThreadLinux.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_NativeThreadLinux_H_
11#define liblldb_NativeThreadLinux_H_
12
13#include "lldb/lldb-private-forward.h"
14#include "../../../Host/common/NativeThreadProtocol.h"
15
16namespace lldb_private
17{
18 class NativeProcessLinux;
19
20 class NativeThreadLinux : public NativeThreadProtocol
21 {
22 friend class NativeProcessLinux;
23
24 public:
25 NativeThreadLinux (NativeProcessLinux *process, lldb::tid_t tid);
26
27 // ---------------------------------------------------------------------
28 // NativeThreadProtocol Interface
29 // ---------------------------------------------------------------------
Todd Fiala7206c6d2014-09-12 22:51:49 +000030 std::string
Todd Fialaaf245d12014-06-30 21:05:18 +000031 GetName() override;
32
33 lldb::StateType
34 GetState () override;
35
36 bool
Chaoren Lin28e57422015-02-03 01:51:25 +000037 GetStopReason (ThreadStopInfo &stop_info, std::string& description) override;
Todd Fialaaf245d12014-06-30 21:05:18 +000038
39 NativeRegisterContextSP
40 GetRegisterContext () override;
41
42 Error
43 SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override;
44
45 Error
46 RemoveWatchpoint (lldb::addr_t addr) override;
47
Todd Fialaaf245d12014-06-30 21:05:18 +000048 private:
49 // ---------------------------------------------------------------------
50 // Interface for friend classes
51 // ---------------------------------------------------------------------
52 void
53 SetLaunching ();
54
55 void
56 SetRunning ();
57
58 void
59 SetStepping ();
60
61 void
62 SetStoppedBySignal (uint32_t signo);
63
Todd Fiala511e5cd2014-09-11 23:29:14 +000064 /// Return true if the thread is stopped.
65 /// If stopped by a signal, indicate the signo in the signo argument.
66 /// Otherwise, return LLDB_INVALID_SIGNAL_NUMBER.
67 bool
68 IsStopped (int *signo);
69
Todd Fialaaf245d12014-06-30 21:05:18 +000070 void
Todd Fialaa9882ce2014-08-28 15:46:54 +000071 SetStoppedByExec ();
72
73 void
Todd Fialaaf245d12014-06-30 21:05:18 +000074 SetStoppedByBreakpoint ();
75
76 bool
77 IsStoppedAtBreakpoint ();
78
79 void
Chaoren Lin28e57422015-02-03 01:51:25 +000080 SetStoppedByTrace ();
81
82 void
83 SetCrashedWithException (const siginfo_t& info);
Todd Fialaaf245d12014-06-30 21:05:18 +000084
85 void
86 SetSuspended ();
87
88 void
89 SetExited ();
90
91 // ---------------------------------------------------------------------
92 // Private interface
93 // ---------------------------------------------------------------------
94 void
95 MaybeLogStateChange (lldb::StateType new_state);
96
97 // ---------------------------------------------------------------------
98 // Member Variables
99 // ---------------------------------------------------------------------
100 lldb::StateType m_state;
101 ThreadStopInfo m_stop_info;
102 NativeRegisterContextSP m_reg_context_sp;
Chaoren Lin28e57422015-02-03 01:51:25 +0000103 std::string m_stop_description;
Todd Fialaaf245d12014-06-30 21:05:18 +0000104 };
105}
106
107#endif // #ifndef liblldb_NativeThreadLinux_H_