Tru64 UNIX
Ladebug Debugger Manual


Previous Contents Index

C.11.1.16 Get Registers Request and Response

The Get Registers request asks the server to send the client the contents of all the debuggee's registers and pseudo registers. It contains no fields other than the message header. Its command code 0xA6.

The fields of the Get Registers response are:

Possible failure reasons are:

The command code of a Get Registers response is 0x80A6.

C.11.1.17 Set Registers Request and Response

The Set Registers request asks the server to all the debuggee's registers and pseudo registers: including the debuggee's program counter. The request succeeds even if it is unable to change the values of some of the registers. Its fields are:

The command code of a Set Registers request is 0xA7.

A Set Registers response contains no fields other than the message header. Possible failure reasons are:

The command code of a Set Registers response is 0x80A7.

C.11.1.18 Read Request and Response

A Read request asks the server to read a portion of the debuggee's memory. Its fields are, in order:

Its command code is 0xA8.

The fields of a Read response are, in order:

Possible failure reasons are:

The command code of a Read response is 0x80A8.

C.11.1.19 Write Request and Response

A Write request asks the server to overwrite a portion of the debuggee's memory. Its fields are, in order:

Its command code is 0xA9.

A Write response contains no fields other than the message header. Possible failure reasons are:

The command code of a Write response is 0x80A9.

C.11.2 Order of Messages

A server can be modeled as a single control thread plus a debuggee thread for each debuggee. Each thread is uniquely identified by its UDP port number. Once a client has sent a message to a thread, it cannot send further messages to that thread (other than copies of the original message) until it receives a response.

A server (control or debuggee) thread can only send responses to the requests it receives. Servers threads are expected to respond promptly to all requests they receive. A server thread must never send more than one response to each message it receives. If it receives a duplicate request it must send a copy of its original response, with an updated retransmission count, without acting a second time on the request.

The only messages a client can send to a control thread are Connect to Process, Connect to Process Insist, and Load Process requests. A positive response to either of these requests identifies a new debuggee thread that the client should use for debugging the new debuggee.

Note

None of the previous information suggests that a server must be implemented as a multithreaded program. A server that can only debug one process at a time can send replies containing no resource failure codes to clients that attempt to connect to it when it is already debugging a process.

A debuggee thread can be in either running or stopped state. Initially a debuggee thread is in running state. In running state it will accept the following requests:

The client must not send any other requests to a debuggee thread when it is in running state. A debuggee thread will enter stopped state from running state whenever the debuggee stops. The client can discover the state of a debuggee thread by sending it a probe request. Any debuggee state other than running indicates that the debuggee thread is in stopped state. When it is in stopped state, the client can send the debuggee thread any request except Connect to Process, Connect to Process Insist, or Load Process.

A debuggee thread will return from stopped state to running state when it receives a Continue or Step request that it can act upon.

A debuggee thread will exit immediately after sending a positive Disconnect from Process or Kill Process response. It can also exit at any other time, either through some external cause, or as a result of some other client taking over the debuggee using a Connect to Process Insist request. Once a debuggee thread has exited the server will either ignore requests sent to it or send responses with not connected failure codes.

C.11.3 Recovering from Packet Loss

The standard packet header contains two fields that are used to recover from packet loss:

The sequence number is used to distinguish between different messages. The retransmission count is used to distinguish between copies of the same message. A client should give every message it sends to a particular server thread a different sequence number.

To avoid confusion between different clients started by the same user on the same host, it should also attempt to give load and connect requests sequence numbers that will not be used by other clients. One way to do this would be to base the sequence number upon the time at which the message is sent.

The first time it sends a message it will give it a retransmission count of 0. If it does not receive a response to a request within a reasonable time, it will increment the retransmission count and repeat the message. If after a number of attempts it has still not received a response with the same sequence number and retransmission count as the last message it sent it will assume that the server thread had exited or communications link has failed.

Note

The best values for "reasonable time" and "a number of attempts" are still being under investigation. At present, Ladebug starts off by waiting 1.6 seconds. Each time it receives a response within its time-out it halves its time-out down to a minimum of 1/10 of a second.

Each time it fails to receive a response it doubles its time-out up to a maximum of 12.8 seconds. It makes a maximum of 8 attempts at sending any message.

On receiving a duplicate packet, the server should copy the new retransmission count into its original response and send this updated response to the client.

The server cannot normally detect communication failure and will wait indefinitely for messages from a client.

C.12 Transport Layer

The Ladebug Remote Debugger Protocol uses UDP running over an IP network layer as its transport. The client can use any UDP socket as its source but will always send load and connect requests to UDP socket 410. If the request is successful, the response will have as its source socket the socket allocated to the new debuggee thread. The client will send all messages for this debuggee thread to this socket.

Note

This socket has been allocated to this protocol by the Internet Assigned Number Authority (IANA).

The server should always send responses to the source socket of the associated request. The source socket for any message sent by the server should be either 410 (for responses to rejected load and connect messages) or the socket allocated to associated debuggee thread (for all other messages).


Index Contents