home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 600s / rfc643.txt < prev    next >
Text File  |  1992-10-14  |  13KB  |  377 lines

  1.  
  2.  
  3.  
  4. Network Debugging Protocol                          Eric Mader
  5. RFC: 643                                             July 1974
  6. NIC #30873
  7.  
  8.  
  9.      This document describes a proposed protocol  to  be  used  in  an
  10. implementation   of   a   PDP-11   network  Bootstrap  service  and  a
  11. cross-network  debugger.   The  protocol  is  designed  for  debugging
  12. processes  running under an operating system which can perform some of
  13. the "lower level" debugging  tasks,  such  as  planting  and  removing
  14. breakpoints  and  single  stepping.  A subset of the protocol could be
  15. used if such a capability does not exist (a  stand-alone  program  for
  16. example).
  17.  
  18.      The protocol is a level 2 protocol, which  bypasses  the  ARPANET
  19. HOST-HOST  protocol.   (This  is  implemented  on  TENEX using special
  20. privileged system calls which allow messages to be  sent  directly  to
  21. and  received  directly  from the IMP).  Messages are sent between the
  22. PDP-11 and the remote debugger on  one  link  (currently  377  octal).
  23. Each  message from the remote debugger to the PDP-ll is a request that
  24. the PDP-11 perform some action, and each message from  the  PDP-11  to
  25. the remote debugger is either a reply to that request or an indication
  26. that  a  process  has  stopped  running  (i.e.   has  trapped,  hit  a
  27. breakpoint, etc).  The exact format of the messages is shown in Figure
  28. 1 below.
  29.  
  30.      Each  command  consists  of  an  8-bit  op-code,  and  an   8-bit
  31. process-id,  two  16-bit  arguments,  and  an optional string of 8-bit
  32. bytes.  The op-code field from the PDP-11 should be the same  as  that
  33. sent  by  the  remote  host  to  indicate successful completion of the
  34. request or be the same as that set by the remote host with the 200 bit
  35. set  to  indicate  failure to complete the request.  Op-codes from the
  36. PDP-11 which have the 100 bit set are asynchronous indication  that  a
  37. process  has stopped for a reason other than a request from the remote
  38. host.  (See description of asynchronous replies  below).   An  op-code
  39. from  the  PDP-11  with  both  the 100 and 200 bit set is meaningless.
  40. Thus, the 8-bit op-code field sent by the PDP-11 can be thought of  as
  41. a CAN'T Flag, an Asynchronous STOP Flag, and a 6-bit op-code.
  42.  
  43.      In the description that follows the commands will be given as
  44.  
  45.    NAME (Process-ID, Argument 1, Argument 2, BYTE STRING)
  46. with only as many of the fields present as are used.
  47.  
  48. Op-Code 0 - NOP_______ _ _ ___
  49.  
  50.      This command is intended to be used to determine if the PDP-11 is
  51. operational.   It  has no effect on any process running in the PDP-11.
  52. The response is NOP.
  53.  
  54. Op-Code 1 - DEBUG (Process)_______ _ _ _____ _________
  55.  
  56.      This command requests the ability to  debug  the  given  process.
  57. The PDP-11 should respond with
  58.  
  59.                                                     Page   2
  60.  
  61.  
  62.  
  63.                      DEBUGGING (process)
  64.  
  65. (op-code 1) if no other remote host is currently doing so, and
  66.  
  67.                     CAN'T DEBUG (process)
  68.  
  69. (op-code 201) if another remote host  has  been  given  permission  to
  70. debug the process, or the process doesn't exist.
  71.  
  72. Op-Code 2 - END DEBUG (Process)_______ _ _ ___ _____ _________
  73.  
  74.      This command relinquishes the ability to debug  a  process.   The
  75. PDP-11 should reply
  76.  
  77.                      END DEBUG (Process)
  78.  
  79. (op-code 2) unless the remote host isn't  debugging  the  process,  in
  80. which case it should respond 
  81.  
  82.                   CAN'T END DEBUG (Process)
  83.  
  84. (op-code 202).  If the process isn't running when  the  END  DEBUG  is
  85. done, then the effect should be the same as
  86.  
  87.                       RESUME (PROCESS)
  88.                     END DEBUG (PROCESS)
  89.  
  90. Op-Code 3 - STOP (Process)_______ _ _ ____ _________
  91.  
  92.      This command requests the PDP-11 to stop the given  process  from
  93. running.  The PDP-11 should respond
  94.  
  95.                       STOPPED (process)
  96.  
  97. (op-code 3) unless the process isn't  being  debugged  by  the  remote
  98. host.  In this case it should reply
  99.  
  100.                     CAN'T STOP (process)
  101.  
  102.   (op-code 203).
  103.  
  104. Op-Code 4 - DEPOSIT (Process, Address, Count, Byte String)_______ _ _ _______ _________ ________ ______ ____ _______
  105.  
  106.      This instructs the PDP-11 to deposit  the  Count  bytes  in  Byte
  107. String  into  the  given process's address space beginning at Address.
  108. The PDP-11 should reply
  109.  
  110.              DEPOSITED (Process, Address, Count)
  111.  
  112. if successful or
  113.  
  114.            CAN'T DEPOSIT (Process, Address, Count)
  115.  
  116.                                                     Page   3
  117.  
  118.  
  119.  
  120. if the deposit doesn't succeed, or the remote host isn't debugging the
  121. process.
  122.  
  123. Op-Code 5 - RESUME (Process)_______ _ _ ______ _________
  124.  
  125.      This instructs the PDP-11 to allow the given  process  to  resume
  126. running.  The PDP-11 should reply
  127.  
  128.                      RESUMED (Process)
  129.  
  130. before it starts the process (in case it traps right away), or
  131.  
  132.                    CAN'T RESUME (Process)
  133.  
  134. if the process wasn't stopped, or the remote host isn't debugging  the
  135. process.
  136.  
  137. Op-Code 6 - EXAMINE (Process, Address, Count)_______ _ _ _______ _________ ________ ______
  138.  
  139.      This instructs the PDP-11 to return Count bytes  from  the  given
  140. process address space starting at Address.  The PDP-11 should reply
  141.  
  142.        CONTENTS (Process, Address, Count, Byte String)
  143.  
  144. if it can supply the bytes, or
  145.  
  146.            CAN'T EXAMINE (Process, Address, Count)
  147.  
  148. if all the bytes don't exist in the address space, or the remote  host
  149. isn't debugging the process.
  150.  
  151. Op-Code 7 - DEPOSIT STATE VECTOR (Process, Index, Byte Count,_______ _ _ _______ _____ ______ _________ ______ ____ ______
  152.             Byte String)            ____ _______
  153.  
  154.      This instructs the PDP-11 to deposit the Byte Count bytes in Byte
  155. String  into the state vector for the given process starting with byte
  156. Index.  See Figure 2 for the format of the state vector.   The  PDP-11
  157. should reply
  158.  
  159.      DEPOSITED STATE VECTOR (Process, Index, Byte Count)
  160.  
  161. unless the bytes won't all fit in the state vector or the remote  host
  162. isn't debugging the process.  In this case the reply should be
  163.  
  164.   CAN'T DEPOSIT STATE VECTOR (Process, Index, Byte Count)
  165.  
  166. Op-Code 10 - BREAK (Process, Address, Proceed Count)_______ __ _ _____ _________ ________ _______ ______
  167.  
  168.      This instructs the PDP-11 to place a breakpoint at Address in the
  169. given  process's address space, with a proceed count of Proceed Count.
  170. The proceed count can be changed by issuing another BREAK with a
  171. different count.  The PDP-11 should reply
  172.  
  173.                                                     Page   4
  174.  
  175.  
  176.  
  177.            BROKE (Process, Address, Proceed Count)
  178.  
  179. if it was able to plant the breakpoint and
  180.  
  181.         CAN'T BREAK (Proceed, Address, Proceed Count)
  182.  
  183. if it was unable to plant the breakpoint because the breakpoint tables
  184. for  the  process are full, or because the remote host isn't debugging
  185. the process.  Note that the  PDP-11  must  keep  track  of  where  the
  186. breakpoints are, the old contents of these locations etc.
  187.  
  188. Op-Code 11 - UNBREAK (Process, Address)_______ __ _ _______ _________ ________
  189.  
  190.      This instructs the PDP-11 to remove the breakpoint  from  Address
  191. in the process's address space and release all storage associated with
  192. it.  The PDP-11 should reply
  193.  
  194.                  UNBROKE (Process, Address)
  195.  
  196. when the breakpoint is removed, or
  197.  
  198.               CAN'T UNBREAK (Process, Address)
  199.  
  200. if the process doens't have a breakpoint at Address or the remote host
  201. isn't debugging the process.
  202.  
  203. Op-Code 12 - SINGLE STEP (Process)_______ __ _ ______ ____ _________
  204.  
  205.      This instructs the PDP-11 to let the given  process  execute  one
  206. instruction, using the Trace Trap feature.  The PDP-11 should reply
  207.  
  208.                   SINGLE STEPPING (Process)
  209.  
  210. before the process is started, or
  211.  
  212.                  CAN'T SINGLE STEP (Process)
  213.  
  214. if the process is already running or the remote host  isn't  debugging
  215. the process.
  216.  
  217. Op-Code 13 - PROCEED BPT (Process)_______ __ _ _______ ___ _________
  218.  
  219.      This instructs the PDP-11 to allow the process to proceed from  a
  220. break point trap (BPT, see below).  The PDP-11 should reply
  221.  
  222.                   PROCEEDING BPT (Process)
  223.  
  224. before allowing the process to proceed, or
  225.  
  226.                  CAN'T PROCEED BPT (Process)
  227.  
  228. if the process isn't stopped at a breakpoint or the remote host  isn't
  229. debugging the process.
  230.  
  231.                                                     Page   5
  232.  
  233.  
  234.  
  235. Op-Code 14 - CREATE PROCESS_______ __ _ ______ _______
  236.  
  237.      This instructs the PDP-11 to  create  a  process  (with  its  own
  238. virtual address space if the system will support such a feature).  The
  239. PDP-11 should reply
  240.  
  241.                   CREATED PROCESS (Process)
  242.  
  243. if it could create a process, with the process-id in process.  If  the
  244. process  creation  failed  or  the system cannot create processes, the
  245. PDP-11 should reply
  246.  
  247.                     CAN'T CREATE PROCESS.
  248.  
  249. Once a remote host has created a process it is debugging it, that is a
  250.  
  251.                        DEBUG (process)
  252.  
  253. need not be done.
  254.  
  255. Op-Code 15 - DESTROY PROCESS (Process)_______ __ _ _______ _______ _________
  256.  
  257.      This instructs the PDP-11 to destroy the  given  process.   After
  258. the  process  is destroyed the remote host cannot, of course, debug it
  259. so there is no need to do an
  260.  
  261.                     END DEBUG (Process).
  262.  
  263. The PDP-11 should reply
  264.  
  265.                  DESTROYED PROCESS (Process)
  266.  
  267. if the process has been destroyed.  If the system  doesn't  support  a
  268. multi-process structure or the remote host isn't debugging the process
  269. the PDP-11 should reply
  270.  
  271.               CAN'T DESTROY PROCESS (Process).
  272.  
  273.  
  274.  
  275.  
  276.                  Asynchronous Stop Replies                 ____________ ____ _______
  277.  
  278.      These replies (op-code between 100 and 177 octal) are sent by the
  279. PDP-11  wherever a process being debugged stops running for any reason
  280. other than in response to the
  281.  
  282.                        STOP (Process)
  283.  
  284. command.  Each of these replies includes the entire state  vector  for
  285. the process.
  286.  
  287.                                                     Page   6
  288.  
  289.  
  290.  
  291. Op-Code 100 - TRAP (Process, Reason, 0, STATE VECTOR)_______ ___ _ ____ _________ _______ __ _____ _______
  292.  
  293.      This informs the remote host that a  process  has  "trapped",  or
  294. terminated abnormally.  The reason is a system error code, or could be
  295. a trap vector address in the stand-alone case.
  296.  
  297. Op-Code 101 - HALT (Process, 0,0, STATE VECTOR)_______ ___ _ ____ _________ ____ _____ _______
  298.  
  299.      This  informs  the  remote  host  that  the  given  process   has
  300. terminated normally.  
  301.  
  302. Op-Code 102 - BPT (Process, 0, 0, STATE VECTOR)_______ ___ _ ___ _________ __ __ _____ _______
  303.  
  304.      This informs the remote host that the given  process  has  hit  a
  305. breakpoint trap.
  306.  
  307. Op-Code 103 - TTRAP (Process, 0, 0, STATE VECTOR)_______ ___ _ _____ _________ __ __ _____ _______
  308.  
  309.      This informs the remote host that the given  process  has  hit  a
  310. trace trap, i.e.  has just executed one instruction in response to the
  311.  
  312.                     SINGLE STEP (Process)
  313.  
  314. command.
  315.  
  316.                                                     Page   7
  317.  
  318.  
  319.                           Figure 1
  320.  
  321.              FORMAT OF NETWORK DEBUGGER MESSAGES
  322.  
  323.  
  324.                     ----------------
  325.                    | TYPE | HOST    |
  326.                     ----------------
  327.                    | LINK | STYPE   |
  328.                     ----------------
  329.                    | CMD  |  PID    |
  330.                     ----------------
  331.                    |    ARG1        |
  332.                     ----------------
  333.                    |    ARG2        |
  334.                     ----------------
  335.  
  336.      TYPE -- The HOST-IMP/IMP-HOST message type, should
  337.              always be zero.
  338.  
  339.      HOST -- The source host ID.
  340.  
  341.      LINK -- The debugger link.
  342.  
  343.     STYPE -- The message subtype, always zero.
  344.  
  345.       CMD -- The debugger command op-code, excess 100 for
  346.              asynchronous reply's, excess 200 for "can't"
  347.              reply's.
  348.  
  349.       PID -- Process ID of process being debugged.
  350.  
  351.      ARG1 -- The first argument of the command.
  352.  
  353.      ARG2 -- The second argument of the command.
  354.  
  355.  
  356.                                                  Page 8
  357.  
  358.  
  359.  
  360.  
  361.                           Figure 2
  362.  
  363.                   FORMAT OF STATE VECTORS
  364.  
  365.                       ------------
  366.                      |    R0      |
  367.                       ------------
  368.                      |    R1      |
  369.                       ------------
  370.                      |    R2      |
  371.                       ------------
  372.                      |   ...      |
  373.                       ------------
  374.                      |    PC      |
  375.                       ------------
  376.                      |    PS      |
  377.                       ------------