Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

9    Debugger Protocol Reference

Using Palm OS® Emulator

Palm OS Developer Suite

This chapter describes the debugger protocol, which provides an interface between a debugging target and a debugging host. For example, the Palm Debugger and the Palm OS® Emulator use this protocol to exchange commands and information.


IMPORTANT: This chapter describes the version of the Palm OS Debugger protocol that shipped on the Metrowerks CodeWarrior for the Palm Operating System, Version 6 CD-ROM. If you are using a different version, the features in your version might be different from the features described here.

This chapter covers the following topics:

About the Palm OS Debugger Protocol ^TOP^

The Palm OS debugger protocol allows a debugging target, which is usually a handheld ROM or an emulator program such as the Palm OS Emulator, to exchange information with a debugging host, such as the Palm Debugger or the Metrowerks debugger.

The debugger protocol involves sending packets between the host and the target. When the user of the host debugging program enters a command, the host converts that command into one or more command packets and sends each packet to the debugging target. In most cases, the target subsequently responds by sending a packet back to the host.

Packets ^TOP^

There are three packet types used in the debugger protocol:

  • The debugging host sends command request packets to the debugging target.
  • The debugging target sends command response packets back to the host.
  • Either the host or the target can send a message packet to the other.

Although the typical flow of packets involves the host sending a request and the target sending back a response, although there are a some exceptions, as follows:

  • The host can send some requests to the target that do not result in a response packet being returned. For example, when the host sends the Continue command packet to tell the target to continue execution, the target does not send back a response packet.
  • The target can send response packets to the host without receiving a request packet. For example, whenever the debugging target encounters an exception, it sends a State response packet to the host.

Packet Structure ^TOP^

Each packet consists of a packet header, a variable-length packet body, and a packet footer, as shown in Figure 9.1.

Figure 9.1  Packet Structure

The Packet Header

The packet header starts with the 24-bit key value $BEEFFD and includes header information and a checksum of the header itself.

The Packet Body

The packet body contains the command byte, a filler byte, and between 0 and 270 bytes of data. See "_SysPktBodyCommon" for a description of the structure used to represent the two byte body header (the command and filler bytes), and see Table 9.1 for a list of the command constants.

The Packet Footer

The packet footer contains a 16-bit CRC of the header and body. Note that the CRC computation does not include the footer.

Packet Communications ^TOP^

The communications protocol between the host and target is very simple: the host sends a request packet to the target and waits for a time-out or for a response from the target.

If a response is not detected within the time-out period, the host does not retry the request. When a response does not come back before timing out, it usually indicates that one of two things is happening:

  • the debugging target is busy executing code and has not encountered an exception
  • the state of the debugging target has degenerated so badly that it cannot respond

The host has the option of displaying a message to the user to inform him or her that the debugging target is not responding.

Constants ^TOP^

This section describes the constants and structure types that are used with the packets for various commands.

Packet Constants ^TOP^

#define sysPktMaxMemChunk 256
#define sysPktMaxBodySize (sysPktMaxMemChunk+16)
#define sysPktMaxNameLen 32
sysPktMaxMemChunk
The maximum number of bytes that can be read by the Read Memory command or written by the Write Memory command.
sysPktMaxBodySize
The maximum number of bytes in a request or response packet.
sysPktMaxNameLen
The maximum length of a function name.

State Constants ^TOP^

#define sysPktStateRspInstWords 15
sysPktStateRespInstWords
The number of remote code words sent in the response packet for the State command.

Breakpoint Constants ^TOP^

#define dbgNormalBreakpoints 5
#define dbgTempBPIndex dbNormalBreakpoints
#define dbgTotalBreakpoints (dbgTempBPIndex+1)
dbgNormalBreakpoints
The number of normal breakpoints available in the debugging target.
dbgTempBPIndex
The index in the breakpoints array of the temporary breakpoint.
dbgTotalBreakpoints
The total number of breakpoints in the breakpoints array, including the normal breakpoints and the temporary breakpoint.

Command Constants ^TOP^

Each command is represented by a single byte constant. The upper bit of each request command is clear, and the upper bit of each response command is set. Table 9.1 shows the command constants.

Table 9.1 Debugger protocol command constants 

Command

Request constant

Response constant

Continue

sysPktContinueCmd

N/A

Find

sysPktFindCmd

sysPktFindRsp

Get Breakpoints

sysPktGetBreakpointsCmd

