GDBServerFoundation::MinimalTargetBase Class Reference

Provides default "not supported" implementations for optional methods of IStoppedGDBTarget. More...

#include <IGDBTarget.h>

Inheritance diagram for GDBServerFoundation::MinimalTargetBase:
GDBServerFoundation::ISyncGDBTarget GDBServerFoundation::IStoppedGDBTarget

Public Member Functions

virtual GDBStatus ReadFrameRelatedRegisters (int threadID, RegisterSetContainer &registers)
 Reads program counter, stack pointer and stack base pointer registers.
 
virtual GDBStatus GetDynamicLibraryList (std::vector< DynamicLibraryRecord > &libraries)
 Fills the list of the dynamic libraries currently loaded in the target.
 
virtual GDBStatus GetThreadList (std::vector< ThreadRecord > &threads)
 Fills the list of the threads currently present in the target.
 
virtual GDBStatus SetThreadModeForNextCont (int threadID, DebugThreadMode mode, OUT bool *pNeedRestoreCall, IN OUT INT_PTR *pRestoreCookie)
 Sets the mode in which an individual thread will continue before the next debug event.
 
virtual GDBStatus Terminate ()
 Terminates the target.
 
virtual GDBStatus CreateBreakpoint (BreakpointType type, ULONGLONG Address, unsigned kind, OUT INT_PTR *pCookie)
 Sets a breakpoint at a given address.
 
virtual GDBStatus RemoveBreakpoint (BreakpointType type, ULONGLONG Address, INT_PTR Cookie)
 Removes a previously set breakpoint.
 
virtual GDBStatus ExecuteRemoteCommand (const std::string &command, std::string &output)
 This handler is invoked when user sends an arbitrary command to the GDB stub ("mon <command>" in GDB).
 
virtual IFLASHProgrammerGetFLASHProgrammer ()
 Returns a pointer to an IFLASHProgrammer instance, or NULL if not supported. The returned instance should be persistent (e.g. the same object that implements IStoppedGDBTarget).
 
- Public Member Functions inherited from GDBServerFoundation::ISyncGDBTarget
virtual GDBStatus GetLastStopRecord (TargetStopRecord *pRec)=0
 Returns the information explaining why the target has stopped (e.g. stopped at a breakpoint).
 
virtual GDBStatus ResumeAndWait (int threadID)=0
 Resumes the target and indefinitely waits till a next debug event occurs.
 
virtual GDBStatus Step (int threadID)=0
 Resumes the target in a single-step mode.
 
virtual GDBStatus SendBreakInRequestAsync ()=0
 Requests the target to stop executing (i.e. forces a breakpoint)
 
- Public Member Functions inherited from GDBServerFoundation::IStoppedGDBTarget
virtual const
PlatformRegisterList
GetRegisterList ()=0
 Returns a pointer to a persistent list of the registers supported by the target.
 
virtual GDBStatus ReadTargetRegisters (int threadID, RegisterSetContainer &registers)=0
 Reads the values of all registers from the target.
 
virtual GDBStatus WriteTargetRegisters (int threadID, const RegisterSetContainer &registers)=0
 Writes one or more target registers.
 
virtual GDBStatus ReadTargetMemory (ULONGLONG Address, void *pBuffer, size_t *pSizeInBytes)=0
 Reads the memory of the underlying target.
 
virtual GDBStatus WriteTargetMemory (ULONGLONG Address, const void *pBuffer, size_t sizeInBytes)=0
 Writes the memory of the underlying target.
 
virtual ~IStoppedGDBTarget ()
 

Detailed Description

Provides default "not supported" implementations for optional methods of IStoppedGDBTarget.

Examples:
SimpleWin32Server/SimpleWin32Server.cpp.

Member Function Documentation

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::CreateBreakpoint ( BreakpointType  type,
ULONGLONG  Address,
unsigned  kind,
OUT INT_PTR *  pCookie 
)
inlinevirtual

Sets a breakpoint at a given address.

Parameters
typeSpecifies the type of the supported breakpoint.
AddressSpecifies the address where the breakpoint should be set.
kindSpecifies the additional information provided by GDB. For data breakpoints this is the length of the watched region.
pCookiereceives an arbitrary INT_PTR value that will be passed to RemoveBreakpoint() once this breakpoint is removed.
Remarks
It is not necessary to implement this method for software breakpoints. If GDB encounters a "not supported" reply, it will set the breakpoint using the WriteTargetMemory() call. It is only recommended to implement this method for the software breakpoints if it can set them better than GDB itself.

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::ExecuteRemoteCommand ( const std::string &  command,
std::string &  output 
)
inlinevirtual

