LLDB  mainline
FreeBSDThread.h
Go to the documentation of this file.
1 //===-- FreeBSDThread.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_FreeBSDThread_H_
10 #define liblldb_FreeBSDThread_H_
11 
12 #include <memory>
13 #include <string>
14 
15 #include "RegisterContextPOSIX.h"
16 #include "lldb/Target/Thread.h"
17 
18 class ProcessMessage;
19 class ProcessMonitor;
21 
22 // @class FreeBSDThread
23 // Abstraction of a FreeBSD thread.
25 public:
26  // Constructors and destructors
28 
29  virtual ~FreeBSDThread();
30 
31  // POSIXThread
32  void RefreshStateAfterStop() override;
33 
34  // This notifies the thread when a private stop occurs.
35  void DidStop() override;
36 
37  const char *GetInfo() override;
38 
39  void SetName(const char *name) override;
40 
41  const char *GetName() override;
42 
43  lldb::RegisterContextSP GetRegisterContext() override;
44 
45  lldb::RegisterContextSP
47 
48  lldb::addr_t GetThreadPointer() override;
49 
50  // These functions provide a mapping from the register offset
51  // back to the register index or name for use in debugging or log
52  // output.
53 
54  unsigned GetRegisterIndexFromOffset(unsigned offset);
55 
56  const char *GetRegisterName(unsigned reg);
57 
58  const char *GetRegisterNameFromOffset(unsigned offset);
59 
60  // These methods form a specialized interface to POSIX threads.
61  //
62  bool Resume();
63 
64  void Notify(const ProcessMessage &message);
65 
66  // These methods provide an interface to watchpoints
67  //
69 
71 
73 
75 
76 protected:
78  if (!m_reg_context_sp)
80  return m_posix_thread;
81  }
82 
83  std::unique_ptr<lldb_private::StackFrame> m_frame_up;
84 
85  lldb::BreakpointSiteSP m_breakpoint;
86 
88  std::string m_thread_name;
90 
92 
93  bool CalculateStopInfo() override;
94 
95  void BreakNotify(const ProcessMessage &message);
96  void WatchNotify(const ProcessMessage &message);
97  virtual void TraceNotify(const ProcessMessage &message);
98  void LimboNotify(const ProcessMessage &message);
99  void SignalNotify(const ProcessMessage &message);
100  void SignalDeliveredNotify(const ProcessMessage &message);
101  void CrashNotify(const ProcessMessage &message);
102  void ExitNotify(const ProcessMessage &message);
103  void ExecNotify(const ProcessMessage &message);
104 
105  // FreeBSDThread internal API.
106 
107  // POSIXThread override
108  virtual void WillResume(lldb::StateType resume_state) override;
109 };
110 
111 #endif // #ifndef liblldb_FreeBSDThread_H_
const char * GetRegisterName(unsigned reg)
POSIXBreakpointProtocol * GetPOSIXBreakpointProtocol()
Definition: FreeBSDThread.h:77
std::unique_ptr< lldb_private::StackFrame > m_frame_up
Definition: FreeBSDThread.h:83
ProcessMonitor & GetMonitor()
uint32_t FindVacantWatchpointIndex()
void ExecNotify(const ProcessMessage &message)
POSIXBreakpointProtocol * m_posix_thread
Definition: FreeBSDThread.h:89
bool CalculateStopInfo() override
lldb::BreakpointSiteSP m_breakpoint
Definition: FreeBSDThread.h:85
void CrashNotify(const ProcessMessage &message)
FreeBSDThread(lldb_private::Process &process, lldb::tid_t tid)
virtual void WillResume(lldb::StateType resume_state) override
void BreakNotify(const ProcessMessage &message)
void Notify(const ProcessMessage &message)
const char * GetRegisterNameFromOffset(unsigned offset)
bool EnableHardwareWatchpoint(lldb_private::Watchpoint *wp)
lldb::RegisterContextSP GetRegisterContext() override
std::string m_thread_name
Definition: FreeBSDThread.h:88
void LimboNotify(const ProcessMessage &message)
void RefreshStateAfterStop() override
void SignalNotify(const ProcessMessage &message)
virtual ~FreeBSDThread()
void DidStop() override
void SignalDeliveredNotify(const ProcessMessage &message)
bool DisableHardwareWatchpoint(lldb_private::Watchpoint *wp)
unsigned GetRegisterIndexFromOffset(unsigned offset)
uint32_t NumSupportedHardwareWatchpoints()
lldb::RegisterContextSP CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override
virtual void TraceNotify(const ProcessMessage &message)
const char * GetInfo() override
void WatchNotify(const ProcessMessage &message)
const char * GetName() override
bool m_thread_name_valid
Definition: FreeBSDThread.h:87
void SetName(const char *name) override
void ExitNotify(const ProcessMessage &message)
lldb::addr_t GetThreadPointer() override
Retrieves the per-thread data area.
Extends RegisterClass with a few virtual operations useful on POSIX.
Manages communication with the inferior (debugee) process.
A plug-in interface definition class for debugging a process.
Definition: Process.h:369
This base class provides an interface to stack frames.
Definition: StackFrame.h:41
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
Definition: Thread.h:1254
StateType
Process and Thread States.
uint64_t addr_t
Definition: lldb-types.h:83
uint64_t tid_t
Definition: lldb-types.h:86