home *** CD-ROM | disk | FTP | other *** search
/ C/C++ User's Journal & Wi…eveloper's Journal Tools / C-C__Users_Journal_and_Windows_Developers_Journal_Tools_1997.iso / smxdemo / root.exe / PROBE.DOC next >
Encoding:
Text File  |  1991-10-19  |  29.8 KB  |  706 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                                        smxProbe
  10.                            Instructions for Standalone Use
  11.  
  12.                                    October 12, 1991
  13.  
  14.  
  15.           When  used  in standalone  mode  (i.e. without  a  code debugger)
  16.           smxProbe operates as  a task  called "spcon" (smxProbe  control).
  17.           In this mode, smxProbe is capable of running on a target.
  18.  
  19.  
  20.                                   Table of Contents
  21.  
  22.                                                                    page
  23.                1.  COMMANDS . . . . . . . . . . . . . . . . . . . .  2
  24.                1.1  Summary . . . . . . . . . . . . . . . . . . . .  2
  25.                1.2  Entering Commands . . . . . . . . . . . . . . .  2
  26.  
  27.                2.  CODE PREPARATION . . . . . . . . . . . . . . . .  3
  28.                2.1  Linking in smxProbe . . . . . . . . . . . . . .  3
  29.                2.2  Trace Buffer Sizes  . . . . . . . . . . . . . .  3
  30.                2.3  Building the Handle Table . . . . . . . . . . .  3
  31.                2.4  Initialization and Exiting  . . . . . . . . . .  4
  32.                2.5  Command Table . . . . . . . . . . . . . . . . .  4
  33.  
  34.                3.  THEORY OF OPERATION AND USE  . . . . . . . . . .  4
  35.                3.1  Keyboard Entry  . . . . . . . . . . . . . . . .  5
  36.                3.2  Screen Swap . . . . . . . . . . . . . . . . . .  5
  37.                3.3  Freeze Level  . . . . . . . . . . . . . . . . .  6
  38.                3.4  Trace Buffers . . . . . . . . . . . . . . . . .  6
  39.                3.5  Call Triggering . . . . . . . . . . . . . . . .  7
  40.                3.6  Executing smx Calls Directly  . . . . . . . . .  8
  41.                3.7  Error Trigger . . . . . . . . . . . . . . . . .  8
  42.                3.8  Show Control Blocks . . . . . . . . . . . . . .  9
  43.                3.9  Show Queues . . . . . . . . . . . . . . . . . .  9
  44.                3.10  Starting in Freeze Mode  . . . . . . . . . . . 10
  45.                3.11  Target Operation . . . . . . . . . . . . . . . 10
  46.  
  47.                4.  TIPS . . . . . . . . . . . . . . . . . . . . . . 11
  48.  
  49.  
  50.           Nomenclature
  51.                [file name]    the file  in which  a function  or object  is
  52.                               located
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.                                           1
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           1.  COMMANDS
  74.  
  75.           1.1  Summary
  76.  
  77.                name           abbr ref  description
  78.                clrbk          cbk  5*   clear breakpoint
  79.                freeze_at      f    3.3  freeze operation at level specified
  80.                ^f                       freeze on/off toggle
  81.                setbk          bk   5*   set task breakpoint
  82.                show           s    3*   show control block
  83.                showb          sb   3.4  show trace buffer
  84.                showq          sq   4*   show queue
  85.                showrq              4*   show ready queue
  86.                showv               3*   show control block for value
  87.                showqv              4*   show queue for value
  88.                ^s                       swap  screens  and  keyboard  pipes
  89.                                         (hot key)
  90.                ^r                       repeat   last  command   (excluding
  91.                                         control keys)
  92.                ^t                       trace on/off toggle
  93.                trigcall       tr   3.5  trigger on call
  94.                trigerr        tre  3.7  trigger on error
  95.                Esc                      exit trace display or spcon
  96.  
  97.           In the table above,  the column ref refers you to  the section of
  98.           these  instructions  indicated,  for  further  details.    The  *
  99.           indicates  sections in the other instruction booklet you have for
  100.           smxProbe -- the  one that gives  specific instructions for  using
  101.           smxProbe with your code-level debugger (e.g. CodeView).
  102.  
  103.  
  104.           1.2  Entering Commands
  105.  
  106.           All commands except control keys and Esc  are entered in C format
  107.           with appropriate parameters, e.g.:
  108.  
  109.                     show(timeout)
  110.  
  111.           Abbreviations may be used in place of full command names, e.g.:
  112.  
  113.                     s(timeout)
  114.  
  115.           Do not add spaces.  Press Enter to activate the command.
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                           2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.           2.  CODE PREPARATION
  138.  
  139.           2.1  Linking in smxProbe
  140.  
  141.           When you desire to use smxProbe, link in the appropriate smxProbe
  142.           library ahead  of the smx library on the  link command line.  For
  143.           Microsoft C, the smxProbe library must be put in the object files
  144.           field (i.e. it is a "load library").  Two smxProbe  libraries are
  145.           provided  for  each  memory  model.    The  debug  library  (e.g.
  146.           spsv.lib)  is  appropriate for  use with  a  code debugger.   The
  147.           regular library (e.g. sps.lib) is appropriate for other versions.
  148.           There is no test mode library.  See ddemo.mak for examples.   All
  149.           modules in the smxProbe library link in.   Code size is about 19K
  150.           bytes.
  151.  
  152.  
  153.           2.2  Trace Buffer Sizes
  154.  
  155.           Trace buffers are  automatically allocated from  the far heap  by
  156.           trace_init() [trace.c] which is called from go_smx() [xgo_smx.c].
  157.           Hence each buffer  can be up to  64K bytes in size  if sufficient
  158.           memory  is available.   Buffer sizes  are controlled  by EB_SIZE,
  159.           TTB_SIZE, and CTB_SIZE in conf.h.  Maximum sizes are as follows:
  160.  
  161.                                                record size    max size
  162.                buffer          size constant     (bytes)      (records)
  163.                call trace        CTB_SIZE           16          4096
  164.                error             EB_SIZE            10          6553
  165.                task trace        TTB_SIZE            8          8192
  166.  
  167.           Convenient sizes  are 200,  50,  and 100,  respectively.   Larger
  168.           sizes  will,  of  course, permit  longer  trace  histories.   The
  169.           maximums above are based upon 64K bytes per buffer.
  170.  
  171.  
  172.           2.3  Building the Handle Table
  173.  
  174.           The handle table (ht) supplies symbolic names for smx objects and
  175.           for  a few  special symbols.   It  is built  by using  BUILD_HT()
  176.           macros after smx objects are created.  For example,
  177.  
  178.                     BUILD_HT(idle, "idle");
  179.  
  180.           adds an entry to ht for the idle task.  See demo_init() [ddemo.c]
  181.           for  more  examples.   ht  has an  entry consisting  of  a handle
  182.           pointer and a handle name per pointer.  Whenever  a symbolic name
  183.           is needed, ht is searched for the handle until the first match is
  184.           found.  If  no match is found, the handle is used (i.e. a 4-digit
  185.           hex value which is  the offset of its  control block in  DGROUP).
  186.           Hence, it  is not  mandatory to  use BUILD_HT  for every  handle.
  187.           (It's  up to you  whether you want the  convenience of a symbolic
  188.           name or not.)  BUILD_HT adds no code if non-test mode.
  189.           The  actual  build function  is  build_ht().   It  is  invoked by
  190.           BUILD_HT(), if in  test mode.   BUILD_HT() for  an object  should
  191.           appear soon after  creating the object  and it should be  invoked
  192.  
  193.                                           3
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.           only once  per object.   This  excludes using  BUILD_HT for  auto
  202.           handles -- i.e. only static handles  can be put into ht.   Handle
  203.           table initialization and builds for  standard objects (e.g. idle)
  204.           are in sp_init() in sp.c.   sp_init() is called at  the beginning
  205.           of ainit() in ddcore.c,  if test mode.  show() and showq() cannot
  206.           be used until after sp_init() has executed.
  207.  
  208.           Space for  ht is  allocated from  the far  heap by  trace_init().
  209.           Size is controlled by  HT_SIZE in conf.h.  HT_SIZE  is calculated
  210.           from the number  of control  blocks of  each type.   This can  be
  211.           altered, if necessary.  The ht  record size is 4 bytes for  small
  212.           data models  and 6 bytes for large data  models.  This allows for
  213.           far  string  pointers.   However,  most  compilers  put character
  214.           strings in near memory unless you use an appropriate switch (/Gt=
  215.           for Microsoft C, -Ff= for Turbo C).
  216.  
  217.  
  218.           2.4  Initialization and Exiting
  219.  
  220.           sp_init() should be  called during initialization.   (See ainit()
  221.           in  _core.c.)    sp_exit()  should  be  called when  exiting  the
  222.           application.  (See exitx_main() in _core.c.)
  223.  
  224.  
  225.           2.5  Command Table
  226.  
  227.           Most smx calls are  commented out of the  command table in  sp.c.
  228.           This is so that unused calls will  not be linked in.  These calls
  229.           will not display  symbolically in  ctb nor can  they be  directly
  230.           executed.  To  change this, merely  remove "//" in front  of each
  231.           call and remake the sp library.
  232.  
  233.  
  234.  
  235.           3.  THEORY OF OPERATION AND USE
  236.  
  237.           The  following  discussion  is based  upon  testing  DOSdemo with
  238.           smxProbe.   To get up  to speed as  fast as possible,  we suggest
  239.           that  you  try the  examples as  you  read the  discussions which
  240.           follow.
  241.  
  242.           Examples are inset as follows:
  243.  
  244.                Make one of the non-debug versions of DOSdemo,  and run
  245.                it.  e.g.:
  246.                               mak l t
  247.                               run l t
  248.                Or run the ddemolt. exe  file included on the  smxProbe
  249.                disk.
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.                                           4
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.           3.1  Keyboard Entry
  266.  
  267.           There are two tasks which accept keyboard input:
  268.  
  269.                opcon     operation control [ddemo.c]
  270.                spcon     smxProbe control [sp.c]
  271.  
  272.           Each  waits  at  the   end  of  a  pipe  (op-pipe   and  sp-pipe,
  273.           respectively) for  characters  from the  keyboard  or  elsewhere.
  274.           opcon  is  part  of  DOSdemo  and should  also  be  part  of your
  275.           application.
  276.  
  277.           A  new  keyboard  handler,  keyin()  [xkbd.c] has  been  created.
  278.           keyin() replaces the BIOS keyboard handler.  kbd_init() [xkbd.c],
  279.           which  is  called  from ainit()  [ddcore.c],  hooks  the keyboard
  280.           interrupt vector to keyin().  keyin() gets the scan code from the
  281.           keyboard  and converts it to an  ASCII character using key_table[
  282.           ].   (Note:   this table is  not complete --you can  add your own
  283.           unique codes for  missing key combinations.)   keyin() then  puts
  284.           the  character  into either  op_pipe  or sp_pipe,  depending upon
  285.           which is selected.  op_pipe  is selected initially.   Thereafter,
  286.           ^s toggles between the two pipes.
  287.  
  288.  
  289.           3.2  Screen Swap
  290.  
  291.           ^s is  also put into  the new  active pipe.   It causes  opcon or
  292.           spcon (whichever receives it)  to swap screens.  The  screens are
  293.           called  "op  screen"  and  "sp  screen",  respectively.    Screen
  294.           swapping is implemented by redirecting output for one screen to a
  295.           buffer while the other screen is being  output to video RAM.  The
  296.           2000-word buffer  is allocated  from the  far  heap by  sp_init()
  297.           [sp.c].    There are  actually two  sets  of direct  screen write
  298.           functions -- those in  xcrt.c for use by operational  (i.e. your)
  299.           software, and  those in  spcrt.c which  are reserved  for use  by
  300.           smxProbe.   As long as you use the  xcrt.c functions none of your
  301.           screen output will be lost while viewing sp screen.
  302.  
  303.                With  ddemo running, hit  ^s several  times.   You will
  304.                notice  that  the  counters  on   the  op  screen  have
  305.                continued to increment while looking  at the sp screen.
  306.                Note also that Esc  switches from sp to op,  but Esc in
  307.                op exits.
  308.  
  309.           C library functions such as printf() will overwrite the sp screen
  310.           and  their output  will  be lost  when  swapping back  to the  op
  311.           screen.  A  way around this problem is to instal a second monitor
  312.           and monitor adapter board in your computer (you can have both VGA
  313.           & monochrome in the  same computer).  Then, in  sp_init() [sp.c],
  314.           assign  sp_screen  to  one  and  in  crt_init()  [xcrt.c]  assign
  315.           op_screen to the other.  See crt_init() for how to do this.  Note
  316.           also you should remove  bios_cursor_off() from ainit() [ddcore.c]
  317.           and bios_cursor_on() from exitx_main() [ddcore.c].
  318.  
  319.  
  320.  
  321.                                           5
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.           3.3  Freeze Level
  330.  
  331.                Note that  the sp  screen heading  shows "freeze  off".
  332.                Enter f(2) (or freeze_at(2), if you prefer).  Note that
  333.                the heading  now shows  "freeze @2".    This means  all
  334.                tasks at or below priority level  2 are frozen.  Switch
  335.                to the op screen (^s or Esc).   Note that the idle task
  336.                is not running (it has priority 0), but  that suspender
  337.                and  idle are running  (they have priority  3).  Switch
  338.                back to  sp (^s  or Esc).   Note:   Esc  fails to  exit
  339.                because opcon has 0 priority and thus is frozen.  Enter
  340.                ^f.   Note that  the heading  shows "freeze  off".   ^f
  341.                again  will toggle  back to "freeze  @2".   With freeze
  342.                off, return to op  screen.  Note that idle  is running.
  343.                Now Esc will exit.
  344.  
  345.  
  346.           The  mechanism for freezing  is simple.  The  freeze level is the
  347.           same as the  priority of spcon.   In freeze  mode (set by  f() or
  348.           ^f), spcon loops  on sp_pipe with no wait.  Hence, equal or lower
  349.           priority tasks cannot wrest the processor  from spcon.  Thus they
  350.           are frozen and unable to run.   However, since spcon is unlocked,
  351.           higher priority tasks can preempt it and run.  Freeze also has no
  352.           effect upon  isr's and lsr's.   They  run normally.   Hence,  for
  353.           example, if  you freeze @3 or above for  too long, you will get a
  354.           signal counter overflow from the ts semaphore because the timeout
  355.           task  is  frozen.   Also, it  is  important to  remember  that if
  356.           running a debug  version (e.g. ddemolv.exe), ticks  are simulated
  357.           by idle which has priority 0.  Hence a freeze at any  level shuts
  358.           down  all  timing.   Thus, freeze  is  not recommended  for debug
  359.           versions.
  360.  
  361.  
  362.           3.4  Trace Buffers
  363.  
  364.           There are three trace buffers:  (1) call trace buffer (ctb),  (2)
  365.           task trace buffer (ttb), and (3) error buffer (eb).
  366.  
  367.                From the sp screen, enter sb(ctb).   This shows the end
  368.                of the call trace buffer (i.e. the most recent  calls).
  369.                Elapsed  time  (time)  is  on  the  left.    Press  End
  370.                repetitively.  Note that time keeps advancing.  This is
  371.                because trace is still on (look at the heading).  Press
  372.                ^t.   Note "trace  off" in  the heading.   Now  hit End
  373.                repetitively.    Note that  time  stands still.   Press
  374.                Home.   This goes to  the beginning of  ctb.   Press Up
  375.                Arrow and you can see the oldest entry on the top line.
  376.                Hold Down Arrow down and you can scroll forward through
  377.                ctb.  PgDn  and PgUp  permit moving a  page at a  time.
  378.                Strike t and you're in the task trace buffer;  strike e
  379.                and you're  in the  error buffer;  strike c  and you're
  380.                back in the  call trace  buffer.  Note  that your  last
  381.                position in ctb has not changed.
  382.  
  383.  
  384.  
  385.                                           6
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.           You can also display  the task buffer with sb(ttb) and  the error
  394.           buffer with sb(eb) from the sb  screen.  Note that the last  task
  395.           in ttb  is spcon  and that it  is running,  as you  would expect.
  396.           Note also that  the last call  in ctb is  pput_char 14 (^t)  into
  397.           sp_pipe -- i.e. the command which turned trace off (store_char is
  398.           the lsr which does the putting).  The quick switch capability (c,
  399.           e, and t) combined  with position retention allows you  to easily
  400.           compare information between trace buffers.
  401.  
  402.           Examine ttb and  ctb in detail.   You will see that  these traces
  403.           provide a lot of insight into  how DOSdemo runs.  The call  trace
  404.           mechanism is implemented in enter_ssrt() [spa.asm] which replaces
  405.           enter_ssr if smxProbe is installed and if test mode.   Task trace
  406.           is implemented  in the  scheduler if test  mode.   Call trace  is
  407.           implemented in xesr.c if test mode.
  408.  
  409.           CAUTION:  smx calls, which themselves make smx calls, do not show
  410.           correct return values  in ctb.  For example,  create_nmsg() calls
  411.           _nmallocx().    The  return  value  shown  for  create_nmsg()  is
  412.           meaningless;   the return value  for _nmallocx() is  actually the
  413.           return value for create_nmsg().
  414.  
  415.  
  416.           3.5  Call Triggering
  417.  
  418.                From the sp  screen, enter  tr(timeout).  This  resumes
  419.                tracing and triggers on the first pass of any call from
  420.                the  timeout  task,  with  any  parameters.   When  the
  421.                trigger occurs,  information  concerning  the  call  is
  422.                stored in ctb, trace  is turned off, and the  last page
  423.                of ctb  is displayed.    Note that  the specified  task
  424.                (i.e. timeout, in this  case) appears on the last  line
  425.                of  ctb.   Go  back  to the  sp  screen  (Esc).   Enter
  426.                tr(timeout,,10).  This causes the  same trigger, but on
  427.                the  10th  pass.   Note  the  longer  delay.   Now  try
  428.                tr(,signal).  This triggers on the first pass of signal
  429.                from any  task or  lsr with  any parameters.   Do  this
  430.                repetitively  (Esc,  ^r (repeat))  --  you will  see at
  431.                least  two different tasks  appear on the  last line of
  432.                ctb.      (Usually   you  will   see   keep_time,   but
  433.                occaisionally   you   will   see   disk_demo.)      Try
  434.                tr(,,,,INF).   This triggers on  the first pass  of any
  435.                call from any task  or lsr with any  parameters, except
  436.                parameter 2  which must be INF.   Look at ctb  and pick
  437.                other triggers to try.  The command format is:
  438.  
  439.                     tr(task,call,passes,par1,par2,par3)
  440.  
  441.                Don't  leave  out  comma's!  (except   after  the  last
  442.                argument you specify)
  443.  
  444.           Call triggering followed by  examining the call trace is  akin to
  445.           instruction-level  triggering  with a  code  debugger or  a logic
  446.           analyzer followed by examining the instruction  trace.  This is a
  447.           powerful debugging technique.  It permits seeing what led up to a
  448.  
  449.                                           7
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.           particular event (e.g.  signaling a  particular semaphore from  a
  458.           particular task).   With call  triggering, you are  working at  a
  459.           high  level  --  i.e.  the  task  level.   (Presumably  the  code
  460.           debugging  phase is  done.)  Hence,  this is a  tool for tracking
  461.           system-level and integration problems.   It helps you to  see how
  462.           the tasks are  interacting, what is  and isn't running and  when,
  463.           the  frequency of certain  events, etc.   Note that  you can also
  464.           look  at  the task  trace  and error  buffers.   These,  too, are
  465.           stopped.   ttb provides a  nice overview and  a longer time  span
  466.           than ctb.  eb,  of course, shows errors which have  occurred.  It
  467.           may cover a very long time span.
  468.  
  469.           The call  trigger  mechanism  is  implemented  in  call_trigger()
  470.           [trig.c].  Call trigger detection  is implemented in enter_ssrt()
  471.           [spa.asm] along with call trace.
  472.  
  473.  
  474.           3.6  Executing smx Calls Directly
  475.  
  476.                From the sp screen enter  stop(timeout,INF).  Switch to
  477.                the  op  screen  (^s).    Note  that both  timeout  and
  478.                suspender are stopped (suspender  suspends itself, then
  479.                is   resumed  by   timeout.     Go  to  sp   and  enter
  480.                resume(suspender).  Note that suspender's run count has
  481.                increased  by  1.   Repeat  (^s  ^r ^s)  and  watch the
  482.                suspender run count increment.   Try start(timeout) and
  483.                observe that both tasks are running again.
  484.  
  485.           In  a  similar manner,  you can  execute  any smx  call directly!
  486.           Remember, however,  that  you are  making calls  from within  the
  487.           spcon task.  Hence, it  is probably not a  good idea to do  calls
  488.           which will suspend or stop the  current task (i.e. spcon).   Note
  489.           also  that "ct"  (current  task) is  not  recognized (only  fixed
  490.           handle names can be entered into ht).   The most useful smx calls
  491.           for debugging are  calls which  act upon other  tasks or  objects
  492.           such  as  stop(),   start(),  suspend(),  resume(),  bump_task(),
  493.           signal(), etc.
  494.  
  495.                As an  example of  a probably-not-useful  thing to  do,
  496.                enter pput_char(41,sp_pipe,0).  This puts an 'A' (0x41)
  497.                on the screen.
  498.  
  499.  
  500.           3.7  Error Trigger
  501.  
  502.                From the sp  screen, enter start(errgen).  Switch to op
  503.                screen and look at the error  messages.  Switch back to
  504.                sp screen and enter sb(eb) to look at the error buffer.
  505.                Esc  back  to sp  screen  and enter  tre(errgen,,20) to
  506.                trigger on the 20th error from  errgen.  Now try tre().
  507.                This triggers on any error.   Try tre(,10).  This picks
  508.                up INVALID_QCB (errno == 10).
  509.  
  510.  
  511.  
  512.  
  513.                                           8
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.           As with call  triggering, all three trace buffers are immediately
  522.           stopped when  the trigger event  occurs.  Hence, you  can look at
  523.           the  history of smx  calls and task  runs in ctb  and ttb.  Error
  524.           triggering allows  you to capture any error,  a particular error,
  525.           any error from a  particular task, or a  particular error from  a
  526.           particular task.   The error trigger mechanism  is implemented in
  527.           error_trigger() [trig.c].  Error trigger detection is implemented
  528.           in display_error() [xesr.c].
  529.  
  530.                When  you are  done  experimenting  with triggering  on
  531.                errors, stop the errgen task with stop(errgen,INF).
  532.  
  533.  
  534.           3.8  Show Control Blocks
  535.  
  536.                From the sp screen, enter s(idle).  This shows the idle
  537.                tcb and  its timer.   Strike ^r repetitively  and watch
  538.                for  changes.   Enter s(ts)  to  see the  ts semaphore.
  539.                Note that the timeout task is waiting on it.   Note the
  540.                value of the  handle of  ts (e.g. 4750)  and enter  it.
  541.                e.g.  s(4750).   This  is another  way  to look  at ts.
  542.                NOTE:   handles are  always assumed  to be  hexadecimal
  543.                numbers.  Hence showv() is not necessary -- nor is "0x"
  544.                -- as they  are in a  code debugger environment.   Pick
  545.                other  smx  objects   to  look  at  such   as  timeout,
  546.                suspender, ticks, rq, errgen, nmsg, etc.
  547.  
  548.           show() may be used to look at  any smx control block in formatted
  549.           form.  This  is the same command  as is used with  code debuggers
  550.           (see  instructions  for  use  with your  code  debugger  for more
  551.           information).    Note  that  certain  symbols  such  as  "ct" and
  552.           "rq_top" are  interpreted only by  the code debugger  -- smxProbe
  553.           cannot recognize  them.  Also  constructs such as  "idle->fl" are
  554.           interpreted only by the code debugger, not by smxProbe.  smxProbe
  555.           can interpret  only symbols entered  into the  handle table,  ht.
  556.           Hence, working without  a code debugger can be  somewhat limiting
  557.           if you need to use show() extensively.
  558.  
  559.  
  560.           3.9  Show Queues
  561.  
  562.                From  the  sp  screen, enter  sq(rq)  (or  showq(rq) or
  563.                showrq(), if you prefer).  This  shows the ready queue.
  564.                Note that spcon is at level 4.  Hit ^r repetitively and
  565.                watch for changes.  Try sq(idle).   This also shows the
  566.                ready queue,  since idle  is in  it.  Try  sq(timeout).
  567.                The timeout task spends most of its time waiting at the
  568.                ts semaphore,  so  you should  see  it waiting  at  ts.
  569.                Occaisionally, timeout is in the ready queue, so if you
  570.                strike ^r many times, you will eventually catch timeout
  571.                at level  3 in  rq.   A better  way to  see this is  to
  572.                strike ^f.  This sets freeze @4.  Now note that timeout
  573.                is frozen at level  3 in rq.  Enter  f(2), then sq(rq).
  574.                Note that spcon  is at  level 2, timeout  is gone,  but
  575.                sleeper  is frozen  after spcon  at level  2  (press ^r
  576.  
  577.                                           9
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.                again, if spcon doesn't appear).   Enter the value of a
  586.                handle (e.g. sq(4750)).  As  with show, showqv() and 0x
  587.                are unnecessary in this environment.
  588.  
  589.           showq() may be used  to examine any smx queue in structured form.
  590.           This  is the  same command  as used  with code  debuggers --  see
  591.           instructions  for   use  with   your  code   debugger  for   more
  592.           information.  Also, comments, above, with regard to  show() apply
  593.           here.
  594.  
  595.  
  596.           3.10  Starting in Freeze Mode
  597.  
  598.           Code  debuggers normally  come up  with operation stopped  at the
  599.           entry point  to the  code  under test.    This allows  setting  a
  600.           breakpoint or changing a variable.   To achieve a similar startup
  601.           with smxProbe, make sure that spcon  is created with MAX priority
  602.           and enable the  INITIALIZATION FREEZE  code in sp_init()  [sp.c].
  603.           Remake sp_.lib  and ddemo_t.exe.   This  code has  the effect  of
  604.           freezing all tasks after  ainit() finishes.  It then  swaps to sp
  605.           screen.
  606.  
  607.                Do the above,  then run _ t.   Note that the  sp screen
  608.                appears almost  immediately.   ^s, however,  shows that
  609.                demo_init()  has  run.   If  this is  undesirable, move
  610.                application initialization  into a lower  priority task
  611.                started  by ainit().  Then the freeze will occur before
  612.                the application code  has run.  Now  enter tr(timeout).
  613.                Wait awhile.  Observe that  nothing happens because all
  614.                tasks are frozen!  Enter sq(rq) to see this.  Now press
  615.                ^f.  Voila!
  616.  
  617.  
  618.           3.11  Target Operation
  619.  
  620.           smxProbe  obviously requires  a  PC-compatible keyboard,  monitor
  621.           adapter,  and  monitor.   If your  target  lacks these,  input to
  622.           sp_pipe can come  from any  source.  Monitor  output is  directly
  623.           written to  a 2000 word buffer  which can be anywhere  in memory.
  624.           If you  have a debugger which can dump this to a screen in ASCII,
  625.           you're in business.
  626.  
  627.           To permit debugging via a remote  PC connected to a spare  serial
  628.           port on the  target, we  are considering splitting  spcon into  a
  629.           control task and a display task inter-connected via a pipe.  Then
  630.           the keyboard handler and display task can be moved  to the remote
  631.           PC  and the  keyboard and  display  pipes, at  both ends,  can be
  632.           linked via a serial channel.
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.                                           10
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.           4.  TIPS
  650.  
  651.                1. Problem:    Trace not working
  652.                   Cause:      Trigger turns trace off
  653.                   Solution:   ^T
  654.  
  655.                2. Problem:    tr(task) never triggers, yet  task is running
  656.                               (appears in ttb)
  657.                   Cause:      Task makes no smx calls.
  658.                   Solution:   Add an  smx call  if you  need to trigger  on
  659.                               this task.
  660.  
  661.                3. Problem:    Task appears in ttb, but not in ctb
  662.                   Cause:      same as #2
  663.  
  664.                4. Problem:    Some smx calls are not appearing symbolically
  665.                               in ctb.
  666.                   Cause:      Look  at command_table[]  in  sp.c.   Observe
  667.                               that most  entries have  been commented  out.
  668.                               This  is  to prevent  linking  in unused  smx
  669.                               calls.
  670.                   Solution:   Remove "//" for those calls you are using.
  671.  
  672.                5. Problem:    BUILD_HT does not seem to  be working in some
  673.                               cases.  Symbolic names are not appearing  for
  674.                               some handles.
  675.                   Cause:      Handle table may be full.
  676.                   Solution:   Increase HT_SIZE in sp.h and remake sp.
  677.  
  678.                6. Problem:    When stopping on a trigger, the trace buffers
  679.                               have time gaps in them.
  680.                   Cause:      Trace  was  turned  off  when  you  set   the
  681.                               trigger.
  682.                   Solution:   ^t then tr() or ^r.
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.                                           11
  706.