home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / mach / doc / notes / kdb25.doc.Z / kdb25.doc
Encoding:
Text File  |  1992-09-01  |  2.8 KB  |  80 lines

  1.         A BRIEF SUMMERY OF KDB COMMANDS
  2.  
  3. The following is a brief list of the kdb commands. kdb uses the
  4. same command format as adb and expertise in adb is assumed. These
  5. describes kdb for the i386 machines but in general should apply to
  6. other machine types as well
  7.  
  8. To enter the debugger:
  9.  
  10.     i386 -     ctrl-alt-d
  11.     pmax - do key (kernel must be enabled for this )
  12.     sun3 - L1-a
  13.  
  14.     The format commands:
  15.          <addr>/<letters>
  16. and write commands
  17.         <addr>/{w,W} values
  18. function exactly as you would expect from adb.  (And note that / and ?
  19. are treated the same.)  So you can use kdb to disassemble code, look at
  20. memory locations and change memory locations.
  21.  
  22.     $r    -    will print out the register values
  23.     <rname/var    accesses the value of register_name/variable
  24.     >rname/var    sets the value of register_name/variable
  25.  
  26.     The neat features are the "step/breakpoint" commands, which are
  27. again analogous to the adb functions:
  28.     :s    -    single step one instruction
  29.     :c,C    -     continue until the next breakpoint
  30.             (these both takes counts ala adb syntax)
  31.     :p,P    -    print the instructions while single stepping
  32.     :j    -    step until the next call or return and count
  33.              the instructions
  34.     :J    -    step until we return to this nesting level
  35.              (show functions entered and instruction
  36.               counts.)
  37.     :S    -    step over the function call you are stopped at
  38.     :r,R    -    set a temporary break at the return address, so
  39.              you effectively step out of this function. (Note:
  40.              make sure you have done the push %ebp, movl %esp,
  41.              %ebp before you try this.)
  42.  
  43.  
  44.     Breakpoints are set with <addr>:B and <addr>:D and listed with $B,
  45. just like adb.  You may not provide commands to execute when a breakpoint 
  46. is hit. <addr>:b #, <addr>:d and $b are very different breakpoints.  They 
  47. use the i386 hardware match facilities.  You can set up to 4 breakpoints and 
  48. you have to specify which one to ":b".  Right now they work analogous to 
  49. the "B" breakpoints. But someday, I will implement access to the hardware 
  50. break on read and break on write features;  all that is supported now is 
  51. break on execute.
  52.  
  53. @begin(verbatim)
  54.     $l    -    lists the state of all the threads
  55.     $L    -    lists the state and stack of all the threads
  56.  
  57.     $k    -    does a stack trace
  58.     $c    -    does a stack trace
  59. <thread>$K    -    does a stack trace for the give thread
  60. <addres>$C    -    does a stack trace at the given frame.
  61.    <map>$m    -    prints the map at address <map>
  62. <addres>$Pp    -    prints port
  63. <addres>$PO    -    prints object
  64. <addres>$PM    -    prints map
  65. <addres>$PP    -    prints "page structure"
  66.  
  67. <function>! arg0 arg1 ...    invokes function with the given arguments
  68.  
  69.     R!    -    invokes the function to sync the disk and reboot
  70.     Q!    -    invokes the function to reboot
  71.  
  72.     pb!    -    invokes the playback function.  The screen is small
  73.              compared to the info you might want to display; pb
  74.              will play back each line and wait for a space or
  75.              return before continuing.  Any other character 
  76.              terminates playback.  The buffer is 64k.
  77.  
  78.  
  79.  
  80.