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