<?xml version="1.0" encoding="ANSI_X3.4-1968" 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=ANSI_X3.4-1968" /><title>Chapter 4. Connecting gdb</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Using kgdb and the kgdb Internals" /><link rel="up" href="index.html" title="Using kgdb and the kgdb Internals" /><link rel="prev" href="ch03s03.html" title="Kernel parameter: kgdbcon" /><link rel="next" href="ch05.html" title="Chapter 5. kgdb Test Suite" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Connecting gdb</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch05.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 4. Connecting gdb"><div class="titlepage"><div><div><h2 class="title"><a id="ConnectingGDB"></a>Chapter 4. Connecting gdb</h2></div></div></div><p> If you are using kgdboc, you need to have used kgdbwait as a boot argument, issued a sysrq-g, or the system you are going to debug has already taken an exception and is waiting for the debugger to attach before you can connect gdb. </p><p> If you are not using different kgdb I/O driver other than kgdboc, you should be able to connect and the target will automatically respond. </p><p> Example (using a serial port): </p><pre class="programlisting"> % gdb ./vmlinux (gdb) set remotebaud 115200 (gdb) target remote /dev/ttyS0 </pre><p> Example (kgdb to a terminal server on tcp port 2012): </p><pre class="programlisting"> % gdb ./vmlinux (gdb) target remote 192.168.2.2:2012 </pre><p> Once connected, you can debug a kernel the way you would debug an application program. </p><p> If you are having problems connecting or something is going seriously wrong while debugging, it will most often be the case that you want to enable gdb to be verbose about its target communications. You do this prior to issuing the <code class="constant">target remote</code> command by typing in: <code class="constant">set debug remote 1</code> </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch05.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"> Chapter 5. kgdb Test Suite</td></tr></table></div></body></html>