You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 satır
10KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Static Probe Points (Debugging with GDB)</title>
  17. <meta name="description" content="Static Probe Points (Debugging with GDB)">
  18. <meta name="keywords" content="Static Probe Points (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Breakpoints.html#Breakpoints" rel="up" title="Breakpoints">
  26. <link href="Error-in-Breakpoints.html#Error-in-Breakpoints" rel="next" title="Error in Breakpoints">
  27. <link href="Save-Breakpoints.html#Save-Breakpoints" rel="prev" title="Save Breakpoints">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Static-Probe-Points"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Error-in-Breakpoints.html#Error-in-Breakpoints" accesskey="n" rel="next">Error in Breakpoints</a>, Previous: <a href="Save-Breakpoints.html#Save-Breakpoints" accesskey="p" rel="prev">Save Breakpoints</a>, Up: <a href="Breakpoints.html#Breakpoints" accesskey="u" rel="up">Breakpoints</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Static-Probe-Points-1"></a>
  64. <h4 class="subsection">5.1.10 Static Probe Points</h4>
  65. <a name="index-static-probe-point_002c-SystemTap"></a>
  66. <a name="index-static-probe-point_002c-DTrace"></a>
  67. <p><small>GDB</small> supports <em>SDT</em> probes in the code. <acronym>SDT</acronym> stands
  68. for Statically Defined Tracing, and the probes are designed to have a tiny
  69. runtime code and data footprint, and no dynamic relocations.
  70. </p>
  71. <p>Currently, the following types of probes are supported on
  72. ELF-compatible systems:
  73. </p>
  74. <ul>
  75. <li> <code>SystemTap</code> (<a href="http://sourceware.org/systemtap/">http://sourceware.org/systemtap/</a>)
  76. <acronym>SDT</acronym> probes<a name="DOCF5" href="#FOOT5"><sup>5</sup></a>. <code>SystemTap</code> probes are usable
  77. from assembly, C and C<tt>++</tt> languages<a name="DOCF6" href="#FOOT6"><sup>6</sup></a>.
  78. </li><li> <code>DTrace</code> (<a href="http://oss.oracle.com/projects/DTrace">http://oss.oracle.com/projects/DTrace</a>)
  79. <acronym>USDT</acronym> probes. <code>DTrace</code> probes are usable from C and
  80. C<tt>++</tt> languages.
  81. </li></ul>
  82. <a name="index-semaphores-on-static-probe-points"></a>
  83. <p>Some <code>SystemTap</code> probes have an associated semaphore variable;
  84. for instance, this happens automatically if you defined your probe
  85. using a DTrace-style <samp>.d</samp> file. If your probe has a semaphore,
  86. <small>GDB</small> will automatically enable it when you specify a
  87. breakpoint using the &lsquo;<samp>-probe-stap</samp>&rsquo; notation. But, if you put a
  88. breakpoint at a probe&rsquo;s location by some other method (e.g.,
  89. <code>break file:line</code>), then <small>GDB</small> will not automatically set
  90. the semaphore. <code>DTrace</code> probes do not support semaphores.
  91. </p>
  92. <p>You can examine the available static static probes using <code>info
  93. probes</code>, with optional arguments:
  94. </p>
  95. <dl compact="compact">
  96. <dd><a name="index-info-probes"></a>
  97. </dd>
  98. <dt><code>info probes <span class="roman">[</span><var>type</var><span class="roman">]</span> <span class="roman">[</span><var>provider</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>objfile</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></code></dt>
  99. <dd><p>If given, <var>type</var> is either <code>stap</code> for listing
  100. <code>SystemTap</code> probes or <code>dtrace</code> for listing <code>DTrace</code>
  101. probes. If omitted all probes are listed regardless of their types.
  102. </p>
  103. <p>If given, <var>provider</var> is a regular expression used to match against provider
  104. names when selecting which probes to list. If omitted, probes by all
  105. probes from all providers are listed.
  106. </p>
  107. <p>If given, <var>name</var> is a regular expression to match against probe names
  108. when selecting which probes to list. If omitted, probe names are not
  109. considered when deciding whether to display them.
  110. </p>
  111. <p>If given, <var>objfile</var> is a regular expression used to select which
  112. object files (executable or shared libraries) to examine. If not
  113. given, all object files are considered.
  114. </p>
  115. </dd>
  116. <dt><code>info probes all</code></dt>
  117. <dd><p>List the available static probes, from all types.
  118. </p></dd>
  119. </dl>
  120. <a name="index-enabling-and-disabling-probes"></a>
  121. <p>Some probe points can be enabled and/or disabled. The effect of
  122. enabling or disabling a probe depends on the type of probe being
  123. handled. Some <code>DTrace</code> probes can be enabled or
  124. disabled, but <code>SystemTap</code> probes cannot be disabled.
  125. </p>
  126. <p>You can enable (or disable) one or more probes using the following
  127. commands, with optional arguments:
  128. </p>
  129. <dl compact="compact">
  130. <dd><a name="index-enable-probes"></a>
  131. </dd>
  132. <dt><code>enable probes <span class="roman">[</span><var>provider</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>objfile</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></code></dt>
  133. <dd><p>If given, <var>provider</var> is a regular expression used to match against
  134. provider names when selecting which probes to enable. If omitted,
  135. all probes from all providers are enabled.
  136. </p>
  137. <p>If given, <var>name</var> is a regular expression to match against probe
  138. names when selecting which probes to enable. If omitted, probe names
  139. are not considered when deciding whether to enable them.
  140. </p>
  141. <p>If given, <var>objfile</var> is a regular expression used to select which
  142. object files (executable or shared libraries) to examine. If not
  143. given, all object files are considered.
  144. </p>
  145. <a name="index-disable-probes"></a>
  146. </dd>
  147. <dt><code>disable probes <span class="roman">[</span><var>provider</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>objfile</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></code></dt>
  148. <dd><p>See the <code>enable probes</code> command above for a description of the
  149. optional arguments accepted by this command.
  150. </p></dd>
  151. </dl>
  152. <a name="index-_0024_005fprobe_005farg_002c-convenience-variable"></a>
  153. <p>A probe may specify up to twelve arguments. These are available at the
  154. point at which the probe is defined&mdash;that is, when the current PC is
  155. at the probe&rsquo;s location. The arguments are available using the
  156. convenience variables (see <a href="Convenience-Vars.html#Convenience-Vars">Convenience Vars</a>)
  157. <code>$_probe_arg0</code>&hellip;<code>$_probe_arg11</code>. In <code>SystemTap</code>
  158. probes each probe argument is an integer of the appropriate size;
  159. types are not preserved. In <code>DTrace</code> probes types are preserved
  160. provided that they are recognized as such by <small>GDB</small>; otherwise
  161. the value of the probe argument will be a long integer. The
  162. convenience variable <code>$_probe_argc</code> holds the number of arguments
  163. at the current probe point.
  164. </p>
  165. <p>These variables are always available, but attempts to access them at
  166. any location other than a probe point will cause <small>GDB</small> to give
  167. an error message.
  168. </p>
  169. <div class="footnote">
  170. <hr>
  171. <h4 class="footnotes-heading">Footnotes</h4>
  172. <h3><a name="FOOT5" href="#DOCF5">(5)</a></h3>
  173. <p>See
  174. <a href="http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps">http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps</a>
  175. for more information on how to add <code>SystemTap</code> <acronym>SDT</acronym>
  176. probes in your applications.</p>
  177. <h3><a name="FOOT6" href="#DOCF6">(6)</a></h3>
  178. <p>See
  179. <a href="http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation">http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation</a>
  180. for a good reference on how the <acronym>SDT</acronym> probes are implemented.</p>
  181. </div>
  182. <hr>
  183. <div class="header">
  184. <p>
  185. Next: <a href="Error-in-Breakpoints.html#Error-in-Breakpoints" accesskey="n" rel="next">Error in Breakpoints</a>, Previous: <a href="Save-Breakpoints.html#Save-Breakpoints" accesskey="p" rel="prev">Save Breakpoints</a>, Up: <a href="Breakpoints.html#Breakpoints" accesskey="u" rel="up">Breakpoints</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  186. </div>
  187. </body>
  188. </html>