LLDB  mainline
NativeProcessProtocol.h
Go to the documentation of this file.
1 //===-- NativeProcessProtocol.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 LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
10 #define LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
11 
12 #include "NativeBreakpointList.h"
13 #include "NativeThreadProtocol.h"
14 #include "NativeWatchpointList.h"
15 #include "lldb/Host/Host.h"
16 #include "lldb/Host/MainLoop.h"
17 #include "lldb/Utility/ArchSpec.h"
18 #include "lldb/Utility/Status.h"
22 #include "lldb/lldb-types.h"
23 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/ADT/DenseSet.h"
25 #include "llvm/ADT/StringRef.h"
26 #include "llvm/Support/Error.h"
27 #include "llvm/Support/MemoryBuffer.h"
28 #include <mutex>
29 #include <unordered_map>
30 #include <vector>
31 
32 namespace lldb_private {
34 
35 class MemoryRegionInfo;
36 class ResumeActionList;
37 
44 };
45 
46 // NativeProcessProtocol
48 public:
49  virtual ~NativeProcessProtocol() = default;
50 
51  virtual Status Resume(const ResumeActionList &resume_actions) = 0;
52 
53  virtual Status Halt() = 0;
54 
55  virtual Status Detach() = 0;
56 
57  /// Sends a process a UNIX signal \a signal.
58  ///
59  /// \return
60  /// Returns an error object.
61  virtual Status Signal(int signo) = 0;
62 
63  /// Tells a process to interrupt all operations as if by a Ctrl-C.
64  ///
65  /// The default implementation will send a local host's equivalent of
66  /// a SIGSTOP to the process via the NativeProcessProtocol::Signal()
67  /// operation.
68  ///
69  /// \return
70  /// Returns an error object.
71  virtual Status Interrupt();
72 
73  virtual Status Kill() = 0;
74 
75  // Tells a process not to stop the inferior on given signals and just
76  // reinject them back.
77  virtual Status IgnoreSignals(llvm::ArrayRef<int> signals);
78 
79  // Memory and memory region functions
80 
81  virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr,
82  MemoryRegionInfo &range_info);
83 
84  virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size,
85  size_t &bytes_read) = 0;
86 
87  Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
88  size_t &bytes_read);
89 
90  virtual Status ReadMemoryTags(int32_t type, lldb::addr_t addr, size_t len,
91  std::vector<uint8_t> &tags);
92 
93  virtual Status WriteMemoryTags(int32_t type, lldb::addr_t addr, size_t len,
94  const std::vector<uint8_t> &tags);
95 
96  /// Reads a null terminated string from memory.
97  ///
98  /// Reads up to \p max_size bytes of memory until it finds a '\0'.
99  /// If a '\0' is not found then it reads max_size-1 bytes as a string and a
100  /// '\0' is added as the last character of the \p buffer.
101  ///
102  /// \param[in] addr
103  /// The address in memory to read from.
104  ///
105  /// \param[in] buffer
106  /// An allocated buffer with at least \p max_size size.
107  ///
108  /// \param[in] max_size
109  /// The maximum number of bytes to read from memory until it reads the
110  /// string.
111  ///
112  /// \param[out] total_bytes_read
113  /// The number of bytes read from memory into \p buffer.
114  ///
115  /// \return
116  /// Returns a StringRef backed up by the \p buffer passed in.
117  llvm::Expected<llvm::StringRef>
118  ReadCStringFromMemory(lldb::addr_t addr, char *buffer, size_t max_size,
119  size_t &total_bytes_read);
120 
121  virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
122  size_t &bytes_written) = 0;
123 
124  virtual llvm::Expected<lldb::addr_t> AllocateMemory(size_t size,
125  uint32_t permissions) {
126  return llvm::make_error<UnimplementedError>();
127  }
128 
130  return llvm::make_error<UnimplementedError>();
131  }
132 
134 
135  virtual llvm::Expected<std::vector<SVR4LibraryInfo>>
137  return llvm::createStringError(llvm::inconvertibleErrorCode(),
138  "Not implemented");
139  }
140 
141  virtual bool IsAlive() const;
142 
143  virtual size_t UpdateThreads() = 0;
144 
145  virtual const ArchSpec &GetArchitecture() const = 0;
146 
147  // Breakpoint functions
148  virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size,
149  bool hardware) = 0;
150 
151  virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware = false);
152 
153  // Hardware Breakpoint functions
154  virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const;
155 
156  virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size);
157 
159 
160  // Watchpoint functions
162 
163  virtual llvm::Optional<std::pair<uint32_t, uint32_t>>
165 
166  virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
167  uint32_t watch_flags, bool hardware);
168 
169  virtual Status RemoveWatchpoint(lldb::addr_t addr);
170 
171  // Accessors
172  lldb::pid_t GetID() const { return m_pid; }
173 
174  lldb::StateType GetState() const;
175 
176  bool IsRunning() const {
177  return m_state == lldb::eStateRunning || IsStepping();
178  }
179 
180  bool IsStepping() const { return m_state == lldb::eStateStepping; }
181 
182  bool CanResume() const { return m_state == lldb::eStateStopped; }
183 
185  return GetArchitecture().GetByteOrder();
186  }
187 
190  }
191 
192  virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
193  GetAuxvData() const = 0;
194 
195  // Exit Status
196  virtual llvm::Optional<WaitStatus> GetExitStatus();
197 
198  virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange);
199 
200  // Access to threads
202 
204 
206 
208 
211  }
212 
213  // Access to inferior stdio
214  virtual int GetTerminalFileDescriptor() { return m_terminal_fd; }
215 
216  // Stop id interface
217 
218  uint32_t GetStopID() const;
219 
220  // Callbacks for low-level process state changes
222  public:
223  virtual ~NativeDelegate() = default;
224 
225  virtual void InitializeDelegate(NativeProcessProtocol *process) = 0;
226 
227  virtual void ProcessStateChanged(NativeProcessProtocol *process,
228  lldb::StateType state) = 0;
229 
230  virtual void DidExec(NativeProcessProtocol *process) = 0;
231 
232  virtual void
233  NewSubprocess(NativeProcessProtocol *parent_process,
234  std::unique_ptr<NativeProcessProtocol> child_process) = 0;
235  };
236 
237  virtual Status GetLoadedModuleFileSpec(const char *module_path,
238  FileSpec &file_spec) = 0;
239 
240  virtual Status GetFileLoadAddress(const llvm::StringRef &file_name,
241  lldb::addr_t &load_addr) = 0;
242 
243  /// Extension flag constants, returned by Factory::GetSupportedExtensions()
244  /// and passed to SetEnabledExtension()
245  enum class Extension {
246  multiprocess = (1u << 0),
247  fork = (1u << 1),
248  vfork = (1u << 2),
249  pass_signals = (1u << 3),
250  auxv = (1u << 4),
251  libraries_svr4 = (1u << 5),
252  memory_tagging = (1u << 6),
253  savecore = (1u << 7),
254 
255  LLVM_MARK_AS_BITMASK_ENUM(savecore)
256  };
257 
258  class Factory {
259  public:
260  virtual ~Factory();
261  /// Launch a process for debugging.
262  ///
263  /// \param[in] launch_info
264  /// Information required to launch the process.
265  ///
266  /// \param[in] native_delegate
267  /// The delegate that will receive messages regarding the
268  /// inferior. Must outlive the NativeProcessProtocol
269  /// instance.
270  ///
271  /// \param[in] mainloop
272  /// The mainloop instance with which the process can register
273  /// callbacks. Must outlive the NativeProcessProtocol
274  /// instance.
275  ///
276  /// \return
277  /// A NativeProcessProtocol shared pointer if the operation succeeded or
278  /// an error object if it failed.
279  virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
280  Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate,
281  MainLoop &mainloop) const = 0;
282 
283  /// Attach to an existing process.
284  ///
285  /// \param[in] pid
286  /// pid of the process locatable
287  ///
288  /// \param[in] native_delegate
289  /// The delegate that will receive messages regarding the
290  /// inferior. Must outlive the NativeProcessProtocol
291  /// instance.
292  ///
293  /// \param[in] mainloop
294  /// The mainloop instance with which the process can register
295  /// callbacks. Must outlive the NativeProcessProtocol
296  /// instance.
297  ///
298  /// \return
299  /// A NativeProcessProtocol shared pointer if the operation succeeded or
300  /// an error object if it failed.
301  virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
302  Attach(lldb::pid_t pid, NativeDelegate &native_delegate,
303  MainLoop &mainloop) const = 0;
304 
305  /// Get the bitmask of extensions supported by this process plugin.
306  ///
307  /// \return
308  /// A NativeProcessProtocol::Extension bitmask.
309  virtual Extension GetSupportedExtensions() const { return {}; }
310  };
311 
312  /// Start tracing a process or its threads.
313  ///
314  /// \param[in] json_params
315  /// JSON object with the information of what and how to trace.
316  /// In the case of gdb-remote, this object should conform to the
317  /// jLLDBTraceStart packet.
318  ///
319  /// This object should have a string entry called "type", which is the
320  /// tracing technology name.
321  ///
322  /// \param[in] type
323  /// Tracing technology type, as described in the \a json_params.
324  ///
325  /// \return
326  /// \a llvm::Error::success if the operation was successful, or an
327  /// \a llvm::Error otherwise.
328  virtual llvm::Error TraceStart(llvm::StringRef json_params,
329  llvm::StringRef type) {
330  return llvm::createStringError(llvm::inconvertibleErrorCode(),
331  "Unsupported tracing type '%s'",
332  type.data());
333  }
334 
335  /// \copydoc Process::TraceStop(const TraceStopRequest &)
336  virtual llvm::Error TraceStop(const TraceStopRequest &request) {
337  return llvm::createStringError(llvm::inconvertibleErrorCode(),
338  "Unsupported tracing type '%s'",
339  request.type.data());
340  }
341 
342  /// \copydoc Process::TraceGetState(llvm::StringRef type)
343  virtual llvm::Expected<llvm::json::Value>
344  TraceGetState(llvm::StringRef type) {
345  return llvm::createStringError(llvm::inconvertibleErrorCode(),
346  "Unsupported tracing type '%s'",
347  type.data());
348  }
349 
350  /// \copydoc Process::TraceGetBinaryData(const TraceGetBinaryDataRequest &)
351  virtual llvm::Expected<std::vector<uint8_t>>
353  return llvm::createStringError(
354  llvm::inconvertibleErrorCode(),
355  "Unsupported data kind '%s' for the '%s' tracing technology",
356  request.kind.c_str(), request.type.c_str());
357  }
358 
359  /// \copydoc Process::TraceSupported()
360  virtual llvm::Expected<TraceSupportedResponse> TraceSupported() {
361  return llvm::make_error<UnimplementedError>();
362  }
363 
364  /// Method called in order to propagate the bitmap of protocol
365  /// extensions supported by the client.
366  ///
367  /// \param[in] flags
368  /// The bitmap of enabled extensions.
369  virtual void SetEnabledExtensions(Extension flags) {
370  m_enabled_extensions = flags;
371  }
372 
373  /// Write a core dump (without crashing the program).
374  ///
375  /// \param[in] path_hint
376  /// Suggested core dump path (optional, can be empty).
377  ///
378  /// \return
379  /// Path to the core dump if successfully written, an error
380  /// otherwise.
381  virtual llvm::Expected<std::string> SaveCore(llvm::StringRef path_hint) {
382  return llvm::createStringError(llvm::inconvertibleErrorCode(),
383  "Not implemented");
384  }
385 
386 protected:
389  llvm::SmallVector<uint8_t, 4> saved_opcodes;
390  llvm::ArrayRef<uint8_t> breakpoint_opcodes;
391  };
392 
393  std::unordered_map<lldb::addr_t, SoftwareBreakpoint> m_software_breakpoints;
395 
396  std::vector<std::unique_ptr<NativeThreadProtocol>> m_threads;
398  mutable std::recursive_mutex m_threads_mutex;
399 
401  mutable std::recursive_mutex m_state_mutex;
402 
403  llvm::Optional<WaitStatus> m_exit_status;
404 
410 
411  // Set of signal numbers that LLDB directly injects back to inferior without
412  // stopping it.
413  llvm::DenseSet<int> m_signals_to_ignore;
414 
415  // Extensions enabled per the last SetEnabledExtensions() call.
417 
418  // lldb_private::Host calls should be used to launch a process for debugging,
419  // and then the process should be attached to. When attaching to a process
420  // lldb_private::Host calls should be used to locate the process to attach
421  // to, and then this function should be called.
422  NativeProcessProtocol(lldb::pid_t pid, int terminal_fd,
423  NativeDelegate &delegate);
424 
425  void SetID(lldb::pid_t pid) { m_pid = pid; }
426 
427  // interface for state handling
428  void SetState(lldb::StateType state, bool notify_delegates = true);
429 
430  // Derived classes need not implement this. It can be used as a hook to
431  // clear internal caches that should be invalidated when stop ids change.
432  //
433  // Note this function is called with the state mutex obtained by the caller.
434  virtual void DoStopIDBumped(uint32_t newBumpId);
435 
436  // interface for software breakpoints
437 
440 
441  virtual llvm::Expected<llvm::ArrayRef<uint8_t>>
442  GetSoftwareBreakpointTrapOpcode(size_t size_hint);
443 
444  /// Return the offset of the PC relative to the software breakpoint that was hit. If an
445  /// architecture (e.g. arm) reports breakpoint hits before incrementing the PC, this offset
446  /// will be 0. If an architecture (e.g. intel) reports breakpoints hits after incrementing the
447  /// PC, this offset will be the size of the breakpoint opcode.
448  virtual size_t GetSoftwareBreakpointPCOffset();
449 
450  // Adjust the thread's PC after hitting a software breakpoint. On
451  // architectures where the PC points after the breakpoint instruction, this
452  // resets it to point to the breakpoint itself.
454 
455  /// Notify the delegate that an exec occurred.
456  ///
457  /// Provide a mechanism for a delegate to clear out any exec-
458  /// sensitive data.
459  void NotifyDidExec();
460 
462 
463 private:
465  llvm::Expected<SoftwareBreakpoint>
467 };
468 } // namespace lldb_private
469 
470 #endif // LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
lldb_private::NativeProcessProtocol::SetSoftwareBreakpoint
Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint)
Definition: NativeProcessProtocol.cpp:326
lldb_private::TraceGetBinaryDataRequest::kind
std::string kind
Identifier for the data.
Definition: TraceGDBRemotePackets.h:136
lldb_private::NativeProcessProtocol::CanResume
bool CanResume() const
Definition: NativeProcessProtocol.h:182
lldb_private::NativeProcessProtocol::Extension::memory_tagging
@ memory_tagging
lldb_private::ArchSpec::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:730
lldb_private::NativeProcessProtocol::NativeDelegate
Definition: NativeProcessProtocol.h:221
lldb_private::SVR4LibraryInfo::ld_addr
lldb::addr_t ld_addr
Definition: NativeProcessProtocol.h:42
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::NativeProcessProtocol::GetCurrentThreadID
lldb::tid_t GetCurrentThreadID()
Definition: NativeProcessProtocol.h:207
lldb_private::NativeProcessProtocol::GetCurrentThread
NativeThreadProtocol * GetCurrentThread()
Definition: NativeProcessProtocol.h:209
lldb_private::TraceGetBinaryDataRequest
jLLDBTraceGetBinaryData gdb-remote packet
Definition: TraceGDBRemotePackets.h:132
lldb_private::NativeProcessProtocol::SoftwareBreakpoint::breakpoint_opcodes
llvm::ArrayRef< uint8_t > breakpoint_opcodes
Definition: NativeProcessProtocol.h:390
lldb_private::NativeProcessProtocol::TraceStart
virtual llvm::Error TraceStart(llvm::StringRef json_params, llvm::StringRef type)
Start tracing a process or its threads.
Definition: NativeProcessProtocol.h:328
lldb_private::NativeProcessProtocol::ReadMemoryWithoutTrap
Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
Definition: NativeProcessProtocol.cpp:613
lldb_private::NativeProcessProtocol::GetThreadAtIndex
NativeThreadProtocol * GetThreadAtIndex(uint32_t idx)
Definition: NativeProcessProtocol.cpp:98
lldb_private::NativeProcessProtocol::SetHardwareBreakpoint
virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
Definition: NativeProcessProtocol.cpp:234
lldb_private::NativeThreadProtocol
Definition: NativeThreadProtocol.h:20
lldb_private::NativeProcessProtocol::ReadCStringFromMemory
llvm::Expected< llvm::StringRef > ReadCStringFromMemory(lldb::addr_t addr, char *buffer, size_t max_size, size_t &total_bytes_read)
Reads a null terminated string from memory.
Definition: NativeProcessProtocol.cpp:642
lldb_private::NativeProcessProtocol::GetSharedLibraryInfoAddress
virtual lldb::addr_t GetSharedLibraryInfoAddress()=0
lldb_private::NativeProcessProtocol::GetAuxvData
virtual llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > GetAuxvData() const =0
Host.h
lldb_private::NativeProcessProtocol::GetLoadedSVR4Libraries
virtual llvm::Expected< std::vector< SVR4LibraryInfo > > GetLoadedSVR4Libraries()
Definition: NativeProcessProtocol.h:136
lldb_private::NativeProcessProtocol::SoftwareBreakpoint::ref_count
uint32_t ref_count
Definition: NativeProcessProtocol.h:388
lldb_private::NativeProcessProtocol::Extension::savecore
@ savecore
lldb_private::NativeProcessProtocol::SetState
void SetState(lldb::StateType state, bool notify_delegates=true)
Definition: NativeProcessProtocol.cpp:698
lldb_private::NativeProcessProtocol::IgnoreSignals
virtual Status IgnoreSignals(llvm::ArrayRef< int > signals)
Definition: NativeProcessProtocol.cpp:42
lldb_private::NativeProcessProtocol::SetWatchpoint
virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware)
Definition: NativeProcessProtocol.cpp:146
lldb_private::NativeProcessProtocol::m_watchpoint_list
NativeWatchpointList m_watchpoint_list
Definition: NativeProcessProtocol.h:406
lldb_private::NativeProcessProtocol::AllocateMemory
virtual llvm::Expected< lldb::addr_t > AllocateMemory(size_t size, uint32_t permissions)
Definition: NativeProcessProtocol.h:124
lldb_private::NativeProcessProtocol::Extension::libraries_svr4
@ libraries_svr4
lldb_private::NativeProcessProtocol::GetThreadByID
NativeThreadProtocol * GetThreadByID(lldb::tid_t tid)
Definition: NativeProcessProtocol.cpp:114
lldb_private::NativeProcessProtocol::EnableSoftwareBreakpoint
llvm::Expected< SoftwareBreakpoint > EnableSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint)
Definition: NativeProcessProtocol.cpp:409
lldb_private::NativeProcessProtocol::m_software_breakpoints
std::unordered_map< lldb::addr_t, SoftwareBreakpoint > m_software_breakpoints
Definition: NativeProcessProtocol.h:393
lldb_private::NativeProcessProtocol::SetExitStatus
virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange)
Definition: NativeProcessProtocol.cpp:75
lldb_private::NativeProcessProtocol::GetHardwareDebugSupportInfo
virtual llvm::Optional< std::pair< uint32_t, uint32_t > > GetHardwareDebugSupportInfo() const
Definition: NativeProcessProtocol.cpp:130
lldb_private::NativeProcessProtocol::GetMemoryRegionInfo
virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info)
Definition: NativeProcessProtocol.cpp:49
lldb_private::MemoryRegionInfo
Definition: MemoryRegionInfo.h:21
lldb_private::NativeProcessProtocol::m_pid
lldb::pid_t m_pid
Definition: NativeProcessProtocol.h:394
lldb_private::NativeProcessProtocol::Signal
virtual Status Signal(int signo)=0
Sends a process a UNIX signal signal.
lldb_private::NativeProcessProtocol::Extension::auxv
@ auxv
lldb_private::NativeProcessProtocol::SaveCore
virtual llvm::Expected< std::string > SaveCore(llvm::StringRef path_hint)
Write a core dump (without crashing the program).
Definition: NativeProcessProtocol.h:381
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::NativeProcessProtocol::m_terminal_fd
int m_terminal_fd
Definition: NativeProcessProtocol.h:408
lldb_private::NativeProcessProtocol::~NativeProcessProtocol
virtual ~NativeProcessProtocol()=default
lldb_private::NativeProcessProtocol::WriteMemoryTags
virtual Status WriteMemoryTags(int32_t type, lldb::addr_t addr, size_t len, const std::vector< uint8_t > &tags)
Definition: NativeProcessProtocol.cpp:62
lldb_private::NativeProcessProtocol::RemoveWatchpoint
virtual Status RemoveWatchpoint(lldb::addr_t addr)
Definition: NativeProcessProtocol.cpp:206
NativeWatchpointList.h
lldb_private::NativeProcessProtocol::Detach
virtual Status Detach()=0
lldb_private::NativeProcessProtocol::m_delegate
NativeDelegate & m_delegate
Definition: NativeProcessProtocol.h:405
lldb_private::WaitStatus
Definition: Host.h:34
lldb_private::NativeProcessProtocol::Extension::multiprocess
@ multiprocess
lldb_private::NativeProcessProtocol::Kill
virtual Status Kill()=0
lldb::eStateStopped
@ eStateStopped
Process or thread is stopped and can be examined.
Definition: lldb-enumerations.h:84
lldb_private::NativeProcessProtocol::SetCurrentThreadID
void SetCurrentThreadID(lldb::tid_t tid)
Definition: NativeProcessProtocol.h:205
lldb_private::NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode
virtual llvm::Expected< llvm::ArrayRef< uint8_t > > GetSoftwareBreakpointTrapOpcode(size_t size_hint)
Definition: NativeProcessProtocol.cpp:487
lldb_private::NativeProcessProtocol::IsStepping
bool IsStepping() const
Definition: NativeProcessProtocol.h:180
lldb_private::NativeProcessProtocol::TraceGetBinaryData
virtual llvm::Expected< std::vector< uint8_t > > TraceGetBinaryData(const TraceGetBinaryDataRequest &request)
Get binary data given a trace technology and a data identifier.
Definition: NativeProcessProtocol.h:352
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::NativeWatchpointList::WatchpointMap
std::map< lldb::addr_t, NativeWatchpoint > WatchpointMap
Definition: NativeWatchpointList.h:32
lldb_private::NativeProcessProtocol::NotifyDidExec
void NotifyDidExec()
Notify the delegate that an exec occurred.
Definition: NativeProcessProtocol.cpp:319
lldb_private::SVR4LibraryInfo::next
lldb::addr_t next
Definition: NativeProcessProtocol.h:43
lldb_private::NativeProcessProtocol::NativeProcessProtocol
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate)
Definition: NativeProcessProtocol.cpp:26
lldb-private-forward.h
lldb_private::NativeProcessProtocol::RemoveSoftwareBreakpoint
Status RemoveSoftwareBreakpoint(lldb::addr_t addr)
Definition: NativeProcessProtocol.cpp:344
lldb_private::ProcessLaunchInfo
Definition: ProcessLaunchInfo.h:31
lldb_private::NativeProcessProtocol::ReadMemoryTags
virtual Status ReadMemoryTags(int32_t type, lldb::addr_t addr, size_t len, std::vector< uint8_t > &tags)
Definition: NativeProcessProtocol.cpp:56
lldb_private::NativeProcessProtocol::Factory::Launch
virtual llvm::Expected< std::unique_ptr< NativeProcessProtocol > > Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop) const =0
Launch a process for debugging.
lldb_private::NativeProcessProtocol::WriteMemory
virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)=0
lldb_private::NativeProcessProtocol::GetLoadedModuleFileSpec
virtual Status GetLoadedModuleFileSpec(const char *module_path, FileSpec &file_spec)=0
UnimplementedError.h
lldb_private::NativeProcessProtocol::m_hw_breakpoints_map
HardwareBreakpointMap m_hw_breakpoints_map
Definition: NativeProcessProtocol.h:407
lldb_private::NativeProcessProtocol::m_enabled_extensions
Extension m_enabled_extensions
Definition: NativeProcessProtocol.h:416
lldb_private::NativeProcessProtocol::SoftwareBreakpoint::saved_opcodes
llvm::SmallVector< uint8_t, 4 > saved_opcodes
Definition: NativeProcessProtocol.h:389
lldb_private::NativeProcessProtocol::SetID
void SetID(lldb::pid_t pid)
Definition: NativeProcessProtocol.h:425
lldb_private::NativeProcessProtocol::m_exit_status
llvm::Optional< WaitStatus > m_exit_status
Definition: NativeProcessProtocol.h:403
lldb_private::NativeProcessProtocol::GetID
lldb::pid_t GetID() const
Definition: NativeProcessProtocol.h:172
lldb_private::NativeProcessProtocol::GetThreadByIDUnlocked
NativeThreadProtocol * GetThreadByIDUnlocked(lldb::tid_t tid)
Definition: NativeProcessProtocol.cpp:106
lldb_private::NativeProcessProtocol::m_signals_to_ignore
llvm::DenseSet< int > m_signals_to_ignore
Definition: NativeProcessProtocol.h:413
lldb_private::NativeProcessProtocol::DoStopIDBumped
virtual void DoStopIDBumped(uint32_t newBumpId)
Definition: NativeProcessProtocol.cpp:727
lldb_private::NativeProcessProtocol::m_state
lldb::StateType m_state
Definition: NativeProcessProtocol.h:400
lldb_private::NativeProcessProtocol::NativeDelegate::NewSubprocess
virtual void NewSubprocess(NativeProcessProtocol *parent_process, std::unique_ptr< NativeProcessProtocol > child_process)=0
lldb_private::NativeProcessProtocol::Extension::vfork
@ vfork
lldb_private::NativeProcessProtocol::SetEnabledExtensions
virtual void SetEnabledExtensions(Extension flags)
Method called in order to propagate the bitmap of protocol extensions supported by the client.
Definition: NativeProcessProtocol.h:369
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::NativeProcessProtocol::m_threads
std::vector< std::unique_ptr< NativeThreadProtocol > > m_threads
Definition: NativeProcessProtocol.h:396
lldb_private::NativeProcessProtocol::Extension::fork
@ fork
lldb_private::NativeProcessProtocol::RemoveBreakpoint
virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware=false)
Definition: NativeProcessProtocol.cpp:605
lldb_private::LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:683
lldb_private::NativeProcessProtocol::GetTerminalFileDescriptor
virtual int GetTerminalFileDescriptor()
Definition: NativeProcessProtocol.h:214
lldb_private::NativeProcessProtocol::Factory::~Factory
virtual ~Factory()
lldb_private::NativeProcessProtocol::Extension
Extension
Extension flag constants, returned by Factory::GetSupportedExtensions() and passed to SetEnabledExten...
Definition: NativeProcessProtocol.h:245
lldb-types.h
lldb_private::NativeProcessProtocol::GetSoftwareBreakpointPCOffset
virtual size_t GetSoftwareBreakpointPCOffset()
Return the offset of the PC relative to the software breakpoint that was hit.
Definition: NativeProcessProtocol.cpp:529
lldb::eStateStepping
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
Definition: lldb-enumerations.h:86
lldb_private::TraceStopRequest
jLLDBTraceStop gdb-remote packet
Definition: TraceGDBRemotePackets.h:62
lldb_private::NativeProcessProtocol::FixupBreakpointPCAsNeeded
void FixupBreakpointPCAsNeeded(NativeThreadProtocol &thread)
Definition: NativeProcessProtocol.cpp:555
lldb_private::SVR4LibraryInfo::name
std::string name
Definition: NativeProcessProtocol.h:39
lldb_private::NativeProcessProtocol::GetStopID
uint32_t GetStopID() const
Definition: NativeProcessProtocol.cpp:722
lldb_private::NativeProcessProtocol::NativeDelegate::~NativeDelegate
virtual ~NativeDelegate()=default
lldb_private::NativeProcessProtocol::SoftwareBreakpoint
Definition: NativeProcessProtocol.h:387
lldb_private::Status
Definition: Status.h:44
uint32_t
lldb_private::NativeWatchpointList
Definition: NativeWatchpointList.h:25
lldb_private::NativeProcessProtocol::TraceStop
virtual llvm::Error TraceStop(const TraceStopRequest &request)
Stop tracing a live process or its threads.
Definition: NativeProcessProtocol.h:336
lldb_private::HardwareBreakpointMap
std::map< lldb::addr_t, HardwareBreakpoint > HardwareBreakpointMap
Definition: NativeBreakpointList.h:23
NativeThreadProtocol.h
lldb_private::MainLoop
Definition: MainLoop.h:38
lldb_private::NativeProcessProtocol::m_current_thread_id
lldb::tid_t m_current_thread_id
Definition: NativeProcessProtocol.h:397
lldb_private::NativeProcessProtocol::RemoveHardwareBreakpoint
virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr)
Definition: NativeProcessProtocol.cpp:291
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb_private::NativeProcessProtocol
Definition: NativeProcessProtocol.h:47
lldb_private::NativeProcessProtocol::Extension::pass_signals
@ pass_signals
lldb_private::SVR4LibraryInfo::base_addr
lldb::addr_t base_addr
Definition: NativeProcessProtocol.h:41
lldb_private::NativeProcessProtocol::NativeDelegate::ProcessStateChanged
virtual void ProcessStateChanged(NativeProcessProtocol *process, lldb::StateType state)=0
lldb_private::NativeProcessProtocol::GetState
lldb::StateType GetState() const
Definition: NativeProcessProtocol.cpp:693
lldb_private::SVR4LibraryInfo::link_map
lldb::addr_t link_map
Definition: NativeProcessProtocol.h:40
ArchSpec.h
lldb_private::NativeProcessProtocol::IsAlive
virtual bool IsAlive() const
Definition: NativeProcessProtocol.cpp:119
lldb_private::NativeProcessProtocol::SetBreakpoint
virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware)=0
lldb_private::NativeProcessProtocol::TraceGetState
virtual llvm::Expected< llvm::json::Value > TraceGetState(llvm::StringRef type)
Get the current tracing state of the process and its threads.
Definition: NativeProcessProtocol.h:344
lldb_private::NativeProcessProtocol::Factory::GetSupportedExtensions
virtual Extension GetSupportedExtensions() const
Get the bitmask of extensions supported by this process plugin.
Definition: NativeProcessProtocol.h:309
lldb_private::NativeProcessProtocol::GetHardwareBreakpointMap
virtual const HardwareBreakpointMap & GetHardwareBreakpointMap() const
Definition: NativeProcessProtocol.cpp:230
lldb_private::NativeProcessProtocol::Resume
virtual Status Resume(const ResumeActionList &resume_actions)=0
lldb_private::TraceGetBinaryDataRequest::type
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
Definition: TraceGDBRemotePackets.h:134
lldb_private::NativeProcessProtocol::m_stop_id
uint32_t m_stop_id
Definition: NativeProcessProtocol.h:409
lldb_private::NativeProcessProtocol::GetExitStatus
virtual llvm::Optional< WaitStatus > GetExitStatus()
Definition: NativeProcessProtocol.cpp:68
lldb_private::NativeProcessProtocol::DeallocateMemory
virtual llvm::Error DeallocateMemory(lldb::addr_t addr)
Definition: NativeProcessProtocol.h:129
lldb_private::NativeProcessProtocol::m_state_mutex
std::recursive_mutex m_state_mutex
Definition: NativeProcessProtocol.h:401
Status.h
lldb_private::NativeProcessProtocol::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Definition: NativeProcessProtocol.h:184
lldb_private::ResumeActionList
Definition: Debug.h:33
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::NativeProcessProtocol::Factory::Attach
virtual llvm::Expected< std::unique_ptr< NativeProcessProtocol > > Attach(lldb::pid_t pid, NativeDelegate &native_delegate, MainLoop &mainloop) const =0
Attach to an existing process.
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
lldb_private::SVR4LibraryInfo
Definition: NativeProcessProtocol.h:38
lldb_private::NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged
void SynchronouslyNotifyProcessStateChanged(lldb::StateType state)
Definition: NativeProcessProtocol.cpp:309
lldb_private::NativeProcessProtocol::GetWatchpointMap
virtual const NativeWatchpointList::WatchpointMap & GetWatchpointMap() const
Definition: NativeProcessProtocol.cpp:125
lldb::eStateInvalid
@ eStateInvalid
Definition: lldb-enumerations.h:74
lldb_private::NativeProcessProtocol::IsRunning
bool IsRunning() const
Definition: NativeProcessProtocol.h:176
lldb_private::NativeProcessProtocol::TraceSupported
virtual llvm::Expected< TraceSupportedResponse > TraceSupported()
Get the processor tracing type supported for this process.
Definition: NativeProcessProtocol.h:360
lldb_private::NativeProcessProtocol::Interrupt
virtual Status Interrupt()
Tells a process to interrupt all operations as if by a Ctrl-C.
Definition: NativeProcessProtocol.cpp:32
lldb_private::NativeProcessProtocol::Halt
virtual Status Halt()=0
lldb_private::NativeProcessProtocol::NativeDelegate::InitializeDelegate
virtual void InitializeDelegate(NativeProcessProtocol *process)=0
LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:94
lldb_private::NativeProcessProtocol::UpdateThreads
virtual size_t UpdateThreads()=0
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
NativeBreakpointList.h
lldb_private::NativeProcessProtocol::m_threads_mutex
std::recursive_mutex m_threads_mutex
Definition: NativeProcessProtocol.h:398
lldb_private::NativeProcessProtocol::GetAddressByteSize
uint32_t GetAddressByteSize() const
Definition: NativeProcessProtocol.h:188
lldb_private::TraceStopRequest::type
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
Definition: TraceGDBRemotePackets.h:72
lldb::eStateRunning
@ eStateRunning
Process or thread is running and can't be examined.
Definition: lldb-enumerations.h:85
lldb_private::NativeProcessProtocol::Factory
Definition: NativeProcessProtocol.h:258
TraceGDBRemotePackets.h
MainLoop.h
lldb_private::NativeProcessProtocol::ReadMemory
virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)=0
lldb_private::NativeProcessProtocol::GetFileLoadAddress
virtual Status GetFileLoadAddress(const llvm::StringRef &file_name, lldb::addr_t &load_addr)=0
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
lldb_private::NativeProcessProtocol::NativeDelegate::DidExec
virtual void DidExec(NativeProcessProtocol *process)=0
lldb_private::NativeProcessProtocol::GetArchitecture
virtual const ArchSpec & GetArchitecture() const =0