sysPktGetBreakpointsRsp

Get Routine Name

sysPktGetRtnNameCmd

sysPktGetRtnNameRsp

Get Trap Breaks

sysPktGetTrapBreaksCmd

sysPktGetTrapBreaksRsp

Get Trap Conditionals

sysPktGetTrapConditionalsCmd

sysPktGetTrapConditionalsRsp

Message

sysPktRemoteMsgCmd

N/A

Read Memory

sysPktReadMemCmd

sysPktReadMemRsp

Read Registers

sysPktReadRegsCmd

sysPktReadRegsRsp

RPC

sysPktRPCCmd

sysPktRPCRsp

Set Breakpoints

sysPktSetBreakpointsCmd

sysPktSetBreakpointsRsp

Set Trap Breaks

sysPktSetTrapBreaksCmd

sysPktSetTrapBreaksRsp

Set Trap Conditionals

sysPktSetTrapConditionalsCmd

sysPktSetTrapConditionalsRsp

State

sysPktStateCmd

sysPktStateRsp

Toggle Debugger Breaks

sysPktDbgBreakToggleCmd

sysPktDbgBreakToggleRsp

Write Memory

sysPktWriteMemCmd

sysPktWriteMemRsp

Write Registers

sysPktWriteRegsCmd

sysPktWriteRegsRsp

Data Structures ^TOP^

This section describes the data structures used with the request and response packets for the debugger protocol commands.

_SysPktBodyCommon ^TOP^

The _SysPktBodyCommon macro defines the fields common to every request and response packet.

#define _sysPktBodyCommon \
Byte command; \
Byte _filler;

Fields

command The 1-byte command value for the packet.
_filler Included for alignment only. Not used.

SysPktBodyType ^TOP^

The SysPktBodyType represents a command packet that is sent to or received from the debugging target.

typedef struct SysPktBodyType
{
_SysPktBodyCommon;
Byte data[sysPktMaxBodySize-2];
} SysPktBodyType;

Fields

_SysPktBodyCommon
The command header for the packet.
data The packet data.

SysPktRPCParamType ^TOP^

The SysPktRPCParamType is used to send a parameter in a remote procedure call. See the RPC command for more information.

typedef struct SysPktRPCParamInfo
{
Byte byRef;
Byte size;
Word data[?];
} SysPktRPCParamType;

Fields

byRef Set to 1 if the parameter is passed by reference.
size The number of bytes in the data array. This must be an even number.
data The parameter data.

BreakpointType ^TOP^

The BreakpointType structure is used to represent the status of a single breakpoint on the debugging target.

typedef struct BreakpointType
{
Ptr addr;
Boolean enabled;
Boolean installed;
} BreakpointType;

Fields

addr The address of the breakpoint. If this is set to 0, the breakpoint is not in use.
enabled A Boolean value. This is TRUE if the breakpoint is currently enabled, and FALSE if not.
installed Included for correct alignment only. Not used.

Debugger Protocol Commands ^TOP^

This section describes each command that you can send to the debugging target, including a description of the response packet that the target sends back.

Continue ^TOP^

Purpose

Tells the debugging target to continue execution.

Comments

This command usually gets sent when the user specifies the Go command. Once the debugging target continues execution, the debugger is not reentered until a breakpoint or other exception is encountered.


NOTE: The debugging target does not send a response to this command.

Commands

The Continue request command is defined as follows:

#define sysPktContinueCmd 0x07

Request Packet

typedef struct SysPktContinueCmdType
{
_sysPktBodyCommon;
M68KresgType regs;
Boolean stepSpy;
DWord ssAddr;
DWord ssCount;
DWord ssCheckSum;
}SysPktContinueCmdType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> regs The new values for the debugging target processor registers. The new register values are stored in sequential order: D0 to D7, followed by A0 to A6.
—> stepSpy A Boolean value. If this is TRUE, the debugging target continues execution until the value that starts at the specified step-spy address changes. If this is FALSE, the debugging target continue execution until a breakpoint or other exception is encountered.
—> ssAddr The step-spy starting address. An exception is generated when the value starting at this address, for ssCount bytes, changes on the debugging target.
—> ssCount The number of bytes in the "spy" value. This value must be set to 4.
—> ssCheckSum This value is not used.

Find ^TOP^

Purpose

Searches for data in memory on the debugging target.

Comments

.

Commands

The Find request and response commands are defined as follows:

