<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 4. Using kdb</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.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="kgdbcon.html" title="Kernel parameter: kgdbcon" /><link rel="next" href="quickKDBkeyboard.html" title="Quick start for kdb using a keyboard connected console" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Using kdb</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="kgdbcon.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="quickKDBkeyboard.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 4. Using kdb"><div class="titlepage"><div><div><h2 class="title"><a id="usingKDB"></a>Chapter 4. Using kdb</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><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>
  </p><div class="sect1" title="Quick start for kdb on a serial port"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="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>Boot kernel with arguments:
  </p><div class="itemizedlist"><ul class="itemizedlist" 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 booted; assuming you are using a serial port console:
  </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="constant">echo ttyS0 &gt; /sys/module/kgdboc/parameters/kgdboc</code></p></li></ul></div><p>
  </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" 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:
  </p><div class="itemizedlist"><ul class="itemizedlist" 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>
  </p></li><li class="listitem"><p>When you are done using kdb you need to consider rebooting the
  system or using the "go" command to resuming normal kernel
  execution.  If you have paused the kernel for a lengthy period of
  time, applications that rely on timely networking or anything to do
  with real wall clock time could be adversely affected, so you
  should take this into consideration when using the kernel
  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="kgdbcon.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="quickKDBkeyboard.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Kernel parameter: kgdbcon </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Quick start for kdb using a keyboard connected console</td></tr></table></div></body></html>
