home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / debugo.zip / debug.doc next >
Text File  |  1994-03-21  |  69KB  |  1,676 lines

  1.  
  2. The following note describes the use of the Kernel Debugger functions in the SDK.  It is divided into 3 parts:
  3.  
  4.         1.  Support Available for the Kernel Debugger
  5.         2.  Simple tips on Using the Kernel Debugger
  6.         3.  Manual on Kernel Debugger commands.
  7.  
  8. __________________________________________________________________
  9.  
  10.                                 SUPPORT
  11.  
  12. This release of the SDK contains a copy of the OS/2 debugging kernel.
  13. It is included to assist you in debugging your applications and/or
  14. drivers until such time that higher-level debuggers such as Codeview
  15. can provide adequate debugging functionality in complex situations.
  16.  
  17. The kernel debugger is a low-level debugger oriented toward system and
  18. device driver debugging.  It is not intended to become or be part
  19. of the retail OS/2 product.
  20.  
  21. The use of this kernel is supported in so far as an aid in debugging
  22. your software.  We offer support for the installation and use of the
  23. debugging kernel and it's commands and syntax.
  24.  
  25. ______________________________________________________________________
  26.  
  27.                 SIMPLE TIPS FOR USING THE KERNEL DEBUGGER
  28.  
  29.  
  30. The kernel debugger is a compiled part of the kernel. Hook up a terminal
  31. to com2 and you'll get kernel debugger output. To break into the debugger
  32. at any time, hit control-c on the terminal.
  33.  
  34. ?' will get you a help screen, and '.?' will get you an extended
  35. help screen.
  36.  
  37. .p
  38.  
  39. This command will display all the processes running in the system. The
  40. left hand column of this display will display the 'slot number', which
  41. is important for the '.s' command.
  42.  
  43. When you set a breakpoint in an application, the current debugger 'context'
  44. must be changed to that process. For example, if you hit control-c and
  45. you break while 'bar.exe' is running but you want to set a breakpoint
  46. in 'foo.exe', you must change the debugger context to 'foo.exe'
  47.  
  48. .s [slot number]
  49.  
  50. So type '.p', find out the slot number of 'foo.exe', and type '.s [slot
  51. number]'. Now when you can set breakpoints in 'foo.exe'. Since .dlls have
  52. no 'process' associated with them, in order to set a breakpoint in a .dll
  53. you need to be in the context of an application that is dynamically linked
  54. to that .dll.
  55.  
  56. bp [addr]
  57.  
  58. This sets a break point at the address addr. addr can be symbolic or numeric.
  59. For 32 bit apps, this is a 32 bit address. For 16 bit apps it is a 16 bit
  60. address.
  61.  
  62. bc [bp number]
  63. bd [bp number]
  64. bc *
  65. bd *
  66.  
  67. 'bc [bp number]' clears a breakpoint, while 'bd' disables it. 'bc *' will
  68. clear all breakpoints, while 'bd *' will disable all breakpoints.
  69.  
  70. dw [addr]
  71. db [addr]
  72. dd [addr]
  73.  
  74. These stand for 'dump word', 'dump byte' and 'dump double work',
  75. respectively. These simple display memory starting at address addr.
  76. 'dw [addr] l 20' will display 0x20 words starting at addr.
  77.  
  78. e [addr]
  79.  
  80. This will allow you to edit memory (change memory contents)
  81.  
  82. k
  83.  
  84. This give a stack backtrace of the current application.
  85.  
  86. .k [slot number]
  87.  
  88. This gives a stack backtrace of the thread in this slot.
  89.  
  90. dw ss:sp
  91.  
  92. This dumps the stack at the current bottom of the stack.
  93.  
  94. dw ss:bp
  95.  
  96. This at anytime is what links 'C' stack frames together. The 'bp' register
  97. points on the stack to where the old 'bp' is saved, etc. After 'bp' on the
  98. stack you'll get the return address and then the passed parameters to the
  99. function currently executing. References to [bp+n] reference passed
  100. parameters, where references to [bp-n] reference local variables.
  101.  
  102. g
  103.  
  104. This means 'go' or execute.
  105.  
  106. r
  107.  
  108. This dumps the register set. To set a register, type r[reg]. For example,
  109. rax = 6 will put 6 in the register ax. To execute some code over again or
  110. jump ahead in code, reset the instruction pointer by typing rip=[addr].
  111.  
  112.  
  113.  
  114. ----------------------------------------------------------------------
  115.  
  116.                         KERNEL DEBUGGER MANUAL
  117.  
  118.                           September 8, 1989
  119.  
  120.  
  121. INTRODUCTION
  122.  
  123.         The kernel debugger is derived from DEBUG and SYMDEB debuggers with
  124.         enhancements to handle both real and protected mode operation.  Most
  125.         of the commands and structure of this debugger is the same as DEBUG
  126.         and SYMDEB.  This manual will describe most of the kernel debuggers
  127.         commands and new features.
  128.  
  129.         The debugger normally uses COM2 for it's input and output, but
  130.         if no COM2 exists it will look for a COM1 port.  If neither COM1
  131.         or COM2 exists, it will look for any other COM port in the ROM
  132.         data area (40:0).  A three wire null modem cable is all that is
  133.         needed.  Pin 2 and 3 are switched on one end of the cable.
  134.  
  135.         Most commands are one or two characters with one character
  136.         options.  The semicolon character (;) is command seperator
  137.         and the comma (,) or a blank is operand seperator.
  138.  
  139.         When the syntax of the command is shown the following conventions
  140.         are used:
  141.  
  142.                 * arguments between square brackets ([]) are optional,
  143.  
  144.                 * a horizontal bar (|) indicates that either argument is
  145.                   acceptable,
  146.  
  147.                 * here are some definitions of some of the arguments used in
  148.                   the commands:
  149.  
  150.                         <range> = <addr> [<word>] | [<addr>] [L <word>]
  151.  
  152.                         <addr> = [& | #][<word>:]<word> | %<dword>
  153.  
  154.                         <list> = <byte>, <byte>, ... | "string"
  155.  
  156.                         <string> = "char" | 'char'
  157.  
  158.                         <dword>, <word>, <byte> = expressions that evaluate
  159.                         to the size indicated in the <>.
  160.  
  161.  
  162. ENTERING THE DEBUGGER
  163.  
  164.         There are various ways to get into the debugger.  The first being
  165.         during initialization, if the following keys are hit at the debugger's
  166.         console, the debugger is entered:
  167.  
  168.             "r" - (lower case r) enters the debugger at the beginning
  169.             of DOS initialization in real mode.  This is very early
  170.             in the DOS initialization.
  171.  
  172.             "p" - enters the debugger after we have gone into protected
  173.             mode for the first time.  Symbols have not yet been loaded.
  174.  
  175.             "<space-bar>" - enters the debugger after most of the dos has
  176.             been initialized.  Symbols for DOS have been loaded.
  177.  
  178.         After initialization is complete the debugger can be entered at
  179.         any time by typing <ctrl-c> at the debugger's console.  The
  180.         debugger is entered when and where the next timer tic is taken
  181.         after the key was pressed.
  182.  
  183.         A NMI switch will allow you to break into the debugger even
  184.         if interrupts are disabled (ctrl-c won't).
  185.  
  186.         An "int 3" in the kernel or a program will also cause the debugger
  187.         to stop.
  188.  
  189.         When a kernel panic occurs, a message is sent to both the screen
  190.         and the debuger port.  Before sending the message to the screen
  191.         the screen gets cleared and set to text mode.  This can be a
  192.         problem if you need to see how far a test case got before crashing.
  193.         If you set the BYTE flag fDebugOnly to non-zero, the message will
  194.         go only to the debug port and the screen will be left alone.
  195.  
  196.         After symbols are loaded an initialization file called KDB.INI is
  197.         read and executed.  Any debugger command or list of debugger
  198.         commands can be in the KDB.INI file.  A "g" command should be at
  199.         the end of the commands unless you want the debugger to stop after
  200.         the KDB.INI file is run.
  201.  
  202. EXPRESSIONS
  203.  
  204.         The expression evaluator has been enhanced to provide support for
  205.         four types of addresses; real mode (&segment:offset), protected
  206.         mode (#selector:offset), linear address (%dword) and physical
  207.         address (%%dword).  The "&", "#", "%", and "%%" override the current
  208.         address type, allowing selectors to be used in real mode, segments
  209.         to be used in protected mode, etc.  The "%" linear address and the
  210.         "%%" physical address operator will actually convert other address
  211.         types to a linear or physical address (i.e. %(#001F:0220) will look
  212.         up selector 1F's linear address in the current LDT and add 0220
  213.         to it).  Linear and physical addresses are the same unless paging
  214.         is enabled on a 386.
  215.  
  216.                 #1f:02C0        Protected Mode Address
  217.  
  218.                 &3450:1234      Real Mode Address
  219.  
  220.                 %310230         Linear Address
  221.  
  222.                 %%310230        Physical Address
  223.  
  224.         Addresses can be used in any mode.  In real mode you can use
  225.         protected mode address as long as there is an override.  The
  226.         default depends on the current debugger mode.
  227.  
  228.         There are keywords that will return the value of registers,
  229.         breakpoints, etc. in expressions.  Here is a list of them:
  230.  
  231.         AX, BX, CX, DX, SI, DI, BP, DS, ES, SS, CS, SP, IP  - register values,
  232.  
  233.         FLG  - value of the flags,
  234.  
  235.         GDTB - value of the GDT base as a physical address,
  236.  
  237.         GDTL - value of the GDT limit,
  238.  
  239.         IDTB - value of the IDT base as a physical address,
  240.  
  241.         IDTL - value of the IDT limit,
  242.  
  243.         TR, LDTR, MSW - value of the TR, LDTR, and MSW registers,
  244.  
  245.         BR0,BR1,...,BR9 - value of the breakpoint address at that breakpoint.
  246.  
  247.         The 386 keywords are (in addition to the above):
  248.  
  249.         EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EIP - extended register values,
  250.  
  251.         FS, GS - segment registers,
  252.  
  253.         EFLG - value of extend flags,
  254.  
  255.         CR0, CR2, CR3 - control register values,
  256.  
  257.         DR0, DR1, DR2, DR3, DR6, DR7 - debug register values,
  258.  
  259.         TR6, TR7 - test register values.
  260.  
  261.         These register names are search for first before the symbol table
  262.         is searched.  The "@" character can override the register name
  263.         look up and search the symbol table for the name. "@ax" will search
  264.         for a symbol called "ax" instead of evaluating to the register
  265.         value.
  266.  
  267.         The operators that can be used in expressions are documented in the
  268.         symdeb manual except for the address operators (&, #, %) and the new
  269.         relational operators.  I have also changed the precedence of the
  270.         operators to be more like "C" which should be a little more intuitive.
  271.  
  272.         Operators in precedence order:
  273.  
  274.         ( )
  275.         | :
  276.         & # % %% - ! NOT SEG OFF BY WO DW POI PORT WPORT (all unary operators)
  277.         * / MOD
  278.         + -
  279.         > < >= <=
  280.         == !=
  281.         AND XOR OR
  282.         && ||
  283.  
  284.         Binary operator definitions:
  285.  
  286.         ( )             Parentheses, used to change order of evaluation
  287.         :               Address binder, binds segment/selector and offsets
  288.         *               Multiplication
  289.         /               Division
  290.         MOD             Modulo (remainder)
  291.         +               Addition
  292.         -               Subtraction
  293.         >               Greater than relational operators
  294.         <               Less than relational operator
  295.         >=              Greater than or equal relational operator
  296.         <=              Less than or equal relational operator
  297.         ==              Equal to operator
  298.         !=              Not equal relational operator
  299.         AND             Bitwise AND
  300.         XOR             Bitwise exclusive OR
  301.         OR              Bitwise inclusive OR
  302.         &&              Logical AND
  303.         ||              Logical OR
  304.  
  305.         Unary operator definitions:
  306.  
  307.         |               Task number/address operator
  308.         &               Address is segment:offset type address
  309.         #               Address is selector:offset type address
  310.         %               Address is linear type address
  311.         %%              Address is physical type address
  312.         -               2's complement
  313.         !               Logical NOT operator
  314.         NOT             Bitwise 1's complement
  315.         SEG             Returns the segment portion
  316.         OFF             Returns the offset portion
  317.         BY              1 byte value from the address
  318.         WO              2 byte value from the address
  319.         DW              4 byte value from the address
  320.         POI             4 byte address from the address
  321.         PORT            1 byte value from 8 bit I/O port
  322.         WPORT           2 byte value from 16 bit I/O port
  323.  
  324.         If the operator precedence is same the expression is evaluated
  325.         left to right even for unary operators.  "C" evaluates unary
  326.         operators right to left which is more intuitive and easy to use.  The
  327.         debugger's expression evaluator will do the right to left evaluation
  328.         soon.  So now expressions like "poi #60:133" will have to be written
  329.         as "poi (#60:133)" because of the way it handles unary operators.
  330.  
  331.         Ranges are an address and either a length or a end.  "4544:0 L5" is
  332.         address (4555:0) and a length of 5 objects.  If you are dumping words,
  333.         5 words are dumped.  "#8:32 50" is a range of bytes from address
  334.         "8:32" to and including "8:50".
  335.  
  336.         NOTE:
  337.  
  338.         On <ranges> if the second address has a unary operator like "&" or "#",
  339.         then it must be separated by a comma from the first.  Parentheses work
  340.         as well.  Example:
  341.  
  342.                 >db ds:40,%40000                WORKS
  343.  
  344.                 >db ds:40 (%40000)              WORKS
  345.  
  346.                 >db ds:40 %40000                DOESN'T WORK
  347.  
  348.         This is because of a bug in the expression evaluator.
  349.  
  350.  
  351.         ? <expr> | "<string>"
  352.  
  353.         This command will evaluate the expression and print it out in
  354.         all the standard radixes plus the ascii character for the value
  355.         and an address's physical address.  It will also print if the
  356.         expression evaluated to TRUE (non-zero) or FALSE (zero).  It will
  357.         print a string if surrounded by quotes (single or double).
  358.  
  359.  
  360. NUMBERS
  361.                 digitsY         Binary          0 1
  362.                 digitsO         Octal           0 1 2 3 4 5 6 7
  363.                 digitsQ
  364.                 digitsT         Decimal         0 1 2 3 4 5 6 7 8 9
  365.                 digitsH         Hexadecimal     0 1 2 3 4 5 6 7 8 9 A B C D E F
  366.  
  367.         The default radix base is hex.
  368.  
  369.  
  370. STRINGS
  371.         'characters'
  372.         "characters"
  373.  
  374.         A string represents a list of ASCII values.  It can be any number
  375.         of and combination of characters enclosed in single (') or double
  376.         (") quotation marks.  The starting and ending quotation marks must
  377.         be the same type.  If a matching quotation mark appears inside the
  378.         string, it must be given twice to prevent the debugger from ending
  379.         the string too soon.
  380.  
  381.         Examples:
  382.  
  383.                 'This is a string'
  384.                 "This is a string"
  385.                 'This ''string'' is okay'
  386.                 "This ""string"" is okay"
  387.  
  388.  
  389. SYMBOLS
  390.  
  391.         The kernel debugger supports symbolic debugging.  When
  392.         a symbol file (generated with mapsym) is loaded for the DOS,
  393.         a base or installable device drivers, the debugger can use
  394.         any public symbols in the dos or device driver as part of
  395.         an expression.  The disassembler and the BL command also
  396.         display addresses symbolicly if the symbol exists for the
  397.         address.  The debugger uses the mapsym format for the symbol
  398.         file.  "mapsym mapfile.map" generates the ".sym" file needed.
  399.         For the DOS, ibmdosd.sym is automatically generated by the makefile
  400.         when ibmdosd.com is built.  The DOS's symbol must be on the boot
  401.         drive in the root directory and called "ibmdos.sym".  For base
  402.         device drivers, the .sym file must also be in the root of the
  403.         boot drive with the same name as the device file, but with the
  404.         .sym extension, (i.e. clock01.sym, diskdd02.sym).  For installable
  405.         device drivers, the .sym file must be in the same directory as
  406.         the device driver file with the .sym extension.
  407.  
  408.         To load symbols for a program or module, the .sym file must
  409.         be in the same directory as the .exe or .dll and the symbols
  410.         will be loaded automatically.
  411.  
  412.         There can be more than one symbol file loaded at one time and
  413.         more than one currently "active".  The "WA", "WR" and "LM" control
  414.         and list the currently active map files.  The term "map file"
  415.         refers to the .sym file generated by mapsym.  Each newly loaded
  416.         map file starts off active.
  417.  
  418.         The message "Symbols Linked (xxxxxxxx)" is printed when there
  419.         is a successful load of an symbol file.  The "xxxxxxx" is
  420.         the map name listed in the "LM" command.  The message
  421.         "Symbols Unlinked (xxxxxxxxx)" is printed when a program that
  422.         has loaded symbols exits and the symbol file is removed.
  423.  
  424.         Currently the symbols for DOS are not loaded when the
  425.         debugger first comes up.  The DOS symbols are loaded after
  426.         some of the DOS's data structures and the virtual memory
  427.         manager is initialized, but before the base device drivers
  428.         and most of the other DOS components are.  If you want to
  429.         break after the DOS's symbols are loaded, just type "bp cs:ip"
  430.         and "g".  The second time this code is initialized the DOS's
  431.         symbols have been loaded and the breakpoint is hit.  Also
  432.         see the above section titled "ENTERING THE DEBUGGER".
  433.  
  434.         Symbols are case insensitive.  The "@" forces the string to
  435.         looked up as a symbol instead of a register name.
  436.  
  437. BREAKPOINTS
  438.  
  439.         There are two kinds of breakpoints in the kernel debugger:
  440.         temporary (sometimes called GO breakpoints) and sticky.  Temporary
  441.         breakpoints are set when the GO command is executed and go away
  442.         when the debugger is re-entered for any reason (hitting a GO or
  443.         sticky breakpoint, a trap or fault, etc).  Sticky breakpoints are
  444.         created, removed, disabled, etc. with the commands listed below.
  445.  
  446.         If you set a breakpoint in an LDT segment when a thread other
  447.         than thread 1 is running, that breakpoint will be moved to
  448.         thread 1 when the current thread dies (so that it can still be
  449.         addressed).  When thread 1 dies, the breakpoint will be disabled,
  450.         and its address marked as invalid.  When that task slot is reused,
  451.         the breakpoint can be re-enabled; but it is not advisable to do so
  452.         unless you are SURE that the new task has the same code at that
  453.         spot.
  454.  
  455.         On a 386, the debug registers can be used in a sticky breakpoint
  456.         (see the BR command).
  457.  
  458. BP[n] [<address>] [<passcount>] [<breakpoint commands>]
  459.  
  460.         This command sets a new or changes an old sticky breakpoints.  The
  461.         "n" is an optional breakpoint number to select a old breakpoint for
  462.         changing or forcing a new breakpoint to be a certain number.  If the
  463.         breakpoint number is omitted, then the first available breakpoint
  464.         number is used.  The number has to be right after the "BP", a digit
  465.         from '0' to '9' and a space after the number.  Up to ten breakpoints
  466.         can be set.  The address is required for all new breakpoints and
  467.         either an address or breakpoint number can be used to change an
  468.         existing break-point.  A breakpoint command or passcount can be
  469.         added or changed with commands like BP0 "DB DS:SI;R" or BP2 5.
  470.  
  471.         A breakpoint command is a string of any debugger commands that are
  472.         executed when that breakpoint is hit.  Semi-colons (;) separate
  473.         commands from one another.  Everything is forced to upper case unless
  474.         surrounded by single quotes.  Two single or double quotes escapes
  475.         the special meaning of them.
  476.  
  477.         A passcount of more than zero (default) means that this breakpoint
  478.         has to be executed that many times before the debugger actually
  479.         breaks.
  480.  
  481. BR[<bp>] E|W|R|1|2|4 [<addr>] [<passcnt>] ["<bp cmds>"]
  482.  
  483.         This command sets a 386 debug register.  Debug registers can
  484.         be used to break on data reads and writes, and instruction
  485.         execution (which is the same as a regular breakpoint).  Up to
  486.         four debug registers can be set and enabled at one time.  Disabled
  487.         BR breakpoints don't use up a debug register.  The flag definations
  488.         are:
  489.  
  490.         1 - one-byte length (default)
  491.         2 - word length on word boundary
  492.         4 - dword length on dword boundary
  493.  
  494.         E - break on instruction execution only (one-byte length only)
  495.         W - break on writes only
  496.         R - break on reads and writes
  497.  
  498.         For one-byte breakpoints the linear address align doesn't matter,
  499.         but for word length breakpoints the linear address must be on
  500.         a word boundary.   For a dword length breakpoint the linear address
  501.         must be on a dword boundary.  The debugger will convert the address
  502.         to linear and print an error message if the alignment is incorrect.
  503.  
  504.         Only addresses that can be converted to linear (segment, selector
  505.         and linear, but not physical) can be used in the BR command
  506.         address.  The rest of the arguments are exactly like a BP command.
  507.  
  508. BT[<n>] [<address>]
  509.  
  510.         This command sets a time stamping breakpoint.
  511.  
  512. BS
  513.  
  514.         This command shows the time stamp entries.
  515.  
  516. BL
  517.  
  518.         This command lists the currently set breakpoints along with the
  519.         current and original passcount and the breakpoint command if any.
  520.         An "e" after the breakpoint number means that the breakpoint is
  521.         enabled; a "d" means that it is disabled.  After either one of
  522.         those, there may be an "I" which indicates that the address was
  523.         invalid the last time the debugger tried to set or clear the
  524.         breakpoint.
  525.  
  526. BC[n],[n],...
  527.  
  528.         Removes (clears) the list of breakpoint numbers from the debugger's
  529.         breakpoint table.
  530.  
  531. BE[n],[n],...
  532.  
  533.         Enables the list of breakpoint numbers.
  534.  
  535. BD[n],[n],...
  536.  
  537.         Disables the list of breakpoint numbers, so the breakpoint is not
  538.         actually put in the code but is saved until it is enabled.
  539.  
  540.  
  541. COMPARE COMMAND
  542.  
  543. C <range> <addr>
  544.  
  545.         The Compare command compares the bytes in the memory location
  546.         specified by <range> with the corresponding bytes in the memory
  547.         locations beginning at <addr>.  If all corresponding bytes match,
  548.         the kernel debugger displays its prompt and waits for the next
  549.         command. If one or more corresponding bytes do not match, each
  550.         pair of mismatched bytes is displayed.
  551.  
  552.  
  553. DUMP COMMANDS
  554.  
  555. D [<range>]
  556.  
  557.         Dumps memory in the last format.
  558.  
  559. DB [<range>]
  560.  
  561.         Dumps memory in bytes and ascii.
  562.  
  563. DW [<range>]
  564.  
  565.         Dumps memory in words.
  566.  
  567. DD [<range>]
  568.  
  569.         Dumps memory in double words.
  570.  
  571. DG[A] [<range>]
  572.  
  573.         This command dumps the global descriptor table.  The "A" option
  574.         causes all the entries to be dumped (not just the valid entries).
  575.         The default is to display just the valid GDT entries.  A range of
  576.         entries or just one GDT entry can be displayed.  If the command
  577.         is passed an LDT selector, it will display "LDT" and the appropriate
  578.         LDT entry.
  579.  
  580. DI[A] [<range>]
  581.  
  582.         This command dumps the interrupt descriptor table.  The "A" option
  583.         causes all the entries to be dumped (not just the valid entries).
  584.         The default is to display just the valid IDT entries.  A range of
  585.         entries or just one IDT entry can be displayed.
  586.  
  587. DL[A|P|S|H] [<range>]
  588.  
  589.         This command dumps the local descriptor table.  The "A" option
  590.         causes all the entries to be dumped (not just the valid entries).
  591.         The default is to display just the valid LDT entries.  A range of
  592.         entries or just one LDT entry can be displayed.  If the command
  593.         is passed a GDT selector, it will display "GDT" and the appropriate
  594.         GDT entry.
  595.  
  596.         The options P, S, and H are used to dump private, shared, or
  597.         huge segment selectors respectively. To dump the huge segment
  598.         selectors, give the shadow selector followed by the max. no.
  599.         of selectors reserved for that segment plus 1.
  600.  
  601. DP[A|D] [<range>]
  602.  
  603.         This command dumps the page directory and page tables.  Page
  604.         tables are always skipped if the corresponding page directory
  605.         entry is not present.  Page directory entries appear with an
  606.         asterisk next to the page frame, and are dumped once preceding
  607.         4 meg region.  As a general rule, you will want to ignore
  608.         any lines beginning with an asterisk.
  609.  
  610.         The "A" option dumps all present page directory and page table
  611.         entries; the default is to skip page directory and page table
  612.         entries that are zero.  A zero page table entry means that the
  613.         page is uncommitted.
  614.  
  615.         The "D" option dumps only page directory entries.  If a count
  616.         is given as part of the optional range, it will be interpreted
  617.         as a page directory entry count.
  618.  
  619.         For example:
  620.  
  621.         ##dp ff000 l4
  622.          linaddr   frame   pteframe  state res Dc Au CD WT Us rW Pn state
  623.         %000ff000* 00343  frame=00343  2    0  D  A        U  W  P  resident
  624.         %000ff000  000ff  frame=000ff  1    0  c  A        U  W  P  uvirt
  625.         %00100000  002ae  frame=002ae  0    0  c  A        U  W  P  pageable
  626.         %00101000  00215  vp id=0083c  0    0  c  u        U  W  n  pageable
  627.         %00102000         vp id=0083d  0    0  c  u        U  W  n  pageable
  628.  
  629.                bit   bit
  630.                set  clear
  631.                ---  -----
  632.         key:    D    c    Dirty / clean
  633.                 A    u    Accessed / unaccessed
  634.                 U    s    User / supervisor
  635.                 W    r    Writable / read-only
  636.                 P    n    Present / not-present
  637.  
  638.         The "pteframe" field contains the contents of the high 20 bits in
  639.         the pte.  If the page is present, that value is the high 20 bits
  640.         of the physical address the page maps.  To find out information
  641.         about that physical address, you can use the ".mp" command (see
  642.         below).  If the page is not present, the "pteframe" field contains
  643.         an index into the Virtual Page structure.  The ".mv" command
  644.         can dump information from that structure.  A not present page
  645.         may still be cross-linked to a page of physical memory via the
  646.         VP, and if so, that physical address is in the "frame" column.
  647.  
  648.         An exception:  "uvirt" pages (noted in the "state" column") are
  649.         direct mapping of physical memory without any other page manager
  650.         structures associated with them.
  651.  
  652. DT [<addr>]
  653.  
  654.         This command dumps the TSS.  If no address is given, it will dump
  655.         the current TSS pointed to by the TR register, extracting the type
  656.         (16 or 32 bit) from the descriptor access byte.  If an address is
  657.         given, the type is extracted from the 386env flag.
  658.  
  659.  
  660. DX
  661.         This command dumps the 286 loadall buffer.
  662.  
  663.  
  664. ENTER COMMAND
  665.  
  666. E <addr> [<list>]
  667.  
  668.         The ENTER command enters one or more byte values into memory at
  669.         the specified <addr>.  If the optional <list> is given, the command
  670.         replaces the byte at the given address and the bytes at each
  671.         subsequent address until all values in the list have been used. If
  672.         no <list> is given, the command prompts for a replacement value.
  673.  
  674.         If an error occurs, all bytes values remain unchanged.
  675.  
  676.         If you do not supply a <list>, the kernel debugger prompts for a
  677.         new value at <addr> by displaying this address and its current value
  678.         followed by a dot (.).  You can then replace the value, skip to
  679.         the next value, return to a previous value, or exit the command
  680.         by following these steps:
  681.  
  682.         1.  To replace the byte value, simply type the new value after
  683.             the current value.  Make sure you typed a 1- or 2-digit
  684.             hexadecimal number.  The command ignores extra trailing digits
  685.             or other characters.
  686.  
  687.         2.  To skip to the next byte, press the SPACE bar. Once you have
  688.             skipped to the next byte, you can change its value or skip
  689.             to the next byte.  If you skip beyond an 8-byte boundary,
  690.             the kernel debugger starts a new display line by displaying
  691.             the new address and value.
  692.  
  693.         3.  To return to the preceding byte, type a hyphen (-). When
  694.             you return to the preceding byte, the kernel debugger starts
  695.             a new display line with the address and value of that byte.
  696.  
  697.         4.  To exit the E command, press the RETURN key. You can exit
  698.             the command at any time.
  699.  
  700.  
  701. FILL COMMAND
  702.  
  703. F <range> <list>
  704.  
  705.         The FILL command fills the addresses in the given <range> with the
  706.         values in the <list>.  If the range speifies more bytes than the
  707.         number of values in the list, the list is repeated until all bytes
  708.         in the range are filled.  If <list> has more values than the number
  709.         of bytes in the range, the command ignores any extra values.
  710.  
  711.  
  712. GO COMMAND
  713.  
  714. G[S][T][=<start-address>][<break-address>],,,
  715.  
  716.         The GO command passes execution control to the program at the
  717.         given <start-address>.  Execution continues to the end of the
  718.         code or until a <break-address> is encountered.  The debuggee
  719.         code also stops at any breakpoints set using the Breakpoint
  720.         Set command.
  721.  
  722.         If no <start-address> is given, the command passes execution to
  723.         the address specified by the current values of CS and IP registers.
  724.         The equal sign (=) may be used only when a <start-address> is given.
  725.  
  726.         If a <break-address> is given, it must specify an instruction
  727.         address (that is, the address must contain the first byte of an
  728.         instruction opcode).  Up to ten addresses can be given at one
  729.         time.  The addresses can be given in any order.  Only the first
  730.         address encountered during execution will cause a break.  All
  731.         others are ignored.  If you attempt to set more than ten
  732.         breakpoints, an error message will be displayed.
  733.  
  734.         The "S" option will print the time (in perfview timer tics)
  735.         from when the system is started with GS til the next entry to
  736.         the debugger. No attempt is made to calculate and remove debugger
  737.         overhead from the measurement.
  738.  
  739.         The "T" option allows trapped exceptions to resume at the
  740.         original trap handler address without having to unhook the
  741.         exception.  Instead of "vcp d; t; vsp d" this GO option can
  742.         be used.
  743.  
  744.         When the debuggee code execution reaches a breakpoint, the
  745.         kernel debugger normally displays the current values of the
  746.         registers and flags.  It also displays the next instruction
  747.         to be executed.  If the "default command (Z)" has been
  748.         changed to something other the "R" command, the debugger
  749.         will execute the command list set by the last "ZS" command.
  750.  
  751.  
  752. HELP/PRINT EXPRESSION COMMAND
  753.  
  754. ?[<expr>]|'string'
  755.  
  756.         Prints help if no arguments or the value for the evaluated
  757.         expression in all bases.  It will also print a string on
  758.         the console.
  759.  
  760.  
  761. HEX COMMAND
  762.  
  763. H <value1> <value2>
  764.  
  765.         The HEX command displays the sum and difference of two
  766.         hexadecimal numbers. The debugger adds <value1> to <value2>
  767.         and displays the result.  It then subtracts <value2> from
  768.         <value1> and displays that result. The results are displayed
  769.         on one line and are always in hex.  See the "?" command
  770.         for a more general expression display.
  771.  
  772.  
  773. INPUT COMMAND
  774.  
  775. I <port>
  776.  
  777.         The INPUT command reads and displays one byte from the given
  778.         input <port>.  The <port> can be any 16-bit port address.
  779.  
  780.  
  781. LIST NEAR SYMBOL COMMAND
  782.  
  783. LN [<addr>]
  784.  
  785.         This command lists the nearest symbol both forward and back
  786.         to the address passed.  The default is the current disassembly
  787.         address.  All the active maps are searched.
  788.  
  789.         There is the possibility when <addr> is specified as a
  790.         selector:offset that there will be duplicates.  Be sure that
  791.         you have selected the correct slot(.s nn) before you use the
  792.         LN command with a selector:offset.
  793.  
  794. LIST GROUPS COMMAND
  795.  
  796. LG [<mapname>]
  797.  
  798.         It lists the selector or segment and the name for each group
  799.         in the active maps or the specified map.
  800.  
  801.  
  802. LIST MAPS COMMAND
  803.  
  804. LM
  805.         This command lists all the current symbol files loaded and
  806.         which are active.
  807.  
  808.  
  809. LIST ABSOLUTE SYMBOLS COMMAND
  810.  
  811. LA [<mapname>]
  812.  
  813.         It lists all the absolute symbols in the active maps or the
  814.         specified map.
  815.  
  816.  
  817. LIST SYMBOLS COMMAND
  818.  
  819. LS <addr>
  820.  
  821.         It lists all the symbols in the group the address is in.
  822.  
  823.  
  824. ADD/REMOVE ACTIVE MAP COMMAND
  825.  
  826. WA <mapname> | *
  827. WR <mapname> | *
  828.  
  829.         "WA" adds a map to the active list. "WR" removes it.  The "LM"
  830.         command is used see what map files are available.  "*" means all
  831.         maps.  All maps start active when first linked.
  832.  
  833.  
  834. CONDITIONAL EXECUTION COMMAND
  835.  
  836. J <expr> [<command list>]
  837.  
  838.         This command will execute the command list if the expression
  839.         evaluates to TRUE (non-zero).  Otherwise it continues to the
  840.         next command in the command line (not including the ones in the
  841.         "command list".  The command list must be in single or double
  842.         quotes if there is more than more command (separated by ";").
  843.         A single command or no command can also be used without quotes.
  844.         This command can be used in breakpoint commands, to conditionally
  845.         break when an expression becomes true, or even in the default
  846.         command (see below about the default command).
  847.  
  848.         The command BP 167:1454 "J AX == 0;G" breaks when ax equals zero
  849.         when this breakpoint is hit.
  850.  
  851.         The command BP 167:1452 "J BY (DS:SI+3) == 40 'R;G';DG DS" will
  852.         print the registers out and go, if when this breakpoint is hit
  853.         the byte pointed to by "DS:SI+3" is equal to 40.  Otherwise it
  854.         will print the descriptor table entry in DS.
  855.  
  856.         The command BP 156:1455 "J (MSW AND 1) == 1 'G'" will break when the
  857.         breakpoint is reached in real mode.  BP 156:1455 "J (MSW AND 1)" is
  858.         a short cut that does the same thing (like "C" boolean expressions).
  859.  
  860.         See the default command (Z) for more examples.
  861.  
  862.  
  863. STACK TRACE COMMAND
  864.  
  865. K[S|B] [<SS:BPaddr>] [<CS:IPaddr>]
  866.  
  867.         This command threads thru the BP chain on the stack and prints
  868.         the address, 4 words/dwords of parameters, and any symbol found
  869.         for the address.  The starting stack frame address (SS:BPaddr)
  870.         and the initial code segment (CS:IPaddr) can be specified.  Defaults
  871.         to SS:EBP and CS:EIP.  The "S" (Small) option indicates the frame
  872.         is 16 bits width and "B" (Big) indicates the frame is 32 bits width.
  873.         The default depends on the D bit in the CS selector.
  874.  
  875.  
  876. MOVE COMMAND
  877.  
  878. M <range> <addr>
  879.  
  880.         The MOVE command moves the block of memory specified by <range>
  881.         to the location starting at <addr>.
  882.  
  883.         All moves are guaranteed to be performed without data loss, even
  884.         where the source and destination blocks overlap.  This means the
  885.         destination block is always an exact duplicate of the original
  886.         source block.  If the destination block overlaps some portion of
  887.         the source block, the original source will be changed.
  888.  
  889.         To prevent data loss, MOVE copies data from the source block's
  890.         lowest address first whenever the source is at a higher address
  891.         than the destination.  If the source is at a lower address, MOVE
  892.         copies data from the source's highest address first.
  893.  
  894.  
  895. OUTPUT COMMAND
  896.  
  897. O <port> <byte>
  898.  
  899.         The OUTPUT comand sends the given <byte> to the specified output
  900.         <port>. The <port> can be any 16-bit port address.
  901.  
  902.  
  903. PTRACE COMMAND
  904.  
  905. P[N|T] [=<start-address>] [<count>]
  906.  
  907.         The PTRACE command executes the instruction at the given <start-
  908.         address>, then displays the current values of the all the registers
  909.         and flags (whatever the Z command has been set to).
  910.  
  911.         The difference between PTRACE and TRACE is the PTRACE stops
  912.         after instructions like CALL, REP MOVSB, etc. instead of
  913.         tracing into the call or each rep string operation.
  914.  
  915.         If the optional <start-address> is given, the command starts
  916.         execution at the given address.  Otherwise, it starts execution
  917.         at the instruction pointed to by the current CS and IP registers.
  918.         The equal sign (=) may be used only if a <start-address> is given.
  919.  
  920.         If the optional <count> is given, the command continues to execute
  921.         <count> instructions before stopping.  The command displays the
  922.         current values of the registers and flags for each instruction
  923.         before executing the next.
  924.  
  925.         The "N" option suppresses the register display so just the assembly
  926.         line is displayed.  This only works if the "default command" (see Z
  927.         command) is a "R" (the normal setting).
  928.  
  929.         The "T" option allows original trap handler address to be traced into
  930.         without having to unhook the exception.  Instead of "vcp d; t; vsp d"
  931.         this "T" option can be used.
  932.  
  933.  
  934. REGISTER COMMAND
  935.  
  936. R[T][<register-name> [<value>]]
  937.  
  938.         The REGISTER command displays the contents of CPU register and
  939.         allows the contents to be changed to new values.
  940.  
  941.         The "T" option toggles the "regterse" flag (see the "Y" command).
  942.  
  943.         If no <register-name> is given, the command displays all the
  944.         registers, flags, and the instruction at the address pointed
  945.         to by the current CS and IP register values.
  946.  
  947.         If a <register-name> is given, the command displays the current
  948.         value of the given rgister and prompts for a new value.  If both
  949.         a <register-name> and <value> are given, the command changes the
  950.         register to the given value.
  951.  
  952.         The <register-name> can be any of one the following names:
  953.  
  954.                 AX, BX, CX, DX, SI, DI, BP, SP, IP, PC  - general registers.
  955.  
  956.                 DS, ES, SS, CS - segment registers.
  957.  
  958.                 GDTB - GDT base as a linear address.
  959.  
  960.                 GDTL - GDT limit.
  961.  
  962.                 IDTB - IDT base as a linear address.
  963.  
  964.                 IDTL - IDT limit.
  965.  
  966.                 TR, LDTR - TR, LDTR registers.
  967.  
  968.                 IOPL - iopl portion of flag registers.
  969.  
  970.                 F - flag register.
  971.  
  972.                 MSW - Machine status word.
  973.  
  974.         The 386 <register-name) are the following (in addition to the
  975.         above):
  976.  
  977.                 EAX, EBX, ECX, EDX, ESI, EDI, EBP,
  978.                 ESP, EIP - extended general registers.
  979.  
  980.                 FS, GS - segment registers.
  981.  
  982.                 EF - extended flag register.
  983.  
  984.                 CR0, CR2, CR3 - control registers.
  985.  
  986.                 DR0, DR1, DR2, DR3, DR6, DR7 - debug registers.
  987.  
  988.                 TR6, TR7 - test registers.
  989.  
  990.         IP and PC name the same register: the Instruction Pointer. F is
  991.         a special name for the Flags register.
  992.  
  993.         To change a register value, supply name of the register when you
  994.         enter the REGISTER command.  If you do not also supply a value,
  995.         the command displays the name of the register, its current value,
  996.         and a colon prompt.  Type the new value and press the RETURN key.
  997.         If you do not want to change the value, just press the RETURN key.
  998.         If you enter a illegal name, the command displays an error message.
  999.  
  1000.         To change a flag value, supply the register name "F" when you enter
  1001.         the REGISTER command.  The command displays the current value of
  1002.         each flag as a two-letter name. The following is a list of flag
  1003.         values:
  1004.  
  1005.                 FLAG            SET             CLEAR
  1006.                 ----            ---             ------
  1007.                 OverFlow        OV              NV
  1008.                 Direction       DN (Decrement)  UP (Increment)
  1009.                 Interrupt       EI (Enabled)    DI (Disabled)
  1010.                 Sign            NG (Negative)   PL (Plus)
  1011.                 Zero            ZR              NZ
  1012.                 Aux Carry       AC              NA
  1013.                 Parity          PE (Even)       PO (Odd)
  1014.                 Carry           CY              NC
  1015.                 Nested Task     NT              (toggles)
  1016.  
  1017.         At the end of the list of values, the command displays a hyphen
  1018.         (-).  Once you see the hyphen, enter new values for the flags you
  1019.         wish to change, then press the RETURN key.  You can enter flag
  1020.         values in any order. Spaces between values are not required. Flags
  1021.         for which new values are not entered remain unchanged. If you do
  1022.         not want to change anys flags, just press the RETURN key.
  1023.  
  1024.         If you enter a name other than those shown above, the command
  1025.         will print an error message. The flags up to the error are
  1026.         changed; flags at and after the error are not.
  1027.  
  1028.         To change the MSW (Machine status word) is the same as change
  1029.         the flag registers but with the following flag names:
  1030.  
  1031.                 FLAG            SET             CLEAR
  1032.                 ----            ---             ------
  1033.                 Protected Mode  PM              (toggles)
  1034.                 Monitor
  1035.                   Processor
  1036.                     Extension   MP              (toggles)
  1037.                 Emulate
  1038.                   Processor
  1039.                     Extension   EM              (toggles)
  1040.                 Task Switched   TS              (toggles)
  1041.  
  1042.         "Toggles" means that if the flag is set, using the flag
  1043.         name in the REGISTER command will clear it.  If the flag
  1044.         is clear, using the flag name in the R command will set it.
  1045.  
  1046.  
  1047. SEARCH COMMAND
  1048.  
  1049. S <range> <list>
  1050.  
  1051.         The SEARCH command searches the given <range> of memory locations
  1052.         for the byte values given in <list>.  If the bytes in the list
  1053.         are found, the command displays the address of each occurrence
  1054.         of the list. Otherwise, it displays nothing.
  1055.  
  1056.         The <list> can have any number of bytes. Each must be seperated
  1057.         by a space or comma.  If the list contains more than one byte,
  1058.         SEARCH does not display an address unless the bytes begining
  1059.         at that address exactly match the value and order of the bytes
  1060.         in the list.
  1061.  
  1062.  
  1063. TRACE COMMAND
  1064.  
  1065. T[A|C|N|S|T|X][=<start-address>][<count>][<addr>]
  1066.  
  1067.         The TRACE command executes the instruction at the given
  1068.         <start-address>, then displays the current values of all
  1069.         the registers and flags.
  1070.  
  1071.         If the optional <start-address> is given, the command starts
  1072.         execution at the given address.  Otherwise, it starts execution
  1073.         at the instruction pointed to by the current CS and IP registers.
  1074.         The equal sign (=) may be used only if a <start-address> is given.
  1075.  
  1076.         If the optional <count> is given, the command continues to execute
  1077.         <count> instructions before stopping.  The command displays the
  1078.         current values of the registers and flags for each instruction
  1079.         before executing the next.
  1080.  
  1081.         The "A" option allows the user to specify an ending address for
  1082.         the trace. Instructions will be traced until [<addr>] is reached.
  1083.  
  1084.         The "C" options suppresses all output and counts instructions traced.
  1085.         An end address is required for this command.
  1086.  
  1087.         The "N" option suppresses the register display so just the assembly
  1088.         line is displayed.  This only works if the "default command" (see Z
  1089.         command) is a "R" (the normal setting).
  1090.  
  1091.         The "S" (special trace) option is identical to the "C" option except
  1092.         that the instruction and count is displayed for every CALL and
  1093.         the return from that call. The utility program ParseTS can be used
  1094.         to generate a call-tree with instruction counts from this output.
  1095.         Note that to allow ParseTS to operate correctly, calls must match
  1096.         exits. To achieve this you must:
  1097.            1) Start and stop tracing in the same procedure.
  1098.            2) Stop tracing at least 2 instructions after the last traced
  1099.               call.
  1100.  
  1101.         For example:
  1102.            push    word ptr [bp+08]
  1103.            push    word ptr [bp+06]
  1104.            call    1cc2:0000           <-- Start from here
  1105.            cmp     ax,0074
  1106.            jz      0997                <-- TS to here
  1107.  
  1108.         The "T" option allows original trap handler address to be traced into
  1109.         without having to unhook the exception.  Instead of "vcp d; t; vsp d"
  1110.         this "T" option can be used.
  1111.  
  1112.         The "X" option forces the debugger to trace regions of code known to
  1113.         be untraceable (e.g. _PGSwitchContext).
  1114.  
  1115.  
  1116. UNASSEMBLE COMMAND
  1117.  
  1118. U [<range>]
  1119.  
  1120.         The UNASSEMBLE command displays the instructions in a mnemonic
  1121.         format. All the 286 and 287 opcodes can be displayed.
  1122.  
  1123.         If given a <range>, the specified address is display for the
  1124.         number of bytes specified.  If the <range> contains, the "L"
  1125.         options (i.e. u 90:234 l3) this specifies the number of lines
  1126.         to display.
  1127.  
  1128.  
  1129. INTERRUPT AND TRAP VECTOR COMMANDS
  1130.  
  1131.  
  1132. VL[N | P | V | R | F]
  1133.  
  1134.         Lists the real and protected mode vectors that the debugger
  1135.         intercepts.  Vectors that have been set with VT (as opposed
  1136.         to VS) will be printed with a star following the vector number.
  1137.         VLR will list only the real mode vectors and VLP will list only
  1138.         the protect mode vectors.  VL will list both like this:
  1139.  
  1140.         R 0 1 2 3 4 5 6
  1141.         V 0 1 2
  1142.         P 0 1 2 3 4 5 6 7 8* 9 A B
  1143.  
  1144.         The "N" (Noisy) option lists the traps that beep when hit.
  1145.  
  1146.         The "F" (Fatal) option causes the kernel to route the faults that
  1147.         are fatal to a process to the debugger instead of displaying the
  1148.         popup message.  For GP faults, "VSF D" is the same a "VSP D". For
  1149.         page faults "VSP E" would trap all ring 3/2 page faults, but "VSF E"
  1150.         would trap only the invalid page faults.
  1151.  
  1152. VT[N | P | V | R | F] n[,n,..]
  1153.  
  1154.         Adds a new vector that the debugger intercepts.  VTR will install
  1155.         a debugger handler in the real mode IDT and VTP will do the same
  1156.         for the protected mode IDT.  VSV or VTV intercepts V86 mode exceptions
  1157.         or traps.
  1158.  
  1159.         The "N" option causes the intercepted traps to beep when hit.
  1160.  
  1161.         The "F" (Fatal) option causes the kernel to route the faults that
  1162.         are fatal to a process to the debugger instead of displaying the
  1163.         popup message.  For GP faults, "VSF D" is the same a "VSP D". For
  1164.         page faults "VSP E" would trap all ring 3/2 page faults, but "VSF E"
  1165.         would trap only the invalid page faults.
  1166.  
  1167. VS[N | P | V | R | F] n[,n,..]
  1168.  
  1169.         Behaves identically to VT except that VS will not intercept
  1170.         ring 0 interrupts.  VSV or VTV intercepts V86 mode exceptions
  1171.         or traps.
  1172.  
  1173.         The "N" option causes the intercepted traps to beep when hit.
  1174.  
  1175.         The "F" (Fatal) option causes the kernel to route the faults that
  1176.         are fatal to a process to the debugger instead of displaying the
  1177.         popup message.  For GP faults, "VSF D" is the same a "VSP D". For
  1178.         page faults "VSP E" would trap all ring 3/2 page faults, but "VSF E"
  1179.         would trap only the invalid page faults.
  1180.  
  1181. VC[N | P | V | R | F] n,[n],..
  1182.  
  1183.         Clears the vectors indicated, re-installing whatever address was
  1184.         in the vector before the debugger grabbed the vector.
  1185.  
  1186.         The "N" option causes the affected traps to not beep when hit.
  1187.         It does not clear the trap itself.
  1188.  
  1189.         The "F" (Fatal) option causes the kernel to route the faults that
  1190.         are fatal to a process to the debugger instead of displaying the
  1191.         popup message.  For GP faults, "VSF D" is the same a "VSP D". For
  1192.         page faults "VSP E" would trap all ring 3/2 page faults, but "VSF E"
  1193.         would trap only the invalid page faults.
  1194.  
  1195.         NOTE:
  1196.  
  1197.         If you want to intercept general protection faults before OS/2
  1198.         does, then you can do "VTP D" before the fault is hit, examine
  1199.         the information about the fault, do a "VCP D" and "G" which will
  1200.         let the OS/2 GP handler get control (and kill the process, etc).
  1201.         Or you could do a "VCP D" after hitting the fault and trace into
  1202.         the exception handler.  The "TT" or "GT" commands now do this
  1203.         automacticly.
  1204.  
  1205.  
  1206. DEBUGGER OPTION COMMAND
  1207.  
  1208.  
  1209. Y[?] [386env|dislwr|regterse]
  1210.  
  1211.         This command allows the debugger configuration to be changed.  The
  1212.         "?" prints the current options supported.  The "Y" command by itself
  1213.         prints the current state of the options.  The  "Y" and a flag name
  1214.         sets or toggles a options flag.
  1215.  
  1216.         386env - 32 bit environment (toggles)
  1217.         dislwr - lower case disassembly (toggles)
  1218.         regterse - terse register set (toggles)
  1219.  
  1220.         All these flags toggle their state when set and are printed only
  1221.         when the option is on.
  1222.  
  1223.         The "386env" flag controls the size of addresses, registers, etc.
  1224.         when displayed.  When this option is on, addresses, registers, etc.
  1225.         are printed in 32 bit formats; otherwise they are printed in the 16
  1226.         bit formats.  This flag has nothing to do with the CPU (286/386) the
  1227.         debugger is running on; only the display sizes.
  1228.  
  1229.         The "dislwr" controls the disassembler's lower case option.  When
  1230.         the flag is on, disassembly is in lower case.
  1231.  
  1232.         The "regterse" controls the number of registers display in the
  1233.         register dump command.  In the 386 environment, when the "regterse"
  1234.         is on, only the first three lines are displayed (instead of
  1235.         the normal six line plus disassembly line display).  In the
  1236.         286 environment (386env off), only the first two lines of the
  1237.         normal three line display (plus the disassembly line) are printed.
  1238.  
  1239.  
  1240. DEFAULT COMMAND LINES
  1241.  
  1242.  
  1243. Z
  1244.         Executes the default command.  The default command is a string of
  1245.         debugger commands that are executed any time the debugger is
  1246.         entered and there is no breakpoint command attached to the entry.
  1247.         It starts as just the "R" command but any string of commands can be
  1248.         used.
  1249.  
  1250. ZL
  1251.         List the default command.
  1252.  
  1253.  
  1254. ZS <string>
  1255.  
  1256.         Change the default command.  If there are any errors (too long)
  1257.         it will return to the "R" command.
  1258.  
  1259.         If you want to just "GO" on all those INT 3's in your application
  1260.         or test program, here is what you do:
  1261.  
  1262.         ZS "J (BY CS:IP) == CC 'G'"
  1263.  
  1264.         This will GO every time you enter the debugger on an INT 3.
  1265.  
  1266.         A watchpoint can be set up as follows:
  1267.  
  1268.         ZS "J (WO 40:1234) == 0EED 'r';t"
  1269.  
  1270.         This commands traces until the word at 40:1234 is equal to 0EED.
  1271.         This won't work if you are tracing thru the mode switching code
  1272.         in DOS or other sections of code that can't be traced.
  1273.  
  1274.  
  1275.  
  1276. EXTERNAL DEBUGGER COMMANDS
  1277.  
  1278.  
  1279.         These are commands that are part of the debugger, but are
  1280.         specific to the environment the debugger is running in.
  1281.         The following commands are for the OS/2 2.0 environment.
  1282.  
  1283.  
  1284. HELP COMMAND
  1285.  
  1286. .?
  1287.  
  1288.         This command prints the help menu for the external debugger
  1289.         commands.
  1290.  
  1291.  
  1292. COM PORT BAUD RATE COMMAND
  1293.  
  1294. .B <baud rate> [<port addr>]
  1295.  
  1296.         This command will set the baud rate of the debugging port (COM2).
  1297.         Legal values for the baud rate are 150, 300, 600, 1200, 2400, 4800,
  1298.         9600 and 19200.  Since the default radix for the debugger is 16
  1299.         you must suffix numbers by "t" to indicate decimal values.  As
  1300.         an example, if you wanted to debug over a 1200 baud line, the
  1301.         correct command would be:
  1302.  
  1303.         .b 1200t
  1304.  
  1305.         The port address option can be "1" for COM1, "2" for COM2 and
  1306.         any thing else is taken as a base port address.  During
  1307.         initialization if there is no COM2, the debugger checks for
  1308.         COM1 and then any other COM port address in the ROM data area
  1309.         and uses it as the console.
  1310.  
  1311.  
  1312. DUMP ABIOS COMMON DATA AREA COMMAND
  1313.  
  1314. .C
  1315.         This command dumps the ABIOS common data area.
  1316.  
  1317.  
  1318. DUMP DOS DATA STRUCTURES COMMAND
  1319.  
  1320. .D <data struc name> [<addr>]
  1321.  
  1322.         This command displays a few common OS/2 data structures.
  1323.         Here is a list of data structures supported:
  1324.  
  1325.                 SFT     - system file table entry
  1326.                 VPB     - volume parameter block
  1327.                 DPB     - disk parameter block
  1328.                 DEV     - device driver header
  1329.                 REQ     - device driver request packet
  1330.                 MFT     - master file table entry
  1331.                 BUF     - file system buffer
  1332.                 BPB     - bios parameter block
  1333.                 SEM32   - 32-bit Semaphore structure
  1334.                 MUXQ    - 32-bit Semaphore MuxQ chain
  1335.                 OPENQ   - 32-bit Semaphore OpenQ chain
  1336.  
  1337.  
  1338. SWAP IN TSD OR PAGE COMMAND
  1339.  
  1340. .I[D|B] [<addr>]
  1341. .IT[D|B] [<slot>]
  1342.  
  1343.         If just ".I" is given, the page enclosing that address will
  1344.         be swapped in.  The address may include an optional task slot
  1345.         number override, as in: %3|20000.  The ".IT" command swaps in
  1346.         the corresponding task's TSD.  The "D" option queues up a single
  1347.         swapin request to be acted upon at task time by the KDB daemon
  1348.         thread.  If the "D" option is not given, the this command is
  1349.         restricted to being executed in user mode (ring 3/2) or kernel mode
  1350.         if it isn't interrupt time, if the thread isn't blocked, swapping
  1351.         or leaving the kernel (InDos == 0).  The ".I[T]" checks for all
  1352.         these conditions and prints an error.  The ".ID[T]" command can
  1353.         never be used, but the context is losted because the kdb daemon
  1354.         thread is switched to.
  1355.  
  1356. USER STACK TRACE COMMAND
  1357.  
  1358. .K[S|B] [<slot> | # | *]
  1359.  
  1360.         This command threads through the BP chain on the user stack of
  1361.         the slot specified and prints the address, 4 words/dwords of
  1362.         parameters and any symbol found for the address.  The default
  1363.         starting point is taken from the user SS:EBP and CS:EIP of the
  1364.         debugger's default slot (the one selected with .S).  The "S"
  1365.         (Small) option indicates the frame is 16 bits width and "B"
  1366.         (Big) indicates the frame is 32 bits width.  The default depends
  1367.         on the D bit in the user's CS.
  1368.  
  1369.  
  1370. PRINT MTE SEGMENT TABLE COMMAND
  1371.  
  1372. .LM[O][L|P|V|X] <hobmte|laddr|"modulename"]
  1373.  
  1374.         This command prints module table entries and their associated
  1375.         object and segment table entries.
  1376.  
  1377.         The "O" option suppresses the object or segment table display.
  1378.  
  1379.         The "L" option displays only library (.DLL) mtes.
  1380.         The "P" option displays only Physical Device Driver (PDD) mtes.
  1381.         The "V" option displays only Virtual Device Driver (VDD) mtes.
  1382.         The "X" option displays only executable (.EXE) mtes.
  1383.  
  1384.         If a non-zero hobmte is given, only those mtes with a matching
  1385.         hobmte are printed.  If a non-zero linear address is given,
  1386.         only the mte pointed to by the linear address are printed.
  1387.         If a quoted string is given, only those mtes with a matching
  1388.         module name are printed.  The module names for a:\bar.dll and
  1389.         c:\foo\bar.exe are both "bar".  No drive, path or extension
  1390.         information should be given.
  1391.  
  1392. MEMORY ARENA RECORD DUMP COMMAND
  1393.  
  1394. .MA[A|B|C|F|H|L|M|R] [<har|laddr>] | [<har|laddr> L<number of entries>]
  1395.  
  1396.         This command displays the virtual memory manager's arena records.
  1397.         If no handle or linear address is given, the entire table is
  1398.         displayed.  If a linear address is given, it is taken to be a
  1399.         pointer to an arena record.  One record or a range of records can
  1400.         be displayed.
  1401.  
  1402.  
  1403.         The "A" option displays all contexts (default is current context
  1404.         only).
  1405.  
  1406.         The "B" option displays only busy (allocated) entries (default).
  1407.  
  1408.         The "F" option displays only free (un-allocated) entries.
  1409.  
  1410.         The "C" option finds the corresponding object record, and displays
  1411.         the arena, object, alias and context record chains.
  1412.  
  1413.         The "H" option walks hash links, displaying entries.
  1414.  
  1415.         The "L" option walks forward links, displaying entries.
  1416.  
  1417.         The "R" option walks reverse links, displaying entries.
  1418.  
  1419.         The "M" option causes all arena records whose linear address range
  1420.         encloses the given linear address to be displayed.  A linear address
  1421.         must also be given, and no count is allowed.  Context information
  1422.         is ignored, so if the linear address is valid in multiple contexts,
  1423.         mutiple arena records will be displayed.  A physical address may be
  1424.         given intead of a linear address to allow not-present linear addresses
  1425.         to get past the debugger's expression analyzer.  If a selector address
  1426.         type is used, it must be converted to a linear address on the command
  1427.         line.
  1428.  
  1429.  
  1430.         If you ever come across the case where you need to find out who
  1431.         owns a selector because of a GP fault in some unknown LDT or GDT
  1432.         segment or memory object, the following command is most helpful:
  1433.  
  1434.             .M
  1435.         or
  1436.             .MAMC CS:EIP
  1437.  
  1438.         This will display the arena record and memory object record (and
  1439.         the owner) of the code segment.  It will also walk the context
  1440.         record chains and display them.  The "CS" can be substituted with
  1441.         any selector, and the "EIP" with any offset.  This command converts
  1442.         the selector:offset into a linear address automatically, so the
  1443.         resulting address can be used to find and interpret the arena
  1444.         record(s) and memory object record(s).
  1445.  
  1446.         Since ".M" defaults to ".MAMC" when no options are given, and
  1447.         since specifying the "M" option to any ".M" command uses "CS:EIP"
  1448.         for the default, ".M" is the same as ".MAMC CS:EIP".
  1449.  
  1450.  
  1451. MEMORY CONTEXT RECORD DUMP COMMAND
  1452.  
  1453. .MC[B|C|F] [<hco|laddr>] | [<hco|laddr> L<number of entries>]
  1454.  
  1455.         This command displays the virtual memory manager's context records.
  1456.         If no handle or linear address is given, the entire table is
  1457.         displayed.  If a linear address is given, it is taken to be a
  1458.         pointer to a context record.  One record or a range of records can
  1459.         be displayed.
  1460.  
  1461.         The "B" option displays only busy (allocated) entries (default).
  1462.  
  1463.         The "F" option displays only free (un-allocated) entries.
  1464.  
  1465.         The "C" option also walks context record chains and displays them.
  1466.  
  1467.  
  1468. MEMORY ALIAS RECORD DUMP COMMAND
  1469.  
  1470. .ML[C] [<hal|laddr>] | [<hal|laddr> L<number of entries>]
  1471.  
  1472.         This command displays the virtual memory manager's alias records.
  1473.         If no handle or linear address is given, the entire table is
  1474.         displayed.  If a linear address is given, it is taken to be a
  1475.         pointer to an alias record.  One record or a range of records can
  1476.         be displayed.
  1477.  
  1478.         The "B" option displays only busy (allocated) entries (default).
  1479.  
  1480.         The "F" option displays only free (un-allocated) entries.
  1481.  
  1482.         The "C" option finds the corresponding object record, and displays
  1483.         the arena, object, alias and context record chains.
  1484.  
  1485.  
  1486. MEMORY OBJECT RECORD DUMP COMMAND
  1487.  
  1488. .MO[B|C|F|M|N|P|S|V] [<hob|laddr>] | [<hob|laddr> L<number of entries>]
  1489.  
  1490.         This command displays the virtual memory manager's memory object
  1491.         records.  If no handle or linear address is given, the entire table
  1492.         is displayed.  If a linear address is given, it is taken to be a
  1493.         pointer to an object record.  One record or a range of records can
  1494.         be displayed.
  1495.  
  1496.         This command attempts to display what process, mte or ptda owns the
  1497.         segment.  It will display the owner as a short ascii string when
  1498.         appropriate.  It will display the PID of the process and, if possible,
  1499.         the name of the module that owns this segment.  Code segments will
  1500.         normally have only the module name and no process ID.  If the segment
  1501.         is an MTE, PTDA or LDT, it will display the object name, the process
  1502.         ID (if the segment is a PTDA) and the module name if possible.
  1503.  
  1504.         Here are a few examples of the owners it can display:
  1505.  
  1506.                 free            - free memory
  1507.                 devhlp          - allocated by the AllocPhys devhlp.
  1508.                 idevice         - installable device driver memory
  1509.                 system          - system owned memory
  1510.                 dosexe          - the initial memory arena when dos
  1511.                                   started (includes all the DOS code
  1512.                                   and data segments).
  1513.                 mte             - a module table entry
  1514.                 ptda            - a per task data arena
  1515.                 ldt             - a local descriptor table
  1516.  
  1517.         If it just has a PID or a module name, then this piece of memory
  1518.         is owned by the process or module.
  1519.  
  1520.         The "B" option causes in-use (busy) object records to be displayed.
  1521.  
  1522.         The "F" option causes free object records to be displayed.
  1523.  
  1524.         The "C" option displays the arena, object, alias and context record
  1525.         chains.
  1526.  
  1527.         The "M" option causes all pseudo object records with an exactly
  1528.         matching linear address to be displayed.  A linear address must
  1529.         also be given, and no count is allowed.  If a selector address type
  1530.         is used, it must be converted to a linear address on the command
  1531.         line.  A physical address may be given intead of a linear address
  1532.         to allow not-present linear addresses to get past the debugger's
  1533.         expression analyzer.
  1534.  
  1535.         The "N" option causes non-pseudo object records to be displayed.
  1536.  
  1537.         The "P" option causes pseudo object records to be displayed.
  1538.  
  1539.         The "S" option causes object records with the semaphore busy or wanted
  1540.         to be displayed.
  1541.  
  1542.         The "V" option causes object record linear addresses to be displayed.
  1543.         It also disables the owner interpretation.
  1544.  
  1545.  
  1546. MEMORY PAGE FRAME DUMP COMMAND
  1547.  
  1548. .MP[B|F|H|L|R|S] [<frame|laddr>] | [<frame|laddr> L<number of entries>]
  1549.  
  1550.         This command displays the page manager's page frame structures.
  1551.         If no handle or linear address is given, the entire table is
  1552.         displayed.  If a linear address is given, it is taken to be a
  1553.         pointer to a page frame structure.  One record or a range of
  1554.         records can be displayed.
  1555.  
  1556.         The "B" option displays only busy (allocated) entries (default).
  1557.  
  1558.         The "F" option displays only free (un-allocated) entries.
  1559.  
  1560.         The "H" option walks hash links, displaying entries.
  1561.  
  1562.         The "L" option walks forward links, displaying entries.
  1563.  
  1564.         The "R" option walks reverse links, displaying entries.
  1565.  
  1566.         This data structure contains per-physical page information.
  1567.         To find out the owner of a particular physical page,
  1568.         use ".mp FrameNumber" where FrameNumber is the physical address
  1569.         shifted right by 12 (take off 3 zeros).  If the page isn't free,
  1570.         the "pVP" field contains a flat pointer to the virtual page
  1571.         structure.  Use ".mv %pVP" where pVP is the value from the .mp
  1572.         dump, to get the contents of the VP.  The "Hob" field of the VP
  1573.         is a handle to the Object Record.  Use ".mo Hob" to dump it.
  1574.         That will display a readable string for the owner on the
  1575.         right of the display (see .mo above).  ".ma" of the
  1576.         "Har" field in the object record will give the base virtual address
  1577.         of the object containing the page (under "va").  Use the "HobPg"
  1578.         field of the VP to get the page offset within the object.
  1579.  
  1580. MEMORY VIRTUAL PAGE STRUCTURE DUMP COMMAND
  1581.  
  1582. .MV[B|F|L|R] [<vpid|laddr>] | [<swapid|laddr> L<number of entries>]
  1583.  
  1584.         This command displays the swap manager's swap frame structures.
  1585.         If no handle or linear address is given, the entire table is
  1586.         displayed.  If a linear address is given, it is taken to be a
  1587.         pointer to a swap frame structure.  One record or a range of
  1588.         records can be displayed.
  1589.  
  1590.         See the ".mp" command above for an example.
  1591.  
  1592.         The "B" option displays only busy (allocated) entries (default).
  1593.  
  1594.         The "F" option displays only free (un-allocated) entries.
  1595.  
  1596.         The "L" option walks forward links, displaying entries.
  1597.  
  1598.         The "R" option walks reverse links, displaying entries.
  1599.  
  1600.         To find the owner of a virtual page,
  1601.  
  1602.  
  1603. PRINT PROCESS STATUS COMMAND
  1604.  
  1605. .P[B|U] [<slot> | # | *]
  1606.  
  1607.         This command displays the current process and thread status.  The
  1608.         "*" by the slot number is the currently running task or the last
  1609.         task to have blocked.  The "#" marks what the debugger thinks the
  1610.         current task is (set by the .S command).  If "#", "*" or a slot
  1611.         number is used on the command line, only the corresponding slot's
  1612.         information will be displayed.
  1613.  
  1614.         Without the "B" or "U" option, it prints the PID, parent PID,
  1615.         command subtree number, thread number, state, priority, block ID,
  1616.         PTDA address, TCB offset, dispatch SP, screen group and name of
  1617.         the process or thread.
  1618.  
  1619.         The "B" option will display the detailed blocked information.
  1620.         The "handlesem" entry is the current virtual memory manager handle
  1621.         semaphores owned by this process.  The "child" entry is a child
  1622.         in the process of being exec'd.  It is printed after all the
  1623.         threads in the exec'ing task (and their "handlesem" entries) have
  1624.         been printed.
  1625.  
  1626.         The "U" option will display user state information, which includes
  1627.         the CS:IP and SS:SP at the time the kernel was entered, along with
  1628.         the number of arguments that were passed, their PTDA offset, and
  1629.         the offset of the register stack frame.
  1630.  
  1631.  
  1632. USER REGISTER COMMAND
  1633.  
  1634. .R [<slot> | # | *]
  1635.  
  1636.         The .R command displays the contents of the user's (ie, at time
  1637.         of entry to the kernel) CPU registers, flags and the next
  1638.         instruction to be executed for a specified slot.
  1639.  
  1640.         If no parameter is given, or if "#" is on the command line, the
  1641.         debugger's current slot (selected by the .S command) will be used.
  1642.         If "*" is on the command line, the currently scheduled slot (or
  1643.         the last one to block) will be used.  Or if there is a number on
  1644.         the command line, it will be taken as the slot to use.
  1645.  
  1646.  
  1647. REBOOT COMMAND
  1648.  
  1649. .REBOOT
  1650.         This command warm boots the machine.  The whole string ".REBOOT"
  1651.         needs to be typed.
  1652.  
  1653.  
  1654. TASK CONTEXT CHANGE COMMAND
  1655.  
  1656. .S[S] [<slot> | *]
  1657.  
  1658.         This changes what the debugger thinks the current task context
  1659.         is.  If no slot number is passed, it will print the current
  1660.         task number.  This will allow dumping of some process-specific
  1661.         data (the LDT or stack) for other than the current task.  The "S"
  1662.         option also changes the SS and SP to the new task's PTDA selector
  1663.         and dispatch SP value.  The original SS and SP is automatically
  1664.         restored when the debugger exits, or when the ".SS" command is
  1665.         used to switch back to the current task.  The "*" slot number
  1666.         changes the debuggers current task number to the real OS2 task
  1667.         number.
  1668.  
  1669.  
  1670. RAS TRACE BUFFER PRINT COMMAND
  1671.  
  1672. .T [<count>] [maj=<xx> [min=<yy>]]
  1673.  
  1674.         This command dumps the RAS trace buffer, optionally dumping only
  1675.         events with the specified major and minor event codes.
  1676.