Remote debugging RB133c

Erik Moe ehmoeok at gmail.com
Tue May 10 15:31:17 UTC 2011


Me again,

I'm trying to do some remote debugging on the RB133c.  I can get the kernel to boot over tftp.  I've added the following option to the ADM5120 kernel config:

makeoptions     DEBUG=-g 

options         DDB
options         KDB
options         GDB
options         BREAK_TO_DEBUGGER

I've also built a cross-debugger:

export SRCROOT=/home/emoe/svn/mips
export TARGET_ARCH=mipsel

cd ${SRCROOT}/gnu/usr.bin/binutils &&
make depend all &&
cd ../gdb &&
make depend all &&
cd gdb &&
make install &&
cd ../kgdb &&
make install

I've locked my serial port at 115200 baud:

# stty -f /dev/cuaU0.init speed 115200
# stty -f /dev/cuaU0.lock 1

I connect to the serial port on the RB133c using screen and boot the kernel:

# screen /dev/cuaU0

RouterBOOT booter 2.18

RouterBoard 133C3

CPU frequency: 175 MHz
  Memory size:  16 MB

Press any key within 6 seconds to enter setup......
trying dhcp protocol... OK
resolved mac address 00:0C:29:29:27:66
Gateway: 192.168.11.1
transfer started ......................... transfer ok, time=5.07s
setting up elf image... OK
jumping to kernel code
entry: mips_init()
Cache info:
  picache_stride    = 4096
  picache_loopcount = 2
  pdcache_stride    = 4096
  pdcache_loopcount = 2
cpu0: MIPS Technologies processor v11.128
  MMU: Standard TLB, 16 entries
  L1 i-cache: 2 ways of 256 sets, 16 bytes per line
  L1 d-cache: 2 ways of 256 sets, 16 bytes per line
  Config1=0x1e994c8a<WatchRegs,EJTAG>
Physical memory chunk(s):
0x29c000 - 0xffffff, 14041088 bytes (3428 pages)
Maxmem is 0x1000000
GDB: debug ports: uart
GDB: current port: uart
KDB: debugger backends: ddb gdb
KDB: current backend: ddb
Copyright (c) 1992-2011 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.0-CURRENT #9 r221418M: Sun May  8 20:20:54 CDT 2011
    root at freebsd.localdomain:/usr/home/emoe/obj/mips/mips.mipsel/usr/home/emoe/svn/mips/sys/ADM5120 mips
real memory  = 16777216 (16384K bytes)
Physical memory chunk(s):
0x00328000 - 0x00f8dfff, 13000704 bytes (3174 pages)
avail memory = 12746752 (12MB)
nfslock: pseudo-device
mem: <memory>
null: <null device, zero device>
nexus0: <MIPS32 root nexus>
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 175000000 Hz quality 800
Event timer "MIPS32" frequency 175000000 Hz quality 800
obio0 at mem 0-0x1ffffffe on nexus0
admsw0: <ADM5120 Switch Engine> on obio0
admsw0: ADM5120 Switch Engine, 6 ports
admsw0: base Ethernet address 00:0c:42:07:b2:4e
admsw0: Ethernet address: 00:0c:42:07:b2:4e
admsw1: Ethernet address: 00:0c:42:07:b2:4f
admsw2: Ethernet address: 00:0c:42:07:b2:50
admsw3: Ethernet address: 00:0c:42:07:b2:51
admsw4: Ethernet address: 00:0c:42:07:b2:52
admsw5: Ethernet address: 00:0c:42:07:b2:53
uart0: <adm5120_uart, channel A> on obio0
uart0: fast interrupt
uart0: console (115200,n,8,1)
Device configuration finished.
Timecounters tick every 10.000 msec
bootpc_init: wired to interface 'admsw0'
Sending DHCP Discover packet from interface admsw0 (00:0c:42:07:b2:4e)
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
 
Within screen, I can send a BREAK (ctrl-a b) and drop into DDB and invoke the GDB backend.

KDB: enter: Line break on console
[ thread pid 10 tid 100002 ]
Stopped at      kdb_enter+0x4c: lui     at,0x8029
db> gdb
(ctrl-c will return control to ddb)
Switching to gdb back-end
$T0525:78dc0b80;thread:186a2;#e4

Then I can exit screen (ctrl-a K) and invoke kgdb-mipsel, but I'm seeing a lot of "Ignoring packet error", "Reply contains invalid hex digit 116" errors and it doesn't seem to be functioning.

# kgdb-mipsel -r /dev/cuaU0 /home/emoe/tftpboot/boot/kernel/kernel
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 "--host=i386-marcel-freebsd --target=mipsel-marcel-freebsd"...Switching to remote protocol
kdb_enter (why=0x801f1eac "break", Ignoring packet error, continuing...
msg=Reply contains invalid hex digit 116
)
    at /usr/home/emoe/svn/mips/sys/kern/subr_kdb.c:336
336			kdb_why = KDB_WHY_UNSET;
Ignoring packet error, continuing...

(kgdb) break admsw_start
Ignoring packet error, continuing...
Reply contains invalid hex digit 116
(kgdb) continue
Continuing.
Ignoring packet error, continuing...

It could very well be I don't know what I'm doing, but has anyone had success?

Thanks,
Erik



 


More information about the freebsd-mips mailing list