Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / FreeBSD / NativeThreadFreeBSD.h
blob6294a7a70963566d820b1fbada777841b7059b49
1 //===-- NativeThreadFreeBSD.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 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_NativeThreadFreeBSD_H_
10 #define liblldb_NativeThreadFreeBSD_H_
12 #include "lldb/Host/common/NativeThreadProtocol.h"
14 #include "Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.h"
16 #include <csignal>
17 #include <map>
18 #include <string>
20 namespace lldb_private {
21 namespace process_freebsd {
23 class NativeProcessFreeBSD;
25 class NativeThreadFreeBSD : public NativeThreadProtocol {
26 friend class NativeProcessFreeBSD;
28 public:
29 NativeThreadFreeBSD(NativeProcessFreeBSD &process, lldb::tid_t tid);
31 // NativeThreadProtocol Interface
32 std::string GetName() override;
34 lldb::StateType GetState() override;
36 bool GetStopReason(ThreadStopInfo &stop_info,
37 std::string &description) override;
39 NativeRegisterContextFreeBSD &GetRegisterContext() override;
41 Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
42 bool hardware) override;
44 Status RemoveWatchpoint(lldb::addr_t addr) override;
46 Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
48 Status RemoveHardwareBreakpoint(lldb::addr_t addr) override;
50 llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
51 GetSiginfo() const override;
53 private:
54 // Interface for friend classes
56 Status Resume();
57 Status SingleStep();
58 Status Suspend();
60 void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
61 void SetStoppedByBreakpoint();
62 void SetStoppedByTrace();
63 void SetStoppedByExec();
64 void SetStoppedByWatchpoint(uint32_t wp_index);
65 void SetStoppedByFork(lldb::pid_t child_pid, lldb::tid_t child_tid);
66 void SetStoppedByVFork(lldb::pid_t child_pid, lldb::tid_t child_tid);
67 void SetStoppedByVForkDone();
68 void SetStoppedWithNoReason();
69 void SetStopped();
70 void SetRunning();
71 void SetStepping();
73 llvm::Error CopyWatchpointsFrom(NativeThreadFreeBSD &source);
75 // Member Variables
76 lldb::StateType m_state;
77 ThreadStopInfo m_stop_info;
78 std::unique_ptr<NativeRegisterContextFreeBSD> m_reg_context_up;
79 std::string m_stop_description;
80 using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
81 WatchpointIndexMap m_watchpoint_index_map;
82 WatchpointIndexMap m_hw_break_index_map;
85 typedef std::shared_ptr<NativeThreadFreeBSD> NativeThreadFreeBSDSP;
86 } // namespace process_freebsd
87 } // namespace lldb_private
89 #endif // #ifndef liblldb_NativeThreadFreeBSD_H_