]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/user-guide/debugging-techniques.html
Initial revision
[karo-tx-redboot.git] / doc / html / user-guide / debugging-techniques.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >Debugging Techniques</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos User Guide"
20 HREF="ecos-user-guide.html"><LINK
21 REL="UP"
22 TITLE="eCos Programming Concepts and Techniques"
23 HREF="ecos-programming-concepts-and-techniques.html"><LINK
24 REL="PREVIOUS"
25 TITLE="Compiling a C++ Application"
26 HREF="compiling-cpp-app.html"><LINK
27 REL="NEXT"
28 TITLE="Kernel Instrumentation"
29 HREF="kernel-instrumentation.html"></HEAD
30 ><BODY
31 CLASS="CHAPTER"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos User Guide</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="compiling-cpp-app.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 ></TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="kernel-instrumentation.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="CHAPTER"
82 ><H1
83 ><A
84 NAME="DEBUGGING-TECHNIQUES">Chapter 27. Debugging Techniques</H1
85 ><DIV
86 CLASS="TOC"
87 ><DL
88 ><DT
89 ><B
90 >Table of Contents</B
91 ></DT
92 ><DT
93 ><A
94 HREF="debugging-techniques.html#TRACING"
95 >Tracing</A
96 ></DT
97 ><DT
98 ><A
99 HREF="kernel-instrumentation.html"
100 >Kernel Instrumentation</A
101 ></DT
102 ></DL
103 ></DIV
104 ><P
105 ><SPAN
106 CLASS="PRODUCTNAME"
107 >eCos</SPAN
108 > applications and components can be debugged in
109         traditional ways, with printing statements and debugger
110         single-stepping, but there are situations in which these
111         techniques cannot be used. One example of this is when a
112         program is getting data at a high rate from a real-time
113         source, and cannot be slowed down or interrupted.</P
114 ><P
115 ><SPAN
116 CLASS="PRODUCTNAME"
117 >eCos</SPAN
118 >&#8217;s infrastructure module provides a
119         <SPAN
120 CLASS="emphasis"
121 ><I
122 CLASS="EMPHASIS"
123 >tracing</I
124 ></SPAN
125 > formalism, allowing the
126         kernel&#8217;s tracing macros to be configured in many useful
127         ways. <SPAN
128 CLASS="PRODUCTNAME"
129 >eCos</SPAN
130 >&#8217;s kernel provides <I
131 CLASS="FIRSTTERM"
132 >instrumentation
133           buffers</I
134 > which also collect specific
135         (configurable) data about the system&#8217;s history and
136         performance.</P
137 ><DIV
138 CLASS="SECT1"
139 ><H1
140 CLASS="SECT1"
141 ><A
142 NAME="TRACING">Tracing</H1
143 ><P
144 >To use <SPAN
145 CLASS="PRODUCTNAME"
146 >eCos</SPAN
147 >&#8217;s tracing facilities you must first
148           configure your system to use <I
149 CLASS="FIRSTTERM"
150 >tracing</I
151 >.
152           You should enable the Asserts and Tracing component
153           (<TT
154 CLASS="OPTION"
155 >CYGPKG_INFRA_DEBUG</TT
156 >) and the
157           <TT
158 CLASS="OPTION"
159 >Use tracing</TT
160 > component within it
161           (<TT
162 CLASS="OPTION"
163 >CYGDBG_USE_TRACING</TT
164 >). These
165           options can be enabled with the <SPAN
166 CLASS="APPLICATION"
167 >Configuration
168             Tool</SPAN
169 > or by editing the file
170           <TT
171 CLASS="FILENAME"
172 ><TT
173 CLASS="REPLACEABLE"
174 ><I
175 >BUILD_DIR</I
176 ></TT
177 >/pkgconf/infra.h 
178           </TT
179 > manually.</P
180 ><P
181 >You should then examine all the tracing-related options in
182 the <I
183 CLASS="CITETITLE"
184 >Package: Infrastructure</I
185 > chapter of the <I
186 CLASS="CITETITLE"
187 ><SPAN
188 CLASS="PRODUCTNAME"
189 >eCos</SPAN
190 > Reference
191 Manual</I
192 >. One useful set of configuration options are: <TT
193 CLASS="LITERAL"
194 >CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS</TT
195 > and <TT
196 CLASS="LITERAL"
197 >CYGDBG_INFRA_DEBUG_TRACE_MESSAGE</TT
198 >,
199 which are both enabled by default when tracing is enabled.</P
200 ><P
201 >The following &#8220;Hello world with tracing&#8221; shows
202 the output from running the hello world program (from <A
203 HREF="building-and-running-sample-appliations.html#ECOS-HELLO-WORLD"
204 >the Section called <I
205 ><SPAN
206 CLASS="PRODUCTNAME"
207 >eCos</SPAN
208 > Hello World</I
209 > in Chapter 13</A
210 >) that was
211 built with tracing enabled: </P
212 ><DIV
213 CLASS="EXAMPLE"
214 ><A
215 NAME="AEN2289"><P
216 ><B
217 >Example 27-1. Hello world with tracing</B
218 ></P
219 ><TABLE
220 BORDER="5"
221 BGCOLOR="#E0E0F0"
222 WIDTH="70%"
223 ><TR
224 ><TD
225 ><PRE
226 CLASS="SCREEN"
227 >$ mips-tx39-elf-run --board=jmr3904  hello
228 Hello, eCos world!
229 ASSERT FAIL: &lt;2&gt;cyg_trac.h          [ 623] Cyg_TraceFunction_Report_::set_exitvoid()                                                            exitvoid used in typed function
230 TRACE: &lt;1&gt;mlqueue.cxx         [ 395] Cyg_ThreadQueue_Implementation::enqueue()                                                            {{enter
231 TRACE: &lt;1&gt;mlqueue.cxx         [ 395] Cyg_ThreadQueue_Implementation::enqueue()                                                            }}RETURNING UNSET!
232 TRACE: &lt;1&gt;mlqueue.cxx         [ 126] Cyg_Scheduler_Implementation::add_thread()                                                           }}RETURNING UNSET!
233 TRACE: &lt;1&gt;thread.cxx          [ 654] Cyg_Thread::resume()                                                                                 }}return void
234 TRACE: &lt;1&gt;cstartup.cxx        [ 160] cyg_iso_c_start()                                                                                    }}return void
235 TRACE: &lt;1&gt;startup.cxx         [ 142] cyg_package_start()                                                                                  }}return void
236 TRACE: &lt;1&gt;startup.cxx         [ 150] cyg_user_start()                                                                                     {{enter
237 TRACE: &lt;1&gt;startup.cxx         [ 150] cyg_user_start()                                                                                     (((void)))
238 TRACE: &lt;1&gt;startup.cxx         [ 153] cyg_user_start()                                                                                     'This is the system default cyg_user_start()'
239 TRACE: &lt;1&gt;startup.cxx         [ 157] cyg_user_start()                                                                                     }}return void
240 TRACE: &lt;1&gt;sched.cxx           [ 212] Cyg_Scheduler::start()                                                                               {{enter
241 TRACE: &lt;1&gt;mlqueue.cxx         [ 102] Cyg_Scheduler_Implementation::schedule()                                                             {{enter
242 TRACE: &lt;1&gt;mlqueue.cxx         [ 437] Cyg_ThreadQueue_Implementation::highpri()                                                            {{enter
243 TRACE: &lt;1&gt;mlqueue.cxx         [ 437] Cyg_ThreadQueue_Implementation::highpri()                                                            }}RETURNING UNSET!
244 TRACE: &lt;1&gt;mlqueue.cxx         [ 102] Cyg_Scheduler_Implementation::schedule()                                                             }}RETURNING UNSET!
245 TRACE: &lt;2&gt;intr.cxx            [ 450] Cyg_Interrupt::enable_interrupts()                                                                   {{enter
246 TRACE: &lt;2&gt;intr.cxx            [ 450] Cyg_Interrupt::enable_interrupts()                                                                   }}RETURNING UNSET!
247 TRACE: &lt;2&gt;thread.cxx          [  69] Cyg_HardwareThread::thread_entry()                                                                   {{enter
248 TRACE: &lt;2&gt;cstartup.cxx        [ 127] invoke_main()                                                                                        {{enter
249 TRACE: &lt;2&gt;cstartup.cxx        [ 127] invoke_main()                                                                                        ((argument is ignored))
250 TRACE: &lt;2&gt;dummyxxmain.cxx     [  60] __main()                                                                                             {{enter
251 TRACE: &lt;2&gt;dummyxxmain.cxx     [  60] __main()                                                                                             (((void)))
252 TRACE: &lt;2&gt;dummyxxmain.cxx     [  63] __main()                                                                                             'This is the system default __main()'
253 TRACE: &lt;2&gt;dummyxxmain.cxx     [  67] __main()                                                                                             }}return void
254 TRACE: &lt;2&gt;memcpy.c            [ 112] _memcpy()                                                                                            {{enter
255 TRACE: &lt;2&gt;memcpy.c            [ 112] _memcpy()                                                                                            ((dst=80002804, src=BFC14E58, n=19))
256 TRACE: &lt;2&gt;memcpy.c            [ 164] _memcpy()                                                                                            }}returning 80002804
257 TRACE: &lt;2&gt;cstartup.cxx        [ 137] invoke_main()                                                                                        'main() has returned with code 0. Calling exit()'
258 TRACE: &lt;2&gt;exit.cxx            [  71] __libc_exit()                                                                                        {{enter
259 TRACE: &lt;2&gt;exit.cxx            [  71] __libc_exit()                                                                                        ((status=0 ))
260 TRACE: &lt;2&gt;atexit.cxx          [  84] cyg_libc_invoke_atexit_handlers()                                                                    {{enter
261 TRACE: &lt;2&gt;atexit.cxx          [  84] cyg_libc_invoke_atexit_handlers()                                                                      (((void)))
262
263 Scheduler:
264
265 Lock:                0
266 Current Thread:      &lt;null&gt;
267
268 Threads:
269
270 Idle Thread          pri =  31 state = R      id =   1
271                      stack base = 800021F0 ptr = 80002510 size = 00000400
272                      sleep reason NONE     wake reason NONE    
273                      queue = 80000C54      wait info = 00000000
274
275 &lt;null&gt;               pri =   0 state = R      id =   2
276                      stack base = 80002A48 ptr = 8000A968 size = 00008000
277                      sleep reason NONE     wake reason NONE    
278                      queue = 80000BD8      wait info = 00000000
279           </PRE
280 ></TD
281 ></TR
282 ></TABLE
283 ></DIV
284 ></DIV
285 ></DIV
286 ><DIV
287 CLASS="NAVFOOTER"
288 ><HR
289 ALIGN="LEFT"
290 WIDTH="100%"><TABLE
291 SUMMARY="Footer navigation table"
292 WIDTH="100%"
293 BORDER="0"
294 CELLPADDING="0"
295 CELLSPACING="0"
296 ><TR
297 ><TD
298 WIDTH="33%"
299 ALIGN="left"
300 VALIGN="top"
301 ><A
302 HREF="compiling-cpp-app.html"
303 ACCESSKEY="P"
304 >Prev</A
305 ></TD
306 ><TD
307 WIDTH="34%"
308 ALIGN="center"
309 VALIGN="top"
310 ><A
311 HREF="ecos-user-guide.html"
312 ACCESSKEY="H"
313 >Home</A
314 ></TD
315 ><TD
316 WIDTH="33%"
317 ALIGN="right"
318 VALIGN="top"
319 ><A
320 HREF="kernel-instrumentation.html"
321 ACCESSKEY="N"
322 >Next</A
323 ></TD
324 ></TR
325 ><TR
326 ><TD
327 WIDTH="33%"
328 ALIGN="left"
329 VALIGN="top"
330 >Compiling a C++ Application</TD
331 ><TD
332 WIDTH="34%"
333 ALIGN="center"
334 VALIGN="top"
335 ><A
336 HREF="ecos-programming-concepts-and-techniques.html"
337 ACCESSKEY="U"
338 >Up</A
339 ></TD
340 ><TD
341 WIDTH="33%"
342 ALIGN="right"
343 VALIGN="top"
344 >Kernel Instrumentation</TD
345 ></TR
346 ></TABLE
347 ></DIV
348 ></BODY
349 ></HTML
350 >