#define sysPktFindCmd 0x13
#define sysPktFindRsp 0x93

Request Packet

typedef struct SysPktFindCmdType
{
_sysPktBodyCommon;
DWord firstAddr;
DWord lastAddr;
Word numBytes
Boolean caseInsensitive;
Byte searchData[?];
}SysPktFindCmdType;

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> firstAddr The starting address of the memory range on the debugging target to search for the data.
—> lastAddr The ending address of the memory range on the debugging target to search for the data.
—> numBytes The number of bytes of data in the search string.
—> searchData The search string. The length of this array is defined by the value of the numBytes field.

Response Packet

typedef struct SysPktFindRspType
{
_sysPktBodyCommon;
DWord addr;
Boolean found;
}SysPktFindRspType

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— addr The address of the data string in memory on the debugging target.
<— found A Boolean value. If this is TRUE, the search string was found on the debugging target, and the value of addr is valid. If this is FALSE, the search string was not found, and the value of addr is not valid.

Get Breakpoints ^TOP^

Purpose

Retrieves the current breakpoint settings from the debugging target.

Comments

The body of the response packet contains an array with dbgTotalBreakpoints values in it, one for each possible breakpoint.

If a breakpoint is currently disabled on the debugging target, the enabled field for that breakpoint is set to 0.

If a breakpoint address is set to 0, the breakpoint is not currently in use.

The dbgTotalBreakpoints constant is described in "Breakpoint Constants".

Commands

The Get Breakpoints command request and response commands are defined as follows:

#define sysPktGetBreakpointsCmd 0x0B
#define sysPktGetBreakpointsRsp 0x8B

Request Packet

typedef struct SysPktGetBreakpointsCmdType
{
_sysPktBodyCommon;
}SysPktGetBreakpointsCmdType

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Response Packet

typedef struct SysPktGetBreakpointsRspType
{
_sysPktBodyCommon;
BreakpointType db[dbgTotalBreakpoints];
}SysPktGetBreakpointsRspType

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— bp An array with an entry for each of the possible breakpoints. Each entry is of the type BreakpointType.

Get Routine Name ^TOP^

Purpose

Determines the name, starting address, and ending address of the function that contains the specified address.

Comments

The name of each function is embedded into the code when it gets compiled. The debugging target can scan forward and backward in the code to determine the start and end addresses for each function.

Commands

The Get Routine Name command request and response commands are defined as follows:

#define sysPktGetRtnNameCmd 0x04
#define sysPktGetRtnNameRsp 0x84

Request Packet

typedef struct SysPktRtnNameCmdType
{
_sysPktBodyCommon;
void* address
}SysPktRtnNameCmdType;

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> address The code address whose function name you want to discover.

Response Packet

typedef struct SysPktRtnNameRspType
{
_sysPktBodyCommon;
void* address;
void* startAddr;
void* endAddr;
char name[sysPktMaxNameLen];
}SysPktRtnNameRspType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— address The code address whose function name was determined. This is the same address that was specified in the request packet.
<— startAddr The starting address in target memory of the function that includes the address.
<— endAddr The ending address in target memory of the function that includes the address. If a function name could not be found, this is the last address that was scanned.
<— name The name of the function that includes the address. This is a null-terminated string. If a function name could not be found, this is the null string.

Get Trap Breaks ^TOP^

Purpose

Retrieves the settings for the trap breaks on the debugging target.

Comments

Trap breaks are used to force the debugging target to enter the debugger when a particular system trap is called.

The body of the response packet contains an array with dbgTotalBreakpoints values in it, one for each possible trap break.

Each trap break is a single word value that contains the system trap number.

Commands

The Get Trap Breaks request and response commands are defined as follows:

#define sysPktGetTrapBreaksCmd 0x10
#define sysPktGetTrapBreaksRsp 0x90

Request Packet

typedef struct SysPktGetTrapBreaksCmdType
{
_sysPktBodyCommon;
}SysPktGetTrapBreaksCmdType;

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Response Packet

typedef struct SysPktGetTrapBreaksRspType
{
_sysPktBodyCommon;
Word trapBP[dbgTotalTrapBreaks];
}SysPktGetTrapBreaksRspType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— trapBP An array with an entry for each of the possible trap breaks. A value of 0 indicates that the trap break is not used.

Get Trap Conditionals ^TOP^

Purpose

Retrieves the trap conditionals values from the debugging target.

Comments

Trap conditionals are used when setting A-Traps for library calls. You can set a separate conditional value for each A-Trap.

The body of the response packet contains an array with dbgTotalBreakpoints values in it, one for each possible trap break.

Each trap conditional is a value; if the value of the first word on the stack matches the conditional value when the trap is called, the debugger breaks.

Commands

The Get Trap Conditionals request and response commands are defined as follows:

#define sysPktGetTrapConditionsCmd 0x14
#define sysPktGetTrapConditionsRsp 0x94

Request Packet

typedef struct SysPktGetTrapConditionsCmdType
{
_sysPktBodyCommon;
}SysPktGetTrapConditionsCmdType

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Response Packet

typedef struct SysPktGetTrapConditionsRspType
{
_sysPktBodyCommon;
Word trapParam[dbgTotalTrapBreaks];
}SysPktGetTrapConditionsRspType

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— trapParam An array with an entry for each of the possible trap breaks. A value of 0 indicates that the trap conditional is not used.

Message ^TOP^

Purpose

Sends a message to display on the debugging target.

Comments

Application can compile debugger messages into their code by calling the DbgMessage function.

The debugging target does not send back a response packet for this command.

Commands

The Message request command is defined as follows:

#define sysPktRemoteMsgCmd 0x7F

Request Packet

typedef struct SysPktRemoteMsgCmdType
{
_sysPktBodyCommon;
Byte text[1];
}SysPktRemoteMsgCmdType;

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> text The message text.

Read Memory ^TOP^

Purpose

Reads memory values from the debugging target.

Comments

This command can read up to sysPktMaxMemChunk bytes of memory. The actual size of the response packet depends on the number of bytes requested in the request packet.

Commands

The Read Memory command request and response commands are defined as follows:

#define sysPktReadMemCmd 0x01
#define sysPktReadMemRsp 0x81

Request Packet

typedef struct SysPktReadMemCmdType
{
_sysPktBodyCommon;
void* address;
Word numBytes;
}SysPktReadMemCmdType;

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> address The address in target memory from which to read values.
—> numBytes The number of bytes to read from target memory.

Response Packet

typedef struct SysPktReadMemRspType
{
_sysPktBodyCommon;
//Byte data[?];
}SysPktReadMemRspType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— data The returned data. The number of bytes in this field matches the numBytes value in the request packet.

Read Registers ^TOP^

Purpose

Retrieves the value of each of the target processor registers.

Comments

The eight data registers are stored in the response packet body sequentially, from D0 to D7. The seven address registers are stored in the response packet body sequentially, from A0 to A6.

Commands

The Read Registers command request and response commands are defined as follows:

#define sysPktReadRegsCmd 0x05
#define sysPktReadRegsRsp 0x85

Request Packet

typedef struct SysPktReadRegsCmdType
{
_sysPktBodyCommon;
}SysPktReadRegsCmdType;

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Response Packet

typedef struct SysPktReadRegsRspType
{
_sysPktBodyCommon;
M68KRegsType reg;
}SysPktReadRegsRspType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— reg The register values in sequential order: D0 to D7, followed by A0 to A6.

RPC ^TOP^

Purpose

Sends a remote procedure call to the debugging target.

Commands

The RPC request and response commands are defined as follows:

#define sysPktRPCCmd 0x0A
#define sysPktRPCRsp 0x8A

Request Packet

typedef struct SysPktRPCType
{
_sysPktBodyCommon;
Word trapWord;
DWord resultD0;
DWord resultD0;
Word numParams;
SysPktRPCParamType param[?];
}

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> trapWord The system trap to call.
—> resultD0 The result from the D0 register.
—> resultA0 The result from the A0 register.
—> numParams The number of RPC parameter structures in the param array that follows.
—> param An array of RPC parameter structures, as described in SysPktRPCParamType. Note that the parameters should appear in the reverse order of how they appear in the function declaration. For example, if you have the following function declaration:
Err DmDeleteDatabase (UInt16 cardNo, LocalID dbID)
you should a SysPktRPCParamType record to SysPktRPCType for dbID first and a SysPktRPCParamType record for cardNo second.

Set Breakpoints ^TOP^

Purpose

Sets breakpoints on the debugging target.

Comments

The body of the request packet contains an array with dbgTotalBreakpoints values in it, one for each possible breakpoint. If a breakpoint is currently disabled on the debugging target, the enabled field for that breakpoint is set to 0.

The dbgTotalBreakpoints constant is described in Breakpoint Constants.

Commands

The Set Breakpoints command request and response commands are defined as follows:

#define sysPktSetBreakpointsCmd 0x0C
#define sysPktSetBreakpointsRsp 0x8C

Request Packet

typedef struct SysPktSetBreakpointsCmdType
{
_sysPktBodyCommon;
BreakpointType db[dbgTotalBreakpoints];
}SysPktSetBreakpointsCmdType

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> bp An array with an entry for each of the possible breakpoints. Each entry is of the type BreakpointType.

Response Packet

typedef struct SysPktSetBreakpointsRspType
{
_sysPktBodyCommon;
}SysPktSetBreakpointsRspType

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Set Trap Breaks ^TOP^

Purpose

Sets breakpoints on the debugging target.

Comments

The body of the request packet contains an array with dbgTotalBreakpoints values in it, one for each possible trap break. If a trap break is currently disabled on the debugging target, the value of that break is set to 0.

The dbgTotalBreakpoints constant is described in Breakpoint Constants.

Commands

The Set Breakpoints command request and response commands are defined as follows:

#define sysPktSetTrapBreaksCmd 0x0C
#define sysPktSetTrapBreaksRsp 0x8C

Request Packet

typedef struct SysPktSetTrapBreakssCmdType
{
_sysPktBodyCommon;
Word trapBP[dbgTotalBreakpoints];
}SysPktSetTrapBreaksCmdType

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> trapBP An array with an entry for each of the possible trap breaks. If the value of an entry is 0, the break is not currently in use.

Response Packet

typedef struct SysPktSetTrapBreaksRspType
{
_sysPktBodyCommon;
}SysPktSetTrapBreaksRspType

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Set Trap Conditionals ^TOP^

Purpose

Sets the trap conditionals values for the debugging target.

Comments

Trap conditionals are used when setting A-Traps for library calls. You can set a separate conditional value for each A-Trap.

The body of the request packet contains an array with dbgTotalBreakpoints values in it, one for each possible trap break.

Each trap conditional is a value; if the value of the first word on the stack matches the conditional value when the trap is called, the debugger breaks.

Commands

The Set Trap Conditionals request and response commands are defined as follows:

#define sysPktSetTrapConditionsCmd 0x15
#define sysPktSetTrapConditionsRsp 0x95

Request Packet

typedef struct SysPktSetTrapConditionsCmdType
{
_sysPktBodyCommon;
Word trapParam[dbgTotalTrapBreaks];
}SysPktSetTrapConditionsCmdType

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> trapParam An array with an entry for each of the possible trap breaks. A value of 0 indicates that the trap conditional is not used.

Response Packet

typedef struct SysPktSetTrapConditionsRspType
{
_sysPktBodyCommon;
}SysPktSetTrapConditionsRspType

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

State ^TOP^

Purpose

Sent by the host program to query the current state of the debugging target, and sent by the target whenever it encounters an exception and enters the debugger.

Comments

The debugging target sends the State response packet whenever it enters the debugger for any reason, including a breakpoint, a bus error, a single step, or any other reason.

Commands

The State request and response commands are defined as follows:

#define sysPktStateCmd 0x00
#define sysPktStateRsp 0x80

Request Packet

typedef struct SysPktStateCmdType
{
_sysPktBodyCommon;
} SysPktStateCmdType

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Response Packet

typedef struct SysPktStateRspType
{
_sysPktBodyCommon;
Boolean resetted;
Word exceptionId;
M68KregsType reg;
Word inst[sysPktStateRspInstWords];
BreakpointType bp[dbgTotalBreakpoints];
void* startAddr;
void* endAddr;
char name[sysPktMaxNameLen];
Byte trapTableRev;
} SysPktStateRspType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— resetted A Boolean value. This is TRUE if the debugging target has just been reset.
<— exceptionId The ID of the exception that caused the debugger to be entered.
<— reg The register values in sequential order: D0 to D7, followed by A0 to A6.
<— inst A buffer of the instructions starting at the current program counter on the debugging target.
<— bp An array with an entry for each of the possible breakpoints. Each entry is of the type BreakpointType.
<— startAddr The starting address of the function that generated the exception.
<— endAddr The ending address of the function that generated the exception.
<— name The name of the function that generated the exception. This is a null-terminated string. If no name can be found, this is the null string.
<— trapTableRev The revision number of the trap table on the debugging target. You can use this to determine when the trap table cache on the host computer is invalid.

Toggle Debugger Breaks ^TOP^

Purpose

Enables or disables breakpoints that have been compiled into the code.

Comments

A breakpoint that has been compiled into the code is a special TRAP instruction that is generated when source code includes calls to the DbgBreak and DbgSrcBreak functions.

Sending this command toggles the debugging target between enabling and disabling these breakpoints.

Commands

The Toggle Debugger Breaks request and response commands are defined as follows:

#define sysPktDbgBreakToggleCmd 0x0D
#define sysPktDbgBreakToggleRsp 0x8D

Request Packet

typedef struct SysPktDbgBreakToggleCmdType
{
_sysPktBodyCommon;
}SysPktDbgBreakToggleCmdType;

Fields

—>_sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Response Packet

typedef struct SysPktDbgBreakToggleRspType
{
_sysPktBodyCommon;
Boolean newState
}SysPktDbgBreakToggleRspType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
<— newState A Boolean value. If this is set to TRUE, the new state has been set to enable breakpoints that were compiled into the code. If this is set to FALSE, the new state has been set to disable breakpoints that were compiled into the code.

Write Memory ^TOP^

Purpose

Writes memory values to the debugging target.

Comments

This command can write up to sysPktMaxMemChunk bytes of memory. The actual size of the request packet depends on the number of bytes that you want to write.

Commands

The Write Memory command request and response commands are defined as follows:

#define sysPktWriteMemCmd 0x02
#define sysPktWriteMemRsp 0x82

Request Packet

typedef struct SysPktWriteMemCmdType
{
_sysPktBodyCommon;
void* address;
Word numBytes;
//Byte data[?]
}SysPktWriteMemCmdType;

Fields

—> _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
--> address The address in target memory to which the values are written.
--> numBytes The number of bytes to write.
--> data The bytes to write into target memory. The size of this field is defined by the numBytes parameter.

Response Packet

typedef struct SysPktWriteMemRspType
{
_sysPktBodyCommon;
}SysPktWriteMemRspType;

Fields

<-- _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Write Registers ^TOP^

Purpose

Sets the value of each of the target processor registers.

Comments

The eight data registers are stored in the request packet body sequentially, from D0 to D7. The seven address registers are stored in the request packet body sequentially, from A0 to A6.

Commands

The Write Registers command request and response commands are defined as follows:

#define sysPktWriteRegsCmd 0x06
#define sysPktWriteRegsRsp 0x86

Request Packet

typedef struct SysPktWriteRegsCmdType
{
_sysPktBodyCommon;
M68KRegsType reg;
}SysPktWriteRegsCmdType;

Fields

-->_sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.
—> reg The new register values in sequential order: D0 to D7, followed by A0 to A6.

Response Packet

typedef struct SysPktWriteRegsRspType
{
_sysPktBodyCommon;
}SysPktWriteRegsRspType;

Fields

<— _sysPktBodyCommon
The common packet header, as described in _SysPktBodyCommon.

Summary of Debugger Protocol Packets ^TOP^

Table 9.2 summarizes the command packets that you can use with the debugger protocol.

Table 9.2 Debugger protocol command packets 

Command

Description

Continue

Tells the debugging target to continue execution.

Find

Searches for data in memory on the debugging target.

Get Breakpoints

Retrieves the current breakpoint settings from the debugging target.

Get Routine Name

Determines the name, starting address, and ending address of the function that contains the specified address.

Get Trap Breaks

Retrieves the settings for the trap breaks on the debugging target.

Get Trap Conditionals

Retrieves the trap conditionals values from the debugging target.

Message

Sends a message to display on the debugging target.

Read Memory

Reads memory values from the debugging target.

Read Registers

Retrieves the value of each of the target processor registers.

RPC

Sends a remote procedure call to the debugging target.

Set Breakpoints

Sets breakpoints on the debugging target.

Set Trap Breaks

Sets breakpoints on the debugging target.

Set Trap Conditionals

Sets the trap conditionals values for the debugging target.

State

Sent by the host program to query the current state of the debugging target, and sent by the target whenever it encounters an exception and enters the debugger.

Toggle Debugger Breaks

Enables or disables breakpoints that have been compiled into the code.

Write Memory

Writes memory values to the debugging target.

Write Registers

Sets the value of each of the target processor registers.