Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2014 15:22:32 -0700
From:      Navdeep Parhar <nparhar@gmail.com>
To:        Nidal Khalil <nedmath@gmail.com>, freebsd-hackers@freebsd.org
Subject:   Re: Remote kernel debugging question
Message-ID:  <53CD92A8.5000201@gmail.com>
In-Reply-To: <CADoY-6j0d9pBn-TDoMf5gysE8QiGz42DCFGLDWASig-wqLiMbg@mail.gmail.com>
References:  <CADoY-6j0d9pBn-TDoMf5gysE8QiGz42DCFGLDWASig-wqLiMbg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 07/21/14 12:22, Nidal Khalil wrote:
> Hello All,
> I am somewhat new to BSD kernel but I am trying to debug a kernel module
> using remote debugging.
> I am using 9.2 RELEASE.
> I setup and compiled the kernel with the following:
> 
> makeoptions DEBUG=-g
> options          KDB
> options          KDB_TRACE
> options          DDB_CTF
> options          DDB
> options          GDB
> options          ALT_BREAK_TO_DEBUGGER
> 
> I setup the uart for serial1 flags to 0x90 and I can read and write to the
> serial from either machine
> Both machines have the same kernel booted.
> I can enter ddb but I can not launch gdb
> The remote GDB backend could not be selected.
> sysctl -a | grep debug.kdb
> 
> debug.kdb.available: ddb
> Is that correct or it should be:
> debug.kdb.available: ddb gdb

The latter.

> How do I enable gdb backend. I appreciate the help.

All this on a recent HEAD.  If your problem is 9.2 specific then this
may not help, but at least we can compare notes.  You did say you set
flags to 0x90 for your serial port but it's not clear how.  I have this
in /boot/loader.conf:
hint.uart.0.flags="0x90"

When the system boots I see this right around when loader hands off to
the kernel.

GDB: debug ports: uart
GDB: current port: uart
KDB: debugger backends: ddb gdb
KDB: current backend: ddb
Copyright (c) 1992-2014 The FreeBSD Project.
...

After the system boots I see both ddb and gdb in the available debug
backends and all is well.

# sysctl debug.kdb.available
debug.kdb.available: ddb gdb
# sysctl debug.kdb.current
debug.kdb.current: ddb
# sysctl debug.kdb.current=gdb
debug.kdb.current: ddb -> gdb
# sysctl debug.kdb.current
debug.kdb.current: gdb

Regards,
Navdeep



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53CD92A8.5000201>