LLDB  mainline
NativeThreadFreeBSD.h
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_NativeThreadFreeBSD_H_
10 #define liblldb_NativeThreadFreeBSD_H_
11 
13 
15 
16 #include <csignal>
17 #include <map>
18 #include <string>
19 
20 namespace lldb_private {
21 namespace process_freebsd {
22 
23 class NativeProcessFreeBSD;
24 
26  friend class NativeProcessFreeBSD;
27 
28 public:
30 
31  // NativeThreadProtocol Interface
32  std::string GetName() override;
33 
34  lldb::StateType GetState() override;
35 
36  bool GetStopReason(ThreadStopInfo &stop_info,
37  std::string &description) override;
38 
40 
41  Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
42  bool hardware) override;
43 
44  Status RemoveWatchpoint(lldb::addr_t addr) override;
45 
46  Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
47 
49 
50  llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
51  GetSiginfo() const override;
52 
53 private:
54  // Interface for friend classes
55 
56  Status Resume();
58  Status Suspend();
59 
60  void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
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();
69  void SetStopped();
70  void SetRunning();
71  void SetStepping();
72 
74 
75  // Member Variables
78  std::unique_ptr<NativeRegisterContextFreeBSD> m_reg_context_up;
80  using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
83 };
84 
85 typedef std::shared_ptr<NativeThreadFreeBSD> NativeThreadFreeBSDSP;
86 } // namespace process_freebsd
87 } // namespace lldb_private
88 
89 #endif // #ifndef liblldb_NativeThreadFreeBSD_H_
lldb_private::process_freebsd::NativeThreadFreeBSD::SingleStep
Status SingleStep()
Definition: NativeThreadFreeBSD.cpp:59
lldb_private::process_freebsd::NativeThreadFreeBSD::CopyWatchpointsFrom
llvm::Error CopyWatchpointsFrom(NativeThreadFreeBSD &source)
Definition: NativeThreadFreeBSD.cpp:310
lldb_private::process_freebsd::NativeThreadFreeBSDSP
std::shared_ptr< NativeThreadFreeBSD > NativeThreadFreeBSDSP
Definition: NativeThreadFreeBSD.h:85
lldb_private::process_freebsd::NativeThreadFreeBSD::NativeThreadFreeBSD
NativeThreadFreeBSD(NativeProcessFreeBSD &process, lldb::tid_t tid)
Definition: NativeThreadFreeBSD.cpp:35
lldb_private::NativeThreadProtocol
Definition: NativeThreadProtocol.h:24
lldb_private::process_freebsd::NativeThreadFreeBSD::SetHardwareBreakpoint
Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
Definition: NativeThreadFreeBSD.cpp:279
lldb_private::process_freebsd::NativeProcessFreeBSD
Definition: NativeProcessFreeBSD.h:30
lldb_private::process_freebsd::NativeThreadFreeBSD::GetState
lldb::StateType GetState() override
Definition: NativeThreadFreeBSD.cpp:215
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByFork
void SetStoppedByFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
Definition: NativeThreadFreeBSD.cpp:133
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByTrace
void SetStoppedByTrace()
Definition: NativeThreadFreeBSD.cpp:106
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByVForkDone
void SetStoppedByVForkDone()
Definition: NativeThreadFreeBSD.cpp:153
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::process_freebsd::NativeThreadFreeBSD
Definition: NativeThreadFreeBSD.h:25
lldb_private::process_freebsd::NativeThreadFreeBSD::m_stop_description
std::string m_stop_description
Definition: NativeThreadFreeBSD.h:79
lldb_private::process_freebsd::NativeThreadFreeBSD::SetRunning
void SetRunning()
Definition: NativeThreadFreeBSD.cpp:173
lldb_private::process_freebsd::NativeThreadFreeBSD::GetName
std::string GetName() override
Definition: NativeThreadFreeBSD.cpp:183
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByExec
void SetStoppedByExec()
Definition: NativeThreadFreeBSD.cpp:112
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStopped
void SetStopped()
Definition: NativeThreadFreeBSD.cpp:167
lldb_private::process_freebsd::NativeThreadFreeBSD::RemoveHardwareBreakpoint
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override
Definition: NativeThreadFreeBSD.cpp:295
lldb_private::process_freebsd::NativeThreadFreeBSD::Suspend
Status Suspend()
Definition: NativeThreadFreeBSD.cpp:69
lldb_private::process_freebsd::NativeThreadFreeBSD::m_reg_context_up
std::unique_ptr< NativeRegisterContextFreeBSD > m_reg_context_up
Definition: NativeThreadFreeBSD.h:78
lldb_private::process_freebsd::NativeThreadFreeBSD::RemoveWatchpoint
Status RemoveWatchpoint(lldb::addr_t addr) override
Definition: NativeThreadFreeBSD.cpp:268
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedWithNoReason
void SetStoppedWithNoReason()
Definition: NativeThreadFreeBSD.cpp:160
lldb_private::ThreadStopInfo
Definition: Debug.h:131
lldb_private::process_freebsd::NativeThreadFreeBSD::WatchpointIndexMap
std::map< lldb::addr_t, uint32_t > WatchpointIndexMap
Definition: NativeThreadFreeBSD.h:80
lldb_private::process_freebsd::NativeThreadFreeBSD::Resume
Status Resume()
Definition: NativeThreadFreeBSD.cpp:44
lldb_private::process_freebsd::NativeThreadFreeBSD::SetWatchpoint
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override
Definition: NativeThreadFreeBSD.cpp:252
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByBreakpoint
void SetStoppedByBreakpoint()
Definition: NativeThreadFreeBSD.cpp:100
lldb_private::Status
Definition: Status.h:44
uint32_t
NativeThreadProtocol.h
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb_private::process_freebsd::NativeThreadFreeBSD::GetStopReason
bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) override
Definition: NativeThreadFreeBSD.cpp:217
lldb_private::process_freebsd::NativeThreadFreeBSD::m_hw_break_index_map
WatchpointIndexMap m_hw_break_index_map
Definition: NativeThreadFreeBSD.h:82
lldb_private::process_freebsd::NativeRegisterContextFreeBSD
Definition: NativeRegisterContextFreeBSD.h:21
NativeRegisterContextFreeBSD.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:30
lldb_private::process_freebsd::NativeThreadFreeBSD::GetRegisterContext
NativeRegisterContextFreeBSD & GetRegisterContext() override
Definition: NativeThreadFreeBSD.cpp:247
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByWatchpoint
void SetStoppedByWatchpoint(uint32_t wp_index)
Definition: NativeThreadFreeBSD.cpp:118
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::process_freebsd::NativeThreadFreeBSD::GetSiginfo
llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo() const override
Definition: NativeThreadFreeBSD.cpp:321
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedBySignal
void SetStoppedBySignal(uint32_t signo, const siginfo_t *info=nullptr)
Definition: NativeThreadFreeBSD.cpp:76
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByVFork
void SetStoppedByVFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
Definition: NativeThreadFreeBSD.cpp:143
lldb_private::process_freebsd::NativeThreadFreeBSD::m_state
lldb::StateType m_state
Definition: NativeThreadFreeBSD.h:76
lldb_private::process_freebsd::NativeThreadFreeBSD::m_stop_info
ThreadStopInfo m_stop_info
Definition: NativeThreadFreeBSD.h:77
lldb_private::process_freebsd::NativeThreadFreeBSD::SetStepping
void SetStepping()
Definition: NativeThreadFreeBSD.cpp:178
lldb_private::process_freebsd::NativeThreadFreeBSD::m_watchpoint_index_map
WatchpointIndexMap m_watchpoint_index_map
Definition: NativeThreadFreeBSD.h:81
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86