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