Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2007 08:59:36 -0800
From:      "Rao, Nikhil" <nikhil.rao@intel.com>
To:        <freebsd-amd64@freebsd.org>
Subject:   RE: Issue with using KGDB for remote debug over serial port
Message-ID:  <12A5C15467D5B94F8E0FF265D9498ADDEEB999@orsmsx419.amr.corp.intel.com>

next in thread | raw e-mail | index | archive | help
Hi all,
=20
I think I have found the cause of the issue - I am not sure if this is
the root cause,=20
=20
in
http://fxr.watson.org/fxr/source/amd64/include/gdb_machdep.h?v=3DRELENG62=

=20
 32
<http://fxr.watson.org/fxr/source/amd64/include/gdb_machdep.h?v=3DRELENG6=
2
#L32>  #define GDB_BUFSZ
<http://fxr.watson.org/fxr/ident?v=3DRELENG62;i=3DGDB_BUFSZ>;  500
=20
needs to be changed to=20
=20
 32
<http://fxr.watson.org/fxr/source/amd64/include/gdb_machdep.h?v=3DRELENG6=
2
#L32>  #define GDB_BUFSZ
<http://fxr.watson.org/fxr/ident?v=3DRELENG62;i=3DGDB_BUFSZ>;  1000 =
(Really
something greater than 840)
=20
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.
=20
if anyone has any feedback, please let me know.
=20
thanks,
Nikhil


________________________________

From: Rao, Nikhil=20
Sent: Wednesday, January 24, 2007 11:26 AM
To: 'freebsd-amd64@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.
=20
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
=20
The target platform boots a 6.1 release GENERIC AMD64 kernel with
makeoptions DEBUG=3D-g,  KDB and GDB options enabled and has a serial
connection with the host. In device.hints I have set
hint.sio0.flags=3D0x80
=20
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.
=20
<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=3D0x0) 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=3D0xffffff0000049d00) 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)




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