class ThreadHandle
Defined at line 37 of file ../../src/developer/debug/debug_agent/thread_handle.h
An abstract wrapper around an OS thread primitive. This abstraction is to allow mocking.
Public Methods
const NativeThreadHandle & GetNativeHandle ()
Access to the underlying native thread object. This is for porting purposes, ideally this
object would encapsulate all details about the thread for testing purposes and this getter
would be removed. In testing situations, the returned value may be an empty object,
TODO(brettw) Remove this.
NativeThreadHandle & GetNativeHandle ()
zx_koid_t GetKoid ()
std::string GetName ()
State GetState ()
debug_ipc::ThreadRecord GetThreadRecord (zx_koid_t process_koid)
Fills in everything but the stack into the returned thread record. Since the process koid
isn't known by the thread handle, it is passed in.
std::unique_ptr<SuspendHandle> Suspend ()
Asynchronously suspends the thread. The thread will remain suspended as long as any suspend
handle is alive. See also WaitForSuspension().
bool WaitForSuspension (TickTimePoint deadline)
Waits for a previous suspend call to take effect. Does nothing if the thread is already
suspended. Returns true if we could find a valid suspension condition (either suspended or on
an exception). False if timeout or error.
std::optional<GeneralRegisters> GetGeneralRegisters ()
Reads and writes the general thread registers.
void SetGeneralRegisters (const GeneralRegisters & regs)
std::optional<DebugRegisters> GetDebugRegisters ()
Reads and writes the debug thread registers.
bool SetDebugRegisters (const DebugRegisters & regs)
void SetSingleStep (bool single_step)
Puts the thread in or out of single-step mode.
std::vector<debug::RegisterValue> ReadRegisters (const std::vector<debug::RegisterCategory> & cats_to_get)
Returns the current values of the given register categories.
std::vector<debug::RegisterValue> WriteRegisters (const std::vector<debug::RegisterValue> & regs)
Returns the new value of the registers that may have changed which is the result of reading
them after the write. This helps the client stay in sync. The may include other registers that
weren't updated.
bool InstallHWBreakpoint (uint64_t address)
Installs or uninstalls hardware breakpoints.
bool UninstallHWBreakpoint (uint64_t address)
std::optional<WatchpointInfo> InstallWatchpoint (debug_ipc::BreakpointType type, const debug::AddressRange & range)
NOTE: AddressRange is what is used to differentiate watchpoints, not |type|.
bool UninstallWatchpoint (const debug::AddressRange & range)
void ~ThreadHandle ()
Defined at line 59 of file ../../src/developer/debug/debug_agent/thread_handle.h