• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gdb/
1<html lang="en">
2<head>
3<title>Tracepoint Conditions - Debugging with GDB</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Debugging with GDB">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Set-Tracepoints.html#Set-Tracepoints" title="Set Tracepoints">
9<link rel="prev" href="Tracepoint-Passcounts.html#Tracepoint-Passcounts" title="Tracepoint Passcounts">
10<link rel="next" href="Trace-State-Variables.html#Trace-State-Variables" title="Trace State Variables">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Free Software'' and ``Free Software Needs
19Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
20and with the Back-Cover Texts as in (a) below.
21
22(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
23this GNU Manual.  Buying copies from GNU Press supports the FSF in
24developing GNU and promoting software freedom.''
25-->
26<meta http-equiv="Content-Style-Type" content="text/css">
27<style type="text/css"><!--
28  pre.display { font-family:inherit }
29  pre.format  { font-family:inherit }
30  pre.smalldisplay { font-family:inherit; font-size:smaller }
31  pre.smallformat  { font-family:inherit; font-size:smaller }
32  pre.smallexample { font-size:smaller }
33  pre.smalllisp    { font-size:smaller }
34  span.sc    { font-variant:small-caps }
35  span.roman { font-family:serif; font-weight:normal; } 
36  span.sansserif { font-family:sans-serif; font-weight:normal; } 
37--></style>
38<link rel="stylesheet" type="text/css" href="../cs.css">
39</head>
40<body>
41<div class="node">
42<a name="Tracepoint-Conditions"></a>
43<p>
44Next:&nbsp;<a rel="next" accesskey="n" href="Trace-State-Variables.html#Trace-State-Variables">Trace State Variables</a>,
45Previous:&nbsp;<a rel="previous" accesskey="p" href="Tracepoint-Passcounts.html#Tracepoint-Passcounts">Tracepoint Passcounts</a>,
46Up:&nbsp;<a rel="up" accesskey="u" href="Set-Tracepoints.html#Set-Tracepoints">Set Tracepoints</a>
47<hr>
48</div>
49
50<h4 class="subsection">13.1.4 Tracepoint Conditions</h4>
51
52<p><a name="index-conditional-tracepoints-781"></a><a name="index-tracepoint-conditions-782"></a>
53The simplest sort of tracepoint collects data every time your program
54reaches a specified place.  You can also specify a <dfn>condition</dfn> for
55a tracepoint.  A condition is just a Boolean expression in your
56programming language (see <a href="Expressions.html#Expressions">Expressions</a>).  A
57tracepoint with a condition evaluates the expression each time your
58program reaches it, and data collection happens only if the condition
59is true.
60
61   <p>Tracepoint conditions can be specified when a tracepoint is set, by
62using &lsquo;<samp><span class="samp">if</span></samp>&rsquo; in the arguments to the <code>trace</code> command. 
63See <a href="Create-and-Delete-Tracepoints.html#Create-and-Delete-Tracepoints">Setting Tracepoints</a>.  They can
64also be set or changed at any time with the <code>condition</code> command,
65just as with breakpoints.
66
67   <p>Unlike breakpoint conditions, <span class="sc">gdb</span> does not actually evaluate
68the conditional expression itself.  Instead, <span class="sc">gdb</span> encodes the
69expression into an agent expression (see <a href="Agent-Expressions.html#Agent-Expressions">Agent Expressions</a>)
70suitable for execution on the target, independently of <span class="sc">gdb</span>. 
71Global variables become raw memory locations, locals become stack
72accesses, and so forth.
73
74   <p>For instance, suppose you have a function that is usually called
75frequently, but should not be called after an error has occurred.  You
76could use the following tracepoint command to collect data about calls
77of that function that happen while the error code is propagating
78through the program; an unconditional tracepoint could end up
79collecting thousands of useless trace frames that you would have to
80search through.
81
82<pre class="smallexample">     (gdb) <kbd>trace normal_operation if errcode &gt; 0</kbd>
83</pre>
84   </body></html>
85
86