Tracepoint-Restrictions.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 5.1, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: Tracepoint Restrictions</title>
  16. <meta name="description" content="Debugging with GDB: Tracepoint Restrictions">
  17. <meta name="keywords" content="Debugging with GDB: Tracepoint Restrictions">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="Set-Tracepoints.html#Set-Tracepoints" rel="up" title="Set Tracepoints">
  26. <link href="Analyze-Collected-Data.html#Analyze-Collected-Data" rel="next" title="Analyze Collected Data">
  27. <link href="Starting-and-Stopping-Trace-Experiments.html#Starting-and-Stopping-Trace-Experiments" rel="previous" title="Starting and Stopping Trace Experiments">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="Tracepoint-Restrictions"></a>
  59. <div class="header">
  60. <p>
  61. Previous: <a href="Starting-and-Stopping-Trace-Experiments.html#Starting-and-Stopping-Trace-Experiments" accesskey="p" rel="previous">Starting and Stopping Trace Experiments</a>, Up: <a href="Set-Tracepoints.html#Set-Tracepoints" accesskey="u" rel="up">Set Tracepoints</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>
  62. </div>
  63. <hr>
  64. <a name="Tracepoint-Restrictions-1"></a>
  65. <h4 class="subsection">13.1.10 Tracepoint Restrictions</h4>
  66. <a name="index-tracepoint-restrictions"></a>
  67. <p>There are a number of restrictions on the use of tracepoints. As
  68. described above, tracepoint data gathering occurs on the target
  69. without interaction from <small>GDB</small>. Thus the full capabilities of
  70. the debugger are not available during data gathering, and then at data
  71. examination time, you will be limited by only having what was
  72. collected. The following items describe some common problems, but it
  73. is not exhaustive, and you may run into additional difficulties not
  74. mentioned here.
  75. </p>
  76. <ul>
  77. <li> Tracepoint expressions are intended to gather objects (lvalues). Thus
  78. the full flexibility of GDB&rsquo;s expression evaluator is not available.
  79. You cannot call functions, cast objects to aggregate types, access
  80. convenience variables or modify values (except by assignment to trace
  81. state variables). Some language features may implicitly call
  82. functions (for instance Objective-C fields with accessors), and therefore
  83. cannot be collected either.
  84. </li><li> Collection of local variables, either individually or in bulk with
  85. <code>$locals</code> or <code>$args</code>, during <code>while-stepping</code> may
  86. behave erratically. The stepping action may enter a new scope (for
  87. instance by stepping into a function), or the location of the variable
  88. may change (for instance it is loaded into a register). The
  89. tracepoint data recorded uses the location information for the
  90. variables that is correct for the tracepoint location. When the
  91. tracepoint is created, it is not possible, in general, to determine
  92. where the steps of a <code>while-stepping</code> sequence will advance the
  93. program&mdash;particularly if a conditional branch is stepped.
  94. </li><li> Collection of an incompletely-initialized or partially-destroyed object
  95. may result in something that <small>GDB</small> cannot display, or displays
  96. in a misleading way.
  97. </li><li> When <small>GDB</small> displays a pointer to character it automatically
  98. dereferences the pointer to also display characters of the string
  99. being pointed to. However, collecting the pointer during tracing does
  100. not automatically collect the string. You need to explicitly
  101. dereference the pointer and provide size information if you want to
  102. collect not only the pointer, but the memory pointed to. For example,
  103. <code>*ptr@50</code> can be used to collect the 50 element array pointed to
  104. by <code>ptr</code>.
  105. </li><li> It is not possible to collect a complete stack backtrace at a
  106. tracepoint. Instead, you may collect the registers and a few hundred
  107. bytes from the stack pointer with something like <code>*(unsigned char *)$esp@300</code>
  108. (adjust to use the name of the actual stack pointer register on your
  109. target architecture, and the amount of stack you wish to capture).
  110. Then the <code>backtrace</code> command will show a partial backtrace when
  111. using a trace frame. The number of stack frames that can be examined
  112. depends on the sizes of the frames in the collected stack. Note that
  113. if you ask for a block so large that it goes past the bottom of the
  114. stack, the target agent may report an error trying to read from an
  115. invalid address.
  116. </li><li> If you do not collect registers at a tracepoint, <small>GDB</small> can
  117. infer that the value of <code>$pc</code> must be the same as the address of
  118. the tracepoint and use that when you are looking at a trace frame
  119. for that tracepoint. However, this cannot work if the tracepoint has
  120. multiple locations (for instance if it was set in a function that was
  121. inlined), or if it has a <code>while-stepping</code> loop. In those cases
  122. <small>GDB</small> will warn you that it can&rsquo;t infer <code>$pc</code>, and default
  123. it to zero.
  124. </li></ul>
  125. <hr>
  126. <div class="header">
  127. <p>
  128. Previous: <a href="Starting-and-Stopping-Trace-Experiments.html#Starting-and-Stopping-Trace-Experiments" accesskey="p" rel="previous">Starting and Stopping Trace Experiments</a>, Up: <a href="Set-Tracepoints.html#Set-Tracepoints" accesskey="u" rel="up">Set Tracepoints</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>
  129. </div>
  130. </body>
  131. </html>