• 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-2011.09/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, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
141998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
15Free Software Foundation, Inc.
16
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.3 or
19any later version published by the Free Software Foundation; with the
20Invariant Sections being ``Free Software'' and ``Free Software Needs
21Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
22and with the Back-Cover Texts as in (a) below.
23
24(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
25this GNU Manual.  Buying copies from GNU Press supports the FSF in
26developing GNU and promoting software freedom.''-->
27<meta http-equiv="Content-Style-Type" content="text/css">
28<style type="text/css"><!--
29  pre.display { font-family:inherit }
30  pre.format  { font-family:inherit }
31  pre.smalldisplay { font-family:inherit; font-size:smaller }
32  pre.smallformat  { font-family:inherit; font-size:smaller }
33  pre.smallexample { font-size:smaller }
34  pre.smalllisp    { font-size:smaller }
35  span.sc    { font-variant:small-caps }
36  span.roman { font-family:serif; font-weight:normal; } 
37  span.sansserif { font-family:sans-serif; font-weight:normal; } 
38--></style>
39<link rel="stylesheet" type="text/css" href="../cs.css">
40</head>
41<body>
42<div class="node">
43<a name="Tracepoint-Conditions"></a>
44<p>
45Next:&nbsp;<a rel="next" accesskey="n" href="Trace-State-Variables.html#Trace-State-Variables">Trace State Variables</a>,
46Previous:&nbsp;<a rel="previous" accesskey="p" href="Tracepoint-Passcounts.html#Tracepoint-Passcounts">Tracepoint Passcounts</a>,
47Up:&nbsp;<a rel="up" accesskey="u" href="Set-Tracepoints.html#Set-Tracepoints">Set Tracepoints</a>
48<hr>
49</div>
50
51<h4 class="subsection">13.1.4 Tracepoint Conditions</h4>
52
53<p><a name="index-conditional-tracepoints-704"></a><a name="index-tracepoint-conditions-705"></a>
54The simplest sort of tracepoint collects data every time your program
55reaches a specified place.  You can also specify a <dfn>condition</dfn> for
56a tracepoint.  A condition is just a Boolean expression in your
57programming language (see <a href="Expressions.html#Expressions">Expressions</a>).  A
58tracepoint with a condition evaluates the expression each time your
59program reaches it, and data collection happens only if the condition
60is true.
61
62   <p>Tracepoint conditions can be specified when a tracepoint is set, by
63using &lsquo;<samp><span class="samp">if</span></samp>&rsquo; in the arguments to the <code>trace</code> command. 
64See <a href="Create-and-Delete-Tracepoints.html#Create-and-Delete-Tracepoints">Setting Tracepoints</a>.  They can
65also be set or changed at any time with the <code>condition</code> command,
66just as with breakpoints.
67
68   <p>Unlike breakpoint conditions, <span class="sc">gdb</span> does not actually evaluate
69the conditional expression itself.  Instead, <span class="sc">gdb</span> encodes the
70expression into an agent expression (see <a href="Agent-Expressions.html#Agent-Expressions">Agent Expressions</a>
71suitable for execution on the target, independently of <span class="sc">gdb</span>. 
72Global variables become raw memory locations, locals become stack
73accesses, and so forth.
74
75   <p>For instance, suppose you have a function that is usually called
76frequently, but should not be called after an error has occurred.  You
77could use the following tracepoint command to collect data about calls
78of that function that happen while the error code is propagating
79through the program; an unconditional tracepoint could end up
80collecting thousands of useless trace frames that you would have to
81search through.
82
83<pre class="smallexample">     (gdb) <kbd>trace normal_operation if errcode &gt; 0</kbd>
84</pre>
85   </body></html>
86
87