This handler is invoked when user sends an arbitrary command to the GDB stub ("mon <command>" in GDB).

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::GetDynamicLibraryList ( std::vector< DynamicLibraryRecord > &  libraries)
inlinevirtual

Fills the list of the dynamic libraries currently loaded in the target.

If the target supports dynamic libraries (a.k.a DLLs, a.k.a. shared libraries, a.k.a. shared objects), this method should provide the information about them by filling the libraries vector.

Parameters
librariesContains an empty vector that should be filled with instances of DynamicLibraryRecord
Returns
If the target does not support dynamic libraries, the method should return kGDBNotSupported. Refer to GDBStatus documentation for more information.

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual IFLASHProgrammer* GDBServerFoundation::MinimalTargetBase::GetFLASHProgrammer ( )
inlinevirtual

Returns a pointer to an IFLASHProgrammer instance, or NULL if not supported. The returned instance should be persistent (e.g. the same object that implements IStoppedGDBTarget).

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::GetThreadList ( std::vector< ThreadRecord > &  threads)
inlinevirtual

Fills the list of the threads currently present in the target.

If the target supports multiple threads, this method should provide the information about them by filling the threads vector.

Parameters
threadsContains an empty vector that should be filled with instances of ThreadRecord
Returns
If the target does not support multiple threads, the method should return kGDBNotSupported. Refer to GDBStatus documentation for more information.

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::ReadFrameRelatedRegisters ( int  threadID,
RegisterSetContainer registers 
)
inlinevirtual

Reads program counter, stack pointer and stack base pointer registers.

Returns
See the GDBStatus description for a list of valid return codes.
Parameters
threadIDSpecifies the ID of the thread to query
registersContains the storage for the register values. The storage is initialized with RegisterValue instances flagged as invalid and sizes set based on the GetRegisterList() call.
Remarks
If this method returns an error, GDB will read all registers using the ReadTargetRegisters() method. Thus it only makes sense to implement this method if reading frame-related registers instead of all registers saves time.

Here's an example implementation of this method:

virtual GDBStatus ReadFrameRelatedRegisters(int threadID, RegisterSetContainer &registers)
{
// (Fill the context structure here)
registers[i386::rgEIP] = RegisterValue(context.Eip, 4);
registers[i386::rgESP] = RegisterValue(context.Esp, 4);
registers[i386::rgEBP] = RegisterValue(context.Ebp, 4);
return kGDBSuccess;
}

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::RemoveBreakpoint ( BreakpointType  type,
ULONGLONG  Address,
INT_PTR  Cookie 
)
inlinevirtual

Removes a previously set breakpoint.

This method should remove a breakpoint previously set with CreateBreakpoint().

Parameters
typeEqual to the type argument of the corresponding CreateBreakpoint() call.
AddressEqual to the Address argument of the corresponding CreateBreakpoint() call.
Cookiecontains the arbitrary INT_PTR value provided by the CreateBreakpoint() method.

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::SetThreadModeForNextCont ( int  threadID,
DebugThreadMode  mode,
OUT bool *  pNeedRestoreCall,
IN OUT INT_PTR *  pRestoreCookie 
)
inlinevirtual

Sets the mode in which an individual thread will continue before the next debug event.

This method allows setting different continuation modes (e.g. single-step, free run or halt) for different threads of a multi-threaded program. If the target does not support it, the method should return kGDBNotSupported.

Parameters
threadIDSpecifies the ID of the thread that is being controlled
modeSpecifies the mode in which the thread should be put until the next debug event
pNeedRestoreCallSet the value pointed by this argument to TRUE if this method needs to be called again with mode == dtmRestore once the next debug event completes.
pRestoreCookieIf mode is not dtmRestore, you set pNeedRestoreCall to TRUE, this argument can receive an arbitrary INT_PTR value that will be passed to the method later during the dtmRestore call. If mode is dtmRestore, this argument points to the previously saved value.
Remarks
Before the method is actually used, it is called with mode == dtmProbe and an invalid threadID to determine whether the target supports it. Thus, if mode is dtmProbe, the threadID argument should be ignored and the method should immediately return either kGDBNotSupported or kGDBSuccess.

Implements GDBServerFoundation::IStoppedGDBTarget.

virtual GDBStatus GDBServerFoundation::MinimalTargetBase::Terminate ( )
inlinevirtual

Terminates the target.

Implements GDBServerFoundation::IStoppedGDBTarget.


The documentation for this class was generated from the following file: