remote kernel debugging

Bernd Walter ticso at cicely7.cicely.de
Sun Mar 22 01:11:28 UTC 2015


On Sat, Mar 21, 2015 at 09:40:32PM +0100, Manuel Stühn wrote:
> Hi,
> is it possible to debug the freebsd-kernel remotely on BBB? I'm 
> following the developers-handbook, but I do not get it working:
> 
> root at beaglebone:~ # sysctl debug.kdb.enter=1
> debug.kdb.enter: 0KDB: enter: sysctl debug.kdb.enter
> [ thread pid 655 tid 100087 ]
> Stopped at      $d.11:  ldrb    r15, [r15, r15, ror r15]!
> db> gdb
> The remote GDB backend could not be selected.
> 
> root at beaglebone:~ # dmesg
> GDB: no debug ports present
> KDB: debugger backends: ddb
> KDB: current backend: ddb
> Copyright (c) 1992-2015 The FreeBSD Project.
> [...]
> 
> 
> On the remote host:
> 
> /usr/obj/usr/src/sys/BBB # kgdb -v -r /dev/cuaU0 -b 115200 kernel.debug
> kgdb: device file: /dev/cuaU0
> kgdb: kernel image: kernel.debug
> GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain 
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "armv6hf-marcel-freebsd"...Switching to 
> remote protocol
> Couldn't establish connection to remote target
> Malformed response to offset query, qOffsets
> 
> 
> Kernel-Configuration BBB:
> 
> # Debugging for use in -current
> makeoptions     DEBUG=-g
> options         BREAK_TO_DEBUGGER
> #options        VERBOSE_SYSINIT
> options         KDB
> # For minimum debugger support (stable branch) use:
> #options        KDB_TRACE
> # For full debugger support use this instead:
> options         DDB
> #options        INVARIANTS
> #options        INVARIANT_SUPPORT
> #options        WITNESS
> #options        WITNESS_SKIPSPIN
> #options        DIAGNOSTIC
> options         GDB
> 
> I'm finding in the web that it is necessary to set someting like
> 
> hint.uart.0.flags"0x90"
> 
> but i do not find any flag like this in sysctl on BBB.

The flags are documented in the uart manpage.
0x10 flag sets the console uart and 0x80 the gdb uart.
0x90 sets both.
But it assumes /boot/device.hints to be used, which to my knowledge isn't
true on the BBB.
The console is setup via stdin/stdout in
sys/boot/fdt/dts/arm/beaglebone.dts
No idea how gdb or any of the other flags can be entered in the DTS files.

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.


More information about the freebsd-arm mailing list