home *** CD-ROM | disk | FTP | other *** search
/ Amiga Times / AmigaTimes.iso / programme / GoldED / developer / debugger / README
Encoding:
Text File  |  1998-10-06  |  12.3 KB  |  277 lines

  1. COPYRIGHT
  2.  
  3.   ©1996 Dietmar Eilert, All Rights Reserved.
  4.  
  5.   Dietmar Eilert
  6.   Mies-v-d-Rohe-Str.31, 52074 Aachen, Germany
  7.   E-Mail: DIETMAR@TOMATE.TNG.OCHE.DE
  8.   Tel: +49-(0)241-81665
  9.        +49-(0)2525-7776
  10.   Fax: +49-(0)241-81665
  11.  
  12. CONTENTS
  13.  
  14.   Information on how GoldED support can be added  to  debuggers  (for  debugger
  15.   programmers).
  16.  
  17.  
  18. BASICS
  19.  
  20.   GoldED can be used to set the state of breakpoints and thus act  as  debugger
  21.   frontend  (as  addition to the standard debugger window with its step gadgets
  22.   etc.). The advantage of using GoldED as debugger frontend is that users don't
  23.   have  to  leave the editor environment and that sources can be modified while
  24.   debugging. Adding GoldED support to existing debuggers  is  simple:  GoldED's
  25.   command set has been designed to make this job as simple as possible.
  26.  
  27.   How it works: GoldED displays breakpoints next to text  lines.  The  list  of
  28.   available  breakpoints  is  provided  by the debugger. GoldED will notify the
  29.   debugger if the user edits the state of a breakpoint.  Communication  between
  30.   the  compiler  and  GoldED  is based on standard ARexx messages: GoldED sends
  31.   messages to the  debugger's  ARexx  port,  the  debugger  sends  messages  to
  32.   GoldED's  ARexx  port.  These messages are described below. A simple debugger
  33.   example is available in the "debugger" drawer. Similar code would have to  be
  34.   added  to  your  debugger  in  order  to  allow usage of GoldED as additional
  35.   frontend.
  36.  
  37.  
  38. SPECIAL FEATURE
  39.  
  40.   Buffers can be modified during  debugger  sessions.  Unmodified  buffers  are
  41.   simulated  towards  the debugger so that the debugger can assume that buffers
  42.   have not been modified and that line numbers calculated at compile  time  are
  43.   still valid.
  44.  
  45.  
  46. LINE NUMBERS
  47.  
  48.   GoldED internally uses a line/column numbering scheme starting at 0. However,
  49.   towards  the  user  a  numbering  scheme starting at 1 is used. The numbering
  50.   scheme used towards the debugger may vary  depending  on  the  situation  but
  51.   usually  the  1ff  numbering  scheme  is  used. Details are listed below. Two
  52.   different line number types are available during a debugger session: physical
  53.   line  numbers  (reflecting buffer modifications added after compile time) and
  54.   locked line numbers reflecting the original line number seen by the  compiler
  55.   at  compile  time.  The  debugger will want to use the locked line numbers so
  56.   that it can ignore buffer modifications: It will specify the LOCKED option in
  57.   commands  sent  to  GoldED.  A list of available debugger-related commands is
  58.   shown below (commands not related  to  the  debugger  are  described  in  the
  59.   standard GoldED documentation):
  60.  
  61.   1. DEBUG   START/S,STOP/S,PORT/K
  62.   2. VIEW    DEBUGGER/K
  63.   3. BREAKPT LINE/N,STATE/N,TOGGLE/S,NEXT/S,PREV/S,FILE/K,FORMAT/K,DATA/N,ALL/N,CLEANUP/S
  64.   4. PC      FILE/K,LINE/N,LOCKED/S,UNFOLD/S,ONEWINDOW/S,FREEZE/S
  65.   5. GOTO    LINE/N,LOCKED/S
  66.  
  67.  
  68. DEBUG START/S,PORT/K
  69.  
  70.   template: DEBUG START/S,PORT/K
  71.   example:  DEBUG START PORT="DEBUGGER.1"
  72.  
  73.   This command is used  by  the  debugger.  It  activates  GoldED's  debugger
  74.   support. PORT/K is the name of the debugger's ARexx port. GoldED will start
  75.   sending commands to this port immediately in  order  to  obtain  breakpoint
  76.   information  for all open buffers. Line numbers are frozen by this command:
  77.   further buffer  modifications  will  not  affect  line  numbers  until  the
  78.   debugger  session is terminated. The editor can not be closed completely by
  79.   the user after this command has been sent to GoldED's ARexx port (until the
  80.   end  of  the  debugger  session).  The  DEBUG  START  command can fail if a
  81.   debugger session has already been started by another  program  or  if  your
  82.   debugger  didn't terminate the last session: Check the return code (0=OK, 5
  83.   or 20:  error).  GoldED  will  start  sending  the  following  asynchronous
  84.   messages   to  the  debugger  port  immediately  (simply  ReplyMsg()  these
  85.   messages):
  86.  
  87.   template:  QUERY FILE/K/A,PORT/K/A,DATA/N,ELEMENTS/N
  88.              QUERY FILE="<filename>" PORT="<port>
  89.   examples:  QUERY FILE="dh0:main.c" PORT="GOLDED.1"
  90.              QUERY FILE="dh0:main.c" PORT="GOLDED.1" DATA=4129038 ELEMENTS=5
  91.  
  92.   FILE/K is a unique/resolved file name (to simplify  file  identification  for
  93.   the  debugger;  the  name  is  obtained by GoldED using NameFromLock). GoldED
  94.   expects that the debugger sends breakpoint information for this file as  soon
  95.   as possible if breakpoints are available.
  96.  
  97.   DATA/N and ELEMENT/N are provided if random breakpoints have been created  by
  98.   the  user  already. The debugger may choose to ignore this information or use
  99.   it to preset its internal  breakpoint  list  passed  to  GoldED  later.  Data
  100.   format: DATA/N points to an UWORD array consisting of ELEMENT/N elements, one
  101.   element for each line of the text. Possible  values:  0  (no  breakpoint),  1
  102.   (inactive  breakpoint)  or  2  (active breakpoint). Please note that the DATA
  103.   pointer stays valid until the debugger has replied the QUERY message; it will
  104.   not stay valid after the message has been replied.
  105.  
  106.   PORT/K is GoldED's port. Breakpoint information should be sent to  this  port
  107.   as soon as possible using the following command:
  108.  
  109.   template: BREAKPT FILE/K,FORMAT/K,DATA/N,FORMAT/K,ELEMENTS/N
  110.   example:  BREAKPT FILE="dh0:main.c" DATA=1029282 FORMAT="STORMC" ELEMENTS=142
  111.  
  112.   FILE/K: file name (should match exactly the file name sent to the debugger in
  113.   a  QUERY  message).  DATA/N: pointer to debugger-specific breakpoint data for
  114.   the file FILE/K (needs to stay valid until the BREAKPT message is replied  by
  115.   GoldED).  ELEMENTS/N:  number  of  valid  breakpoints  in  the  data section.
  116.   FORMAT/K: describes the data format. Currently only STORMC can be used unless
  117.   you  have  contacted  me  and  we have agreed on a new additional format that
  118.   suits your needs better (STORMC should not be used in release versions as  it
  119.   will  be  changed  to  meet  the  specific  needs  of  the  StormC debugger).
  120.   Description of this format: DATA/N is a pointer to an UWORDS array, one UWORD
  121.   for  each  line. Possible values: 0 (no breakpoint), 1 (breakpoint, not set),
  122.   2 (breakpoint, set).
  123.  
  124.  
  125. DEBUG STOP/S
  126.  
  127.   template: DEBUG STOP/S
  128.   example:  DEBUG STOP
  129.  
  130.   This command is used by the  debugger.  It  terminates  a  debugger  session.
  131.   Breakpoints are hidden if this command is received (but not deleted). Buffers
  132.   loaded during the debugger session by the debugger are  closed  automatically
  133.   if  unmodified.  DEBUG STOP may not be omitted (performance of GoldED suffers
  134.   during debugger sessions). You may wish to additionally send BREAKPT  CLEANUP
  135.   to GoldED in order to have all breakpoints deleted.
  136.  
  137.  
  138. SET DEBUGGER VALUE/K
  139.  
  140.   template: SET DEBUGGER VALUE/K
  141.   examples: SET DEBUGGER TRUE
  142.             SET DEBUGGER FALSE
  143.             SET DEBUGGER TOGGLE
  144.  
  145.   This command is available for users only (and not used by the  debugger).  It
  146.   shows/hides  the  breakpoints  of the current buffer. Usually breakpoints are
  147.   displayed automatically if the debugger sends  breakpoint  information.  This
  148.   commands  allows  the  user  to  override  the editor's decision to show/hide
  149.   breakpoints.
  150.  
  151.  
  152. BREAKPT QUERY/K
  153.  
  154.   template: BREAKPT QUERY/K
  155.   example:  BREAKPT QUERY="dh0:main.c"
  156.  
  157.   This command is used by the debugger if it wants to receive  a  description
  158.   of  breakpoints for the specified file. Usually a description of predefined
  159.   breakpoints is sent to the debugger embedded into QUERY commands if a  text
  160.   is  loaded  into  the  editor.  This  command  may  be  useful to receive a
  161.   description of predefined breakpoints for files not  yet  loaded  into  the
  162.   editor.  The  editor  will  read  breakpoint information from "*.bpt" files
  163.   usually created during a former debugger session. GoldED will start sending
  164.   the following asynchronous message to the debugger port immediately (simply
  165.   ReplyMsg() this message):
  166.  
  167.   BREAKPT FILE="dh0:main.c" DATA=4129038 ELEMENTS=5
  168.  
  169.   FILE/K is a unique/resolved file name (to simplify file identification  for
  170.   the  debugger). DATA/N and ELEMENTS/S are a description of the breakpoints.
  171.   The data format is similiar to the  breakpoint  description  embedded  into
  172.   QUERY  commands  (see  above). The data can be referenced until the message
  173.   has been replied.
  174.  
  175.  
  176. BREAKPT LINE/N,LOCKED/S,STATE/K,TOGGLE/S,NONOTIFY/S,ALL/N,CLEANUP/S
  177.  
  178.   template: BREAKPT LINE/N,LOCKED/S,STATE/K,TOGGLE/S,NONOTIFY/S
  179.   examples: BREAKPT LINE=1 LOCKED STATE=1
  180.             BREAKPT LINE=1 LOCKED TOGGLE
  181.  
  182.   This command can be used by the user or by the debugger. It  sets/unsets  the
  183.   breakpoint  in  line  <LINE>  (1,  ...)  depending on STATE/K (0/1). LOCKED/S
  184.   indicates that LINE/N refers to a locked line number (valid at compile time).
  185.   The  editor  will  notify the debugger immediately that a breakpoint has been
  186.   set or unset (unless you specify NONOTIFY). The following message is sent  to
  187.   the debugger's port:
  188.  
  189.   template: BREAKPT FILE/K,LINE/N,STATE/K
  190.   example:  BREAKPT FILE="dh0:main.c" LINE=1 STATE=1
  191.  
  192.   LINE/N (1, ...) in this message is a locked line  number  (valid  at  compile
  193.   time). STATE/K is the new breakpoint state. FILE/K is the resolved file name.
  194.  
  195. BREAKPT ALL/N
  196.  
  197.   template: BREAKPT ALL/N
  198.   examples: BREAKPT ALL=0
  199.             BREAKPT ALL=1
  200.  
  201.   This command is can be used  by  the  user  or  by  the  debugger.  Sets  all
  202.   breakpoints to a defined state (0 = unset, 1 = set)
  203.  
  204.  
  205. BREAKPT NEXT/S,PREV/S
  206.  
  207.   template:  BREAKPT NEXT/S,PREV/S
  208.   example:   BREAKPT NEXT
  209.              BREAKPT PREV
  210.  
  211.   This command is can be used by the user or by  the  debugger.  It  moves  the
  212.   cursor to the next/last breakpoint.
  213.  
  214.  
  215. BREAKPT CLEANUP/S
  216.  
  217.   template: BREAKPT CLEANUP/S
  218.   example:  BREAKPT CLEANUP
  219.  
  220.   This command is can be used by the user or by the debugger.  It  deletes  all
  221.   breakpoints  in  all  buffers.  Usually sent by the debugger after a debugger
  222.   session has been terminated (DEBUG STOP).
  223.  
  224.  
  225. BREAKPT SAVE/S
  226.  
  227.   template: BREAKPT SAVE/S
  228.   example:  BREAKPT SAVE
  229.  
  230.   This command can be used by the user or by the debugger. Breakpoints of the
  231.   current text are saved to the file "<textname>.bpt" (e.g. "main.bpt"). They
  232.   are restored if you reload the text and they are  passed  to  the  debugger
  233.   during  a  debugger  session  (see description of QUERY command sent to the
  234.   debugger). It is recommended to combine this command  with  SAVE  SMART  to
  235.   ensure that the text is saved, too (if modified).
  236.  
  237.  
  238. PC FILE/K,LINE/N,COLUMN/N,LOCKED/S,UNFOLD/S,ONEWINDOW/S,FREEZE/S,FILETYPE/K,HIGHLIGHT/S,PRESENT/S
  239.  
  240.   Example: PC PRESENT FILE="dh0:main.c" LOCKED LINE=100 COLUMN=1 ONEWINDOW FREEZE
  241.  
  242.   This command is used by the debugger. It moves the cursor to column  COLUMN/N
  243.   (1,  ...) and line LINE/N (1, ...) in file FILE/K. The line is highlighted if
  244.   HIGHLIGHT is specified (useful  to  show  the  current  line  of  execution).
  245.   LOCKED/S  specifies  that  LINE/N  refers to a locked line number (the LOCKED
  246.   option can only be used during a debugger session). The file is loaded if not
  247.   yet  present. You may override automatic file type detection using FILETYPE/K
  248.   for files loaded by this command.
  249.  
  250.   The buffer's window is activated and brought to  the  front  if  you  specify
  251.   PRESENT  (the  buffer's  screen  is  always  brought to the front). ONEWINDOW
  252.   instructs the editor to close all but one windows that have  been  opened  by
  253.   the  debugger  so  far.  This  option  helps you to reduce the number of open
  254.   windows  if  debugging  large  projects.  The  buffers  are  either  unloaded
  255.   completely  or  - if the FREEZE/S option is used - simply hidden (kept in the
  256.   background without  a  window):  usage  of  FREEZE  avoids  unnecessary  disk
  257.   accesses.
  258.  
  259.   The FORMAT/K and DATA/K options allow the debugger  to  pass  new  breakpoint
  260.   information  to  the  editor (overriding the information sent to GoldED while
  261.   processing QUERY commands; see above). These options may  be  useful  if  the
  262.   debugger  maintains  multiple breakpoint lists for a file and wants to switch
  263.   from one set of  breakpoints  to  another  set  of  breakpoints.  DATA/N  and
  264.   FORMAT/K  are  ignored  if  a  pointer to the same block of data is specified
  265.   multiple times.
  266.  
  267.  
  268. GOTO LINE/N LOCKED/S
  269.  
  270.   template: GOTO LINE/N LOCKED/S
  271.   example:  GOTO LINE=1 LOCKED
  272.  
  273.   This command can be used by the user or by the debugger. It moves the  cursor
  274.   to  line  LINE/N (1, ...) in the current file. LOCKED/S indicates that LINE/N
  275.   refers to a locked line number (the LOCKED option can only be used  during  a
  276.   debugger session).
  277.