ddb.8 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. .\"-
  2. .\" Copyright (c) 2007-2008 Robert N. M. Watson
  3. .\" All rights reserved.
  4. .\"
  5. .\" Redistribution and use in source and binary forms, with or without
  6. .\" modification, are permitted provided that the following conditions
  7. .\" are met:
  8. .\" 1. Redistributions of source code must retain the above copyright
  9. .\" notice, this list of conditions and the following disclaimer.
  10. .\" 2. Redistributions in binary form must reproduce the above copyright
  11. .\" notice, this list of conditions and the following disclaimer in the
  12. .\" documentation and/or other materials provided with the distribution.
  13. .\"
  14. .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  15. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  18. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  20. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  21. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  22. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  23. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  24. .\" SUCH DAMAGE.
  25. .\"
  26. .Dd December 24, 2008
  27. .Dt DDB 8
  28. .Os
  29. .Sh NAME
  30. .Nm ddb
  31. .Nd "configure DDB kernel debugger properties"
  32. .Sh SYNOPSIS
  33. .Nm
  34. .Cm capture
  35. .Op Fl M core
  36. .Op Fl N system
  37. .Cm print
  38. .Nm
  39. .Cm capture
  40. .Op Fl M core
  41. .Op Fl N system
  42. .Cm status
  43. .Nm
  44. .Cm script
  45. .Ar scriptname
  46. .Nm
  47. .Cm script
  48. .Ar scriptname Ns = Ns Ar script
  49. .Nm
  50. .Cm scripts
  51. .Nm
  52. .Cm unscript
  53. .Ar scriptname
  54. .Nm
  55. .Ar pathname
  56. .Sh DESCRIPTION
  57. The
  58. .Nm
  59. utility configures certain aspects of the
  60. .Xr ddb 4
  61. kernel debugger from user space that are not configured at compile-time or
  62. easily via
  63. .Xr sysctl 8
  64. MIB entries.
  65. .Pp
  66. To ease configuration, commands can be put in a file which is processed using
  67. .Nm
  68. as shown in the last synopsis line.
  69. An absolute
  70. .Ar pathname
  71. must be used.
  72. The file will be read line by line and applied as arguments to the
  73. .Nm
  74. utility.
  75. Whitespace at the beginning of lines will be ignored as will lines where the
  76. first non-whitespace character is
  77. .Ql # .
  78. .Sh OUTPUT CAPTURE
  79. The
  80. .Nm
  81. utility can be used to extract the contents of the
  82. .Xr ddb 4
  83. output capture buffer of the current live kernel, or from the crash dump of a
  84. kernel on disk.
  85. The following debugger commands are available from the command line:
  86. .Bl -tag -width indent
  87. .It Xo
  88. .Cm capture
  89. .Op Fl M Ar core
  90. .Op Fl N Ar system
  91. .Cm print
  92. .Xc
  93. Print the current contents of the
  94. .Xr ddb 4
  95. output capture buffer.
  96. .It Xo
  97. .Cm capture
  98. .Op Fl M Ar core
  99. .Op Fl N Ar system
  100. .Cm status
  101. .Xc
  102. Print the current status of the
  103. .Xr ddb 4
  104. output capture buffer.
  105. .El
  106. .Sh SCRIPTING
  107. The
  108. .Nm
  109. utility can be used to configure aspects of
  110. .Xr ddb 4
  111. scripting from user space; scripting support is described in more detail in
  112. .Xr ddb 4 .
  113. Each of the debugger commands is available from the command line:
  114. .Bl -tag -width indent
  115. .It Cm script Ar scriptname
  116. Print the script named
  117. .Ar scriptname .
  118. .It Cm script Ar scriptname Ns = Ns Ar script
  119. Define a script named
  120. .Ar scriptname .
  121. As many scripts contain characters interpreted in special ways by the shell,
  122. it is advisable to enclose
  123. .Ar script
  124. in quotes.
  125. .It Cm scripts
  126. List currently defined scripts.
  127. .It Cm unscript Ar scriptname
  128. Delete the script named
  129. .Ar scriptname .
  130. .El
  131. .Sh EXIT STATUS
  132. .Ex -std
  133. .Sh EXAMPLES
  134. The following example defines a script that will execute when the kernel
  135. debugger is entered as a result of a break signal:
  136. .Bd -literal -offset indent
  137. ddb script kdb.enter.break="show pcpu; bt"
  138. .Ed
  139. .Pp
  140. The following example will delete the script:
  141. .Pp
  142. .Dl "ddb unscript kdb.enter.break"
  143. .Pp
  144. For further examples, see the
  145. .Xr ddb 4
  146. and
  147. .Xr textdump 4
  148. manual pages.
  149. .Sh SEE ALSO
  150. .Xr ddb 4 ,
  151. .Xr mac_ddb 4 ,
  152. .Xr textdump 4 ,
  153. .Xr sysctl 8
  154. .Sh HISTORY
  155. The
  156. .Nm
  157. utility first appeared in
  158. .Fx 7.1 .
  159. .Sh AUTHORS
  160. .An Robert N M Watson
  161. .Sh BUGS
  162. Ideally,
  163. .Nm
  164. would not exist, as all pertinent aspects of
  165. .Xr ddb 4
  166. could be configured directly via
  167. .Xr sysctl 8 .