version 1.1.1.1, 2008/06/03 10:38:42 |
version 1.1.1.1.2.1, 2008/08/13 17:12:25 |
|
|
<td id="logo">
|
<td id="logo">
|
<a href="http://prex.sourceforge.net/">
|
<a href="http://prex.sourceforge.net/">
|
<img alt="Prex logo" src="../img/logo.gif" border="0"
|
<img alt="Prex logo" src="../img/logo.gif" border="0"
|
style="width: 281px; height: 56px;"></a>
|
style="width: 250px; height: 54px;"></a>
|
</td>
|
</td>
|
<td id="brief" align="right" valign="bottom">
|
<td id="brief" align="right" valign="bottom">
|
An Open Source, Royalty-free,<br>
|
An Open Source, Royalty-free,<br>
|
|
|
<tr><td class="pad" colspan="2" style="vertical-align: top;"></td></tr>
|
<tr><td class="pad" colspan="2" style="vertical-align: top;"></td></tr>
|
|
|
<tr>
|
<tr>
|
<td id="main" style="vertical-align: top;">
|
<td id="doc" style="vertical-align: top;">
|
<h1>Prex Kernel Debugging Tips and Tricks</h1>
|
<h1>Prex Kernel Debugging Tips and Tricks</h1>
|
|
|
<i>Version 1.0, 2005/09/05</i><br>
|
<i>Version 1.0, 2005/09/05</i><br>
|
|
|
The debugging version will have the following extra functions
|
The debugging version will have the following extra functions
|
compared with the release version.
|
compared with the release version.
|
<ul>
|
<ul>
|
<li>printk() to output the debug message.</li>
|
<li>printf() to output the debug message.</li>
|
<li>panic() log for the fatal error.</li>
|
<li>panic() log for the fatal error.</li>
|
<li>ASSERT() for the assertion check.</li>
|
<li>ASSERT() for the assertion check.</li>
|
<li>Kernel function trace.</li>
|
<li>Kernel function trace.</li>
|
|
|
|
|
<h2 id="print">Kernel Print</h2>
|
<h2 id="print">Kernel Print</h2>
|
<p>
|
<p>
|
The most powerful tool for kernel debugging is printk(). You can check the
|
The most powerful tool for kernel debugging is printf(). You can check the
|
code path, or get the data value by putting the printk() anywhere in
|
code path, or get the data value by putting the printf() anywhere in
|
the kernel code.
|
the kernel code.
|
</p>
|
</p>
|
<p>
|
<p>
|
printk() is the subset of printf() in standard C library. You can use
|
This is the subset of printf() in standard C library. You can use
|
only following identifiers for the output string.
|
only following identifiers for the output string.
|
</p>
|
</p>
|
<ul>
|
<ul>
|
|
|
464 panic("Failed to allocate idle stack");
|
464 panic("Failed to allocate idle stack");
|
465 memset(stk, 0, KSTACK_SIZE);
|
465 memset(stk, 0, KSTACK_SIZE);
|
466 idle_thread.kstack = stk;
|
466 idle_thread.kstack = stk;
|
467 printk("kernel stack size=%d\n", KSTACK_SIZE);
|
467 printf("kernel stack size=%d\n", KSTACK_SIZE);
|
468
|
468
|
469 context_init(&idle_thread.context, stk + KSTACK_SIZE);
|
469 context_init(&idle_thread.context, stk + KSTACK_SIZE);
|
470 list_insert(&kern_task.threads, &idle_thread.task_link);
|
470 list_insert(&kern_task.threads, &idle_thread.task_link);
|