Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2015 02:10:54 +0100
From:      Bernd Walter <ticso@cicely7.cicely.de>
To:        Manuel =?iso-8859-1?Q?St=FChn?= <freebsdnewbie@freenet.de>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: remote kernel debugging
Message-ID:  <20150322011054.GA81780@cicely7.cicely.de>
In-Reply-To: <550DD740.2070608@freenet.de>
References:  <550DD740.2070608@freenet.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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@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@bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



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