class ProcessHandle

Defined at line 78 of file ../../src/developer/debug/debug_agent/process_handle.h

Public Methods

const NativeProcessHandle & GetNativeHandle ()

Access to the underlying native process object. This is for porting purposes, ideally this

object would encapsulate all details about the process for testing purposes and this getter

would be removed. In testing situations, the returned value may be an empty object,

TODO(brettw) Remove this.

NativeProcessHandle & GetNativeHandle ()
zx_koid_t GetKoid ()
std::string GetName ()
std::vector<std::unique_ptr<ThreadHandle>> GetChildThreads ()
zx_koid_t GetJobKoid ()

Get the Koid of the enclosing job.

debug::Status Kill ()

Terminates the process. The actually termination will normally happen asynchronously.

int64_t GetReturnCode ()

Retrieves the return code for an exited process. Returns some default value if the process is

still running (as defined by the kernel).

debug::Status Attach (ProcessHandleObserver * observer, AttachConfig config)

Registers for process notifications on the given interface. The pointer must outlive this class

or until Detach() is called. The observer must not be null (use Detach() instead). Calling

multiple times will replace the observer pointer.

bool IsAttached ()
void Detach ()

Unregisters for process notifications. See Attach(). It is legal to call Detach() multiple

times or when not already attached.

uint64_t GetLoaderBreakpointAddress ()

Get the address of the dynamic loader's special breakpoint that notifies a module list change.

See "DEBUGGER INTERFACE IN DYNAMIC LOADER" above.

std::vector<debug_ipc::AddressRegion> GetAddressSpace (uint64_t address)

Returns the address space information. If the address is non-null, only the regions covering

that address will be returned. Otherwise all regions will be returned.

std::optional<debug_ipc::AddressRegion> GetSharedAddressSpace ()

Returns the address region corresponding to the shared address space if this process has

multiple instances of ZX_INFO_MAPS_TYPE_ASPACE map types. This is only possible today via

processes created with the zx_process_create_shared syscall in conjunction with the

ZX_PROCESS_SHARED option to zx_process_create, which can be controlled by options to the ELF

runner in a component's CML file or via calling the syscall directly. The process created via

zx_process_create with ZX_PROCESS_SHARED is considered the "prototype" process, from which

other shared processes are created.

This prototype process contains exactly one address space, which is then shared with other

processes created via zx_process_create_shared. The shared process, which contains both a

private address space and the shared one from the prototype. In either case, this function

returns the shared address space from the process, if present.

std::vector<debug_ipc::Module> GetModules ()

Returns the modules (shared libraries and the main binary) for the process. Will be empty on

failure.

Prefer this version to calling the elf_utils variant because this one allows mocking.

fit::result<debug::Status, std::vector<debug_ipc::InfoHandle>> GetHandles ()

Returns the handles opened by the process.

debug::Status ReadMemory (uintptr_t address, void * buffer, size_t len, size_t * actual)
debug::Status WriteMemory (uintptr_t address, const void * buffer, size_t len, size_t * actual)
std::vector<debug_ipc::MemoryBlock> ReadMemoryBlocks (uint64_t address, uint32_t size)

Does a mapped-memory-aware read of the process memory. The result can contain holes which

the normal ReadMemory call above can't handle. On failure, there will be one block returned

covering the requested size, marked invalid.

debug::Status SaveMinidump (const std::vector<DebuggedThread *> & threads, std::vector<uint8_t> * core_data)
void ~ProcessHandle ()

Defined at line 80 of file ../../src/developer/debug/debug_agent/process_handle.h

Records