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. -->
12 >Debugging Techniques</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos User Guide"
20 HREF="ecos-user-guide.html"><LINK
22 TITLE="eCos Programming Concepts and Techniques"
23 HREF="ecos-programming-concepts-and-techniques.html"><LINK
25 TITLE="Compiling a C++ Application"
26 HREF="compiling-cpp-app.html"><LINK
28 TITLE="Kernel Instrumentation"
29 HREF="kernel-instrumentation.html"></HEAD
40 SUMMARY="Header navigation table"
57 HREF="compiling-cpp-app.html"
71 HREF="kernel-instrumentation.html"
84 NAME="DEBUGGING-TECHNIQUES">Chapter 27. Debugging Techniques</H1
94 HREF="debugging-techniques.html#TRACING"
99 HREF="kernel-instrumentation.html"
100 >Kernel Instrumentation</A
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
118 >’s infrastructure module provides a
125 > formalism, allowing the
126 kernel’s tracing macros to be configured in many useful
130 >’s kernel provides <I
134 > which also collect specific
135 (configurable) data about the system’s history and
142 NAME="TRACING">Tracing</H1
147 >’s tracing facilities you must first
148 configure your system to use <I
152 You should enable the Asserts and Tracing component
155 >CYGPKG_INFRA_DEBUG</TT
160 > component within it
163 >CYGDBG_USE_TRACING</TT
165 options can be enabled with the <SPAN
169 > or by editing the file
181 >You should then examine all the tracing-related options in
184 >Package: Infrastructure</I
192 >. One useful set of configuration options are: <TT
194 >CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS</TT
197 >CYGDBG_INFRA_DEBUG_TRACE_MESSAGE</TT
199 which are both enabled by default when tracing is enabled.</P
201 >The following “Hello world with tracing” 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
211 built with tracing enabled: </P
217 >Example 27-1. Hello world with tracing</B
227 >$ mips-tx39-elf-run --board=jmr3904 hello
229 ASSERT FAIL: <2>cyg_trac.h [ 623] Cyg_TraceFunction_Report_::set_exitvoid() exitvoid used in typed function
230 TRACE: <1>mlqueue.cxx [ 395] Cyg_ThreadQueue_Implementation::enqueue() {{enter
231 TRACE: <1>mlqueue.cxx [ 395] Cyg_ThreadQueue_Implementation::enqueue() }}RETURNING UNSET!
232 TRACE: <1>mlqueue.cxx [ 126] Cyg_Scheduler_Implementation::add_thread() }}RETURNING UNSET!
233 TRACE: <1>thread.cxx [ 654] Cyg_Thread::resume() }}return void
234 TRACE: <1>cstartup.cxx [ 160] cyg_iso_c_start() }}return void
235 TRACE: <1>startup.cxx [ 142] cyg_package_start() }}return void
236 TRACE: <1>startup.cxx [ 150] cyg_user_start() {{enter
237 TRACE: <1>startup.cxx [ 150] cyg_user_start() (((void)))
238 TRACE: <1>startup.cxx [ 153] cyg_user_start() 'This is the system default cyg_user_start()'
239 TRACE: <1>startup.cxx [ 157] cyg_user_start() }}return void
240 TRACE: <1>sched.cxx [ 212] Cyg_Scheduler::start() {{enter
241 TRACE: <1>mlqueue.cxx [ 102] Cyg_Scheduler_Implementation::schedule() {{enter
242 TRACE: <1>mlqueue.cxx [ 437] Cyg_ThreadQueue_Implementation::highpri() {{enter
243 TRACE: <1>mlqueue.cxx [ 437] Cyg_ThreadQueue_Implementation::highpri() }}RETURNING UNSET!
244 TRACE: <1>mlqueue.cxx [ 102] Cyg_Scheduler_Implementation::schedule() }}RETURNING UNSET!
245 TRACE: <2>intr.cxx [ 450] Cyg_Interrupt::enable_interrupts() {{enter
246 TRACE: <2>intr.cxx [ 450] Cyg_Interrupt::enable_interrupts() }}RETURNING UNSET!
247 TRACE: <2>thread.cxx [ 69] Cyg_HardwareThread::thread_entry() {{enter
248 TRACE: <2>cstartup.cxx [ 127] invoke_main() {{enter
249 TRACE: <2>cstartup.cxx [ 127] invoke_main() ((argument is ignored))
250 TRACE: <2>dummyxxmain.cxx [ 60] __main() {{enter
251 TRACE: <2>dummyxxmain.cxx [ 60] __main() (((void)))
252 TRACE: <2>dummyxxmain.cxx [ 63] __main() 'This is the system default __main()'
253 TRACE: <2>dummyxxmain.cxx [ 67] __main() }}return void
254 TRACE: <2>memcpy.c [ 112] _memcpy() {{enter
255 TRACE: <2>memcpy.c [ 112] _memcpy() ((dst=80002804, src=BFC14E58, n=19))
256 TRACE: <2>memcpy.c [ 164] _memcpy() }}returning 80002804
257 TRACE: <2>cstartup.cxx [ 137] invoke_main() 'main() has returned with code 0. Calling exit()'
258 TRACE: <2>exit.cxx [ 71] __libc_exit() {{enter
259 TRACE: <2>exit.cxx [ 71] __libc_exit() ((status=0 ))
260 TRACE: <2>atexit.cxx [ 84] cyg_libc_invoke_atexit_handlers() {{enter
261 TRACE: <2>atexit.cxx [ 84] cyg_libc_invoke_atexit_handlers() (((void)))
266 Current Thread: <null>
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
275 <null> 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
291 SUMMARY="Footer navigation table"
302 HREF="compiling-cpp-app.html"
311 HREF="ecos-user-guide.html"
320 HREF="kernel-instrumentation.html"
330 >Compiling a C++ Application</TD
336 HREF="ecos-programming-concepts-and-techniques.html"
344 >Kernel Instrumentation</TD