1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter&#160;4.&#160;Using kdb</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Using kgdb, kdb and the kernel debugger internals"><link rel="up" href="index.html" title="Using kgdb, kdb and the kernel debugger internals"><link rel="prev" href="kgdbreboot.html" title="Run time parameter: kgdbreboot"><link rel="next" href="quickKDBkeyboard.html" title="Quick start for kdb using a keyboard connected console"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;4.&#160;Using kdb</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="kgdbreboot.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="quickKDBkeyboard.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="usingKDB"></a>Chapter&#160;4.&#160;Using kdb</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="usingKDB.html#quickKDBserial">Quick start for kdb on a serial port</a></span></dt><dt><span class="sect1"><a href="quickKDBkeyboard.html">Quick start for kdb using a keyboard connected console</a></span></dt></dl></div><p>
2  </p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="quickKDBserial"></a>Quick start for kdb on a serial port</h2></div></div></div><p>This is a quick example of how to use kdb.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Configure kgdboc at boot using kernel parameters:
3  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="constant">console=ttyS0,115200 kgdboc=ttyS0,115200</code></p></li></ul></div><p>OR</p><p>Configure kgdboc after the kernel has booted; assuming you are using a serial port console:
4  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="constant">echo ttyS0 &gt; /sys/module/kgdboc/parameters/kgdboc</code></p></li></ul></div><p>
5  </p></li><li class="listitem"><p>Enter the kernel debugger manually or by waiting for an oops or fault.  There are several ways you can enter the kernel debugger manually; all involve using the sysrq-g, which means you must have enabled CONFIG_MAGIC_SYSRQ=y in your kernel config.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>When logged in as root or with a super user session you can run:</p><p><code class="constant">echo g &gt; /proc/sysrq-trigger</code></p></li><li class="listitem"><p>Example using minicom 2.2</p><p>Press: <code class="constant">Control-a</code></p><p>Press: <code class="constant">f</code></p><p>Press: <code class="constant">g</code></p></li><li class="listitem"><p>When you have telneted to a terminal server that supports sending a remote break</p><p>Press: <code class="constant">Control-]</code></p><p>Type in:<code class="constant">send break</code></p><p>Press: <code class="constant">Enter</code></p><p>Press: <code class="constant">g</code></p></li></ul></div></li><li class="listitem"><p>From the kdb prompt you can run the "help" command to see a complete list of the commands that are available.</p><p>Some useful commands in kdb include:
6  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>lsmod  -- Shows where kernel modules are loaded</p></li><li class="listitem"><p>ps -- Displays only the active processes</p></li><li class="listitem"><p>ps A -- Shows all the processes</p></li><li class="listitem"><p>summary -- Shows kernel version info and memory usage</p></li><li class="listitem"><p>bt -- Get a backtrace of the current process using dump_stack()</p></li><li class="listitem"><p>dmesg -- View the kernel syslog buffer</p></li><li class="listitem"><p>go -- Continue the system</p></li></ul></div><p>
7  </p></li><li class="listitem"><p>When you are done using kdb you need to consider rebooting the
8  system or using the "go" command to resuming normal kernel
9  execution.  If you have paused the kernel for a lengthy period of
10  time, applications that rely on timely networking or anything to do
11  with real wall clock time could be adversely affected, so you
12  should take this into consideration when using the kernel
13  debugger.</p></li></ol></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="kgdbreboot.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="quickKDBkeyboard.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Run time parameter: kgdbreboot&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Quick start for kdb using a keyboard connected console</td></tr></table></div></body></html>
14