Go to the documentation of this file.
9 #ifndef LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
10 #define LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_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"
29 #include <unordered_map>
35 class MemoryRegionInfo;
36 class ResumeActionList;
85 size_t &bytes_read) = 0;
91 std::vector<uint8_t> &tags);
94 const std::vector<uint8_t> &tags);
117 llvm::Expected<llvm::StringRef>
119 size_t &total_bytes_read);
122 size_t &bytes_written) = 0;
126 return llvm::make_error<UnimplementedError>();
130 return llvm::make_error<UnimplementedError>();
135 virtual llvm::Expected<std::vector<SVR4LibraryInfo>>
137 return llvm::createStringError(llvm::inconvertibleErrorCode(),
163 virtual llvm::Optional<std::pair<uint32_t, uint32_t>>
167 uint32_t watch_flags,
bool hardware);
192 virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
234 std::unique_ptr<NativeProcessProtocol> child_process) = 0;
280 virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
302 virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
330 llvm::StringRef type) {
331 return llvm::createStringError(llvm::inconvertibleErrorCode(),
332 "Unsupported tracing type '%s'",
338 return llvm::createStringError(llvm::inconvertibleErrorCode(),
339 "Unsupported tracing type '%s'",
340 request.
type.data());
344 virtual llvm::Expected<llvm::json::Value>
346 return llvm::createStringError(llvm::inconvertibleErrorCode(),
347 "Unsupported tracing type '%s'",
352 virtual llvm::Expected<std::vector<uint8_t>>
354 return llvm::createStringError(
355 llvm::inconvertibleErrorCode(),
356 "Unsupported data kind '%s' for the '%s' tracing technology",
357 request.
kind.c_str(), request.
type.c_str());
362 return llvm::make_error<UnimplementedError>();
382 virtual llvm::Expected<std::string>
SaveCore(llvm::StringRef path_hint) {
383 return llvm::createStringError(llvm::inconvertibleErrorCode(),
397 std::vector<std::unique_ptr<NativeThreadProtocol>>
m_threads;
442 virtual llvm::Expected<llvm::ArrayRef<uint8_t>>
466 llvm::Expected<SoftwareBreakpoint>
471 #endif // LLDB_HOST_COMMON_NATIVEPROCESSPROTOCOL_H
Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint)
std::string kind
Identifier for the data.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
NativeThreadProtocol * GetCurrentThread()
jLLDBTraceGetBinaryData gdb-remote packet
llvm::ArrayRef< uint8_t > breakpoint_opcodes
virtual llvm::Error TraceStart(llvm::StringRef json_params, llvm::StringRef type)
Start tracing a process or its threads.
Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
NativeThreadProtocol * GetThreadAtIndex(uint32_t idx)
virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
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.
virtual lldb::addr_t GetSharedLibraryInfoAddress()=0
virtual llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > GetAuxvData() const =0
virtual llvm::Expected< std::vector< SVR4LibraryInfo > > GetLoadedSVR4Libraries()
void SetState(lldb::StateType state, bool notify_delegates=true)
virtual Status IgnoreSignals(llvm::ArrayRef< int > signals)
virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware)
lldb::tid_t GetCurrentThreadID() const
NativeWatchpointList m_watchpoint_list
virtual llvm::Expected< lldb::addr_t > AllocateMemory(size_t size, uint32_t permissions)
NativeThreadProtocol * GetThreadByID(lldb::tid_t tid)
llvm::Expected< SoftwareBreakpoint > EnableSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint)
std::unordered_map< lldb::addr_t, SoftwareBreakpoint > m_software_breakpoints
virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange)
virtual llvm::Optional< std::pair< uint32_t, uint32_t > > GetHardwareDebugSupportInfo() const
virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info)
virtual Status Signal(int signo)=0
Sends a process a UNIX signal signal.
virtual llvm::Expected< std::string > SaveCore(llvm::StringRef path_hint)
Write a core dump (without crashing the program).
virtual ~NativeProcessProtocol()=default
virtual Status WriteMemoryTags(int32_t type, lldb::addr_t addr, size_t len, const std::vector< uint8_t > &tags)
virtual Status RemoveWatchpoint(lldb::addr_t addr)
virtual Status Detach()=0
NativeDelegate & m_delegate
@ eStateStopped
Process or thread is stopped and can be examined.
void SetCurrentThreadID(lldb::tid_t tid)
virtual llvm::Expected< llvm::ArrayRef< uint8_t > > GetSoftwareBreakpointTrapOpcode(size_t size_hint)
virtual llvm::Expected< std::vector< uint8_t > > TraceGetBinaryData(const TraceGetBinaryDataRequest &request)
Get binary data given a trace technology and a data identifier.
std::map< lldb::addr_t, NativeWatchpoint > WatchpointMap
void NotifyDidExec()
Notify the delegate that an exec occurred.
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate)
Status RemoveSoftwareBreakpoint(lldb::addr_t addr)
virtual Status ReadMemoryTags(int32_t type, lldb::addr_t addr, size_t len, std::vector< uint8_t > &tags)
virtual llvm::Expected< std::unique_ptr< NativeProcessProtocol > > Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop) const =0
Launch a process for debugging.
virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)=0
virtual Status GetLoadedModuleFileSpec(const char *module_path, FileSpec &file_spec)=0
HardwareBreakpointMap m_hw_breakpoints_map
Extension m_enabled_extensions
llvm::SmallVector< uint8_t, 4 > saved_opcodes
void SetID(lldb::pid_t pid)
llvm::Optional< WaitStatus > m_exit_status
lldb::pid_t GetID() const
NativeThreadProtocol * GetThreadByIDUnlocked(lldb::tid_t tid)
llvm::DenseSet< int > m_signals_to_ignore
virtual void DoStopIDBumped(uint32_t newBumpId)
virtual void NewSubprocess(NativeProcessProtocol *parent_process, std::unique_ptr< NativeProcessProtocol > child_process)=0
virtual void SetEnabledExtensions(Extension flags)
Method called in order to propagate the bitmap of protocol extensions supported by the client.
@ LLVM_MARK_AS_BITMASK_ENUM
string(SUBSTRING ${p} 10 -1 pStripped) if($
std::vector< std::unique_ptr< NativeThreadProtocol > > m_threads
virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware=false)
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
virtual int GetTerminalFileDescriptor()
Extension
Extension flag constants, returned by Factory::GetSupportedExtensions() and passed to SetEnabledExten...
virtual size_t GetSoftwareBreakpointPCOffset()
Return the offset of the PC relative to the software breakpoint that was hit.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
jLLDBTraceStop gdb-remote packet
void FixupBreakpointPCAsNeeded(NativeThreadProtocol &thread)
uint32_t GetStopID() const
virtual ~NativeDelegate()=default
virtual llvm::Error TraceStop(const TraceStopRequest &request)
Stop tracing a live process or its threads.
std::map< lldb::addr_t, HardwareBreakpoint > HardwareBreakpointMap
lldb::tid_t m_current_thread_id
virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr)
virtual void ProcessStateChanged(NativeProcessProtocol *process, lldb::StateType state)=0
lldb::StateType GetState() const
virtual bool IsAlive() const
virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware)=0
virtual llvm::Expected< llvm::json::Value > TraceGetState(llvm::StringRef type)
Get the current tracing state of the process and its threads.
virtual Extension GetSupportedExtensions() const
Get the bitmask of extensions supported by this process plugin.
virtual const HardwareBreakpointMap & GetHardwareBreakpointMap() const
virtual Status Resume(const ResumeActionList &resume_actions)=0
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
virtual llvm::Optional< WaitStatus > GetExitStatus()
virtual llvm::Error DeallocateMemory(lldb::addr_t addr)
std::recursive_mutex m_state_mutex
lldb::ByteOrder GetByteOrder() const
A class that represents a running process on the host machine.
virtual llvm::Expected< std::unique_ptr< NativeProcessProtocol > > Attach(lldb::pid_t pid, NativeDelegate &native_delegate, MainLoop &mainloop) const =0
Attach to an existing process.
void SynchronouslyNotifyProcessStateChanged(lldb::StateType state)
virtual const NativeWatchpointList::WatchpointMap & GetWatchpointMap() const
virtual llvm::Expected< TraceSupportedResponse > TraceSupported()
Get the processor tracing type supported for this process.
virtual Status Interrupt()
Tells a process to interrupt all operations as if by a Ctrl-C.
virtual void InitializeDelegate(NativeProcessProtocol *process)=0
#define LLDB_INVALID_THREAD_ID
virtual size_t UpdateThreads()=0
StateType
Process and Thread States.
std::recursive_mutex m_threads_mutex
uint32_t GetAddressByteSize() const
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
@ eStateRunning
Process or thread is running and can't be examined.
virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)=0
virtual Status GetFileLoadAddress(const llvm::StringRef &file_name, lldb::addr_t &load_addr)=0
ByteOrder
Byte ordering definitions.
virtual void DidExec(NativeProcessProtocol *process)=0
virtual const ArchSpec & GetArchitecture() const =0