123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- /*++
- Copyright (c) 2013 Minoca Corp. All Rights Reserved
- Module Name:
- userdbg.h
- Abstract:
- This header defines the API between the common debugger client and the OS
- specific portions needed to support user mode debugging.
- Author:
- Evan Green 3-Jun-2013
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // -------------------------------------------------------- Function Prototypes
- //
- BOOL
- LaunchChildProcess (
- ULONG ArgumentCount,
- PSTR *Arguments
- );
- /*++
- Routine Description:
- This routine launches a new child process to be debugged.
- Arguments:
- ArgumentCount - Supplies the number of command line arguments for the
- executable.
- Arguments - Supplies the array of arguments to pass.
- Return Value:
- TRUE on success.
- FALSE on failure.
- --*/
- BOOL
- DbgpUserContinue (
- ULONG SignalToDeliver
- );
- /*++
- Routine Description:
- This routine sends the "go" command to the target, signaling to continue
- execution.
- Arguments:
- SignalToDeliver - Supplies the signal number to actually send to the
- application. For kernel debugging, this parameter is ignored.
- Return Value:
- Returns TRUE if successful, or FALSE if there was an error.
- --*/
- BOOL
- DbgpUserSetRegisters (
- PREGISTERS_UNION Registers
- );
- /*++
- Routine Description:
- This routine sets the registers of the debugging target.
- Arguments:
- Registers - Supplies a pointer to the registers to set. All register values
- will be written.
- Return Value:
- Returns TRUE if successful, or FALSE if there was an error.
- --*/
- BOOL
- DbgpUserSingleStep (
- ULONG SignalToDeliver
- );
- /*++
- Routine Description:
- This routine steps the target by one instruction.
- Arguments:
- SignalToDeliver - Supplies the signal number to actually send to the
- application. For kernel debugging, this parameter is ignored.
- Return Value:
- Returns TRUE if successful, or FALSE if there was an error.
- --*/
- BOOL
- DbgpUserWaitForEvent (
- PDEBUGGER_EVENT Event
- );
- /*++
- Routine Description:
- This routine gets an event from the target, such as a break event or other
- exception.
- Arguments:
- Event - Supplies a pointer where the event details will be returned.
- Return Value:
- Returns TRUE on success, or FALSE on failure.
- --*/
- BOOL
- DbgpUserRangeStep (
- PRANGE_STEP RangeStep,
- ULONG SignalToDeliver
- );
- /*++
- Routine Description:
- This routine continues execution until a range of execution addresses is
- reached.
- Arguments:
- RangeStep - Supplies a pointer to the range to go to.
- SignalToDeliver - Supplies the signal number to actually send to the
- application. For kernel debugging, this parameter is ignored.
- Return Value:
- Returns TRUE if successful, or FALSE on failure.
- --*/
- BOOL
- DbgpUserReadWriteMemory (
- BOOL WriteOperation,
- BOOL VirtualMemory,
- ULONGLONG Address,
- PVOID Buffer,
- ULONG BufferSize,
- PULONG BytesCompleted
- );
- /*++
- Routine Description:
- This routine retrieves or writes to the target's memory.
- Arguments:
- WriteOperation - Supplies a flag indicating whether this is a read
- operation (FALSE) or a write operation (TRUE).
- VirtualMemory - Supplies a flag indicating whether the memory accessed
- should be virtual or physical.
- Address - Supplies the address to read from or write to in the target's
- memory.
- Buffer - Supplies a pointer to the buffer where the memory contents will be
- returned for read operations, or supplies a pointer to the values to
- write to memory on for write operations.
- BufferSize - Supplies the size of the supplied buffer, in bytes.
- BytesCompleted - Supplies a pointer that receive the number of bytes that
- were actually read from or written to the target.
- Return Value:
- Returns TRUE if the operation was successful.
- FALSE if there was an error.
- --*/
- BOOL
- DbgpUserGetThreadList (
- PULONG ThreadCount,
- PULONG *ThreadIds
- );
- /*++
- Routine Description:
- This routine gets the list of active threads in the process (or active
- processors in the machine for kernel mode).
- Arguments:
- ThreadCount - Supplies a pointer where the number of threads will be
- returned on success.
- ThreadIds - Supplies a pointer where an array of thread IDs (or processor
- numbers) will be returned on success. It is the caller's responsibility
- to free this memory.
- Return Value:
- Returns TRUE if successful, FALSE on failure.
- --*/
- BOOL
- DbgpUserSwitchThread (
- ULONG ThreadId,
- PDEBUGGER_EVENT NewBreakInformation
- );
- /*++
- Routine Description:
- This routine switches the debugger to another thread.
- Arguments:
- ThreadId - Supplies the ID of the thread to switch to.
- NewBreakInformation - Supplies a pointer where the updated break information
- will be returned.
- Return Value:
- Returns TRUE if successful, or FALSE if there was no change.
- --*/
- BOOL
- DbgpUserGetLoadedModuleList (
- PMODULE_LIST_HEADER *ModuleList
- );
- /*++
- Routine Description:
- This routine retrieves the list of loaded binaries from the kernel
- debugging target.
- Arguments:
- ModuleList - Supplies a pointer where a pointer to the loaded module header
- and subsequent array of entries will be returned. It is the caller's
- responsibility to free this allocated memory when finished.
- Return Value:
- Returns TRUE on success, or FALSE on failure.
- --*/
- VOID
- DbgpUserRequestBreakIn (
- VOID
- );
- /*++
- Routine Description:
- This routine attempts to stop the running target.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- ULONG
- DbgpUserGetSignalToDeliver (
- ULONG SignalNumber
- );
- /*++
- Routine Description:
- This routine returns the value for the "signal to deliver" parameters when
- letting the target continue. For user mode processes, breaks into the
- debugger occur because of signal delivery, and the debugger has the choice
- of whether or not to actually deliver a signal.
- Arguments:
- SignalNumber - Supplies the last signal caught by the debugger.
- Return Value:
- Returns the signal to deliver for the upcoming target continuation.
- 0 if no signal should be delivered to the target.
- --*/
|