Attempting to use the kernel debugger over the serial port not working (well)

Patrick Mahan PMahan at adaranet.com
Fri Sep 24 21:02:31 UTC 2010


All,

Cannot seem to find anything on the net to collaborate my experience
with remote KGDB over a serial port.

Here is my setup -

----------------+--------------------------+-------------------------+-------------------
                |                          |                         |
               bce0                      eth1                       bce0
                |                          |                         |
    +-----------+--------------+   +-------+--------+    +-----------+-----------+
    |   HP Proliant GL360 G5   |   | Cyclades ACS32 |    | HP Proliant GL360 G5  |
    +-------------------+------+   +----+-----------+    +-----------------------+
                        |               |
                  ttyu0(uart0)        port 28
                        |               |
                        +---------------+

The Cyclades is a 32 port terminal server that has serial port 28 connected
to the DB9 locate on the back of the HP server.  I am running KGDB inside
of an emacs session on the Sony Vaio.

The HP's are running in 64-bit (amd64) FreeBSD 8.0.

The uart0 on the target is configured as (from dmesg.boot):

uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x90 on acpi0
uart0: [FILTER]
uart0: console (9600,n,8,1)

The Cyclades port is configured the same.

My kernel is built with the following options:

options KDB
options DDB
options GDB

The kernel is built with -O2 -g

In /boot/loader.conf I have the following lines:

console="comconsole vidconsole"
comconsole_speed=9600
hint.uart.0.flags="0x90"

I invoke the kernel debugger on the target using:

  'sysctl debug.kdb.enter=1'

Which gets me to the DB> prompt where I enter the following:

DB>gdb
Step to enter the gdb debugger
DB>s

I am invoking KGDB inside of emacs on the build server in the 'obj' tree
where the kernel build is located.

    kgdb -fullname kernel.debug

Once I have the gdb prompt, I enter the following target command:

   target remote 10.10.29.111:7028

Where 10.10.29.111 is the address of the Cyclades and port 7028 connects
me to serial port 28 on the Cyclades.

This brings up the kernel with the break point.  I then set my break
point(s) and enter 'c' to continue.

Sometimes the break points fire, sometimes they don't.  However, in some
indeterminant time (seconds) I start seeing the following on the
Video console (not the serial one).

Fatal double fault
rip = 0xffffffff8055bdc4
rsp = 0xffffff8078405000
rbp = 0xffffff8078405000
cpuid = 1; apic id = 01
panic: double fault
cpuid = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
kdb_backtrace() at kdb_backtrace+0x32
mi_switch() at mi_switch+0x70
sched_bind() at sched_bind+0x60
boot() at boot+0x45
panic() at panic+0x1f2
dblfault_handler() at dblfault_handler+0xab
Xdblfault() at Xdblfault+0xac
--- trap 0x17, rip = 0xffffffff8055bdc4, rsp = 0xffffff8000017ff0, rbp = 0xffffff8078405000 ---
_thread_lock_flags() at _thread_lock_flags+0x4
critical_exit() at critical_exit+0x5d
spinlock_exit() at spinlock_exit+0x17
mi_switch() at mi_switch+0x6b

Then it repeats over and over again, the box becomes unresponsive and I am unable
to proceed.

My googling turned up this issue only in relation to lock order reversals, but I am not
seeing that issue here and I don't have the kernel compiled with 'options WITNESS'.

Any pointers would be appreciated.

Thanks,

Patrick


More information about the freebsd-questions mailing list