Issue with using KGDB for remote debug over serial port

Rao, Nikhil nikhil.rao at intel.com
Thu Feb 1 17:00:02 UTC 2007


Hi all,
 
I think I have found the cause of the issue - I am not sure if this is
the root cause, 
 
in
http://fxr.watson.org/fxr/source/amd64/include/gdb_machdep.h?v=RELENG62
 
 32
<http://fxr.watson.org/fxr/source/amd64/include/gdb_machdep.h?v=RELENG62
#L32>  #define GDB_BUFSZ
<http://fxr.watson.org/fxr/ident?v=RELENG62;i=GDB_BUFSZ>  500
 
needs to be changed to 
 
 32
<http://fxr.watson.org/fxr/source/amd64/include/gdb_machdep.h?v=RELENG62
#L32>  #define GDB_BUFSZ
<http://fxr.watson.org/fxr/ident?v=RELENG62;i=GDB_BUFSZ>  1000 (Really
something greater than 840)
 
As soon as the target-host gdb communication is established the
gdb_txbuf char array which is of size GDB_BUFSZ gets written to and the
writes overflow to beyond GDB_BUFSZ, this corrupts kernel data
structures and causes the crash. My observation is that 840bytes get
written to the gdb_txbuf array.
 
if anyone has any feedback, please let me know.
 
thanks,
Nikhil


________________________________

From: Rao, Nikhil 
Sent: Wednesday, January 24, 2007 11:26 AM
To: 'freebsd-amd64 at freebsd.org'
Subject: Issue with using KGDB for remote debug over serial port


I am trying to debug an AMD64 kernel over a serial connection. Both the
host and the target are running AMD64 6.1 release kernels.
 
Target platform - Dell Precision Workstation 690, (Dual Quad core system
with Intel Xeon  1.86 Ghz CPU)
Host - XPS 600 Dell - Intel Pentium D 3.00 Ghz CPU
 
The target platform boots a 6.1 release GENERIC AMD64 kernel with
makeoptions DEBUG=-g,  KDB and GDB options enabled and has a serial
connection with the host. In device.hints I have set
hint.sio0.flags=0x80
 
I am able to enter kgdb using the -d boot option, next I can break on a
breakpoint. However when I try to step the debugger, the target gets a
page fault in kernel mode. I have attached a log of the kgdb output
below. Please let me know if any other info. would be useful to resolve
this problem.
 
<cut>
[GDB will not be able to debug user-mode threads:
/usr/lib/libthread_db.so: Undefined symbol "ps_pglobal_lookup"]

<cut>

0xffffffff803ecf8f in kdb_enter (msg=0x0) at cpufunc.h:63

63 __asm __volatile("int $3");

Unread portion of the kernel message buffer:

Cannot access memory at address 0xf000a8ece001a840

(kgdb) break pmap_pinit0

Breakpoint 1 at 0xffffffff805c4d10: file
/usr/src/sys/amd64/amd64/pmap.c, line 1059.

(kgdb) c

Continuing.

[New Thread 0]

Program received signal SIGQUIT, Quit.

[Switching to Thread 0]

pmap_pinit0 (pmap=0xffffff0000049d00) at
/usr/src/sys/amd64/amd64/pmap.c:1061

1061 PMAP_LOCK_INIT(pmap);

(kgdb) break 1066

Breakpoint 2 at 0xffffffff805c4d70: file
/usr/src/sys/amd64/amd64/pmap.c, line 1066.

(kgdb) c

Continuing.

Program received signal SIGSYS, Bad system call.

0x0000000000000000 in ?? ()

(kgdb) bt

#0 0x0000000000000000 in ?? ()

#1 0x0000000000000000 in ?? ()

(kgdb)



More information about the freebsd-amd64 mailing list