amd64/108673: kgdb doesn't work very well very long
Ravi Murty
ravi.murty at intel.com
Fri Feb 2 01:30:15 UTC 2007
>Number: 108673
>Category: amd64
>Synopsis: kgdb doesn't work very well very long
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-amd64
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 02 01:30:14 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Ravi Murty
>Release: 6.1-release
>Organization:
Intel
>Environment:
FreeBSD 6.1-RELEASE FreeBSD 6.1-RELEASE #17: Thu Feb 16:57:46 PST 2007
>Description:
Here's what I think might be happening.
1. At the loader prompt I enter "boot -d" to break into the debugger because I want to start running the debugger from mi_startup.
2. Kgdb connects on the host and I can step, but it crashes or doesn't work very well. We started to look at things like gdb_txbuf and noticed that a strage 0x78787878 (0x78 is lower case 'x') appears where gdb_txbuf is supposed to be.
3. We looked at the source code a bit and realized that gdb_txbuf is sized to be 500 bytes (defined by GDB_BUFSZ in amd64/include/gdb_machdep.h).
So here's the problem:
1. When kgdb running on the host connects it runs a query to the target to request all the registers. In amd64's case, that's 56 total registers with 49 of size 8 bytes and 7 of size 4. Since we convert from hex nibbles to char's, we expect it to store 16 char's per 8 byte register and 8 char's for 4 byte registers. Simple math tells us that is (16 * 49 + 8 * 7 = 840). So we need atleast 840B in the buffer to return the result of the query.
2. Indeed when we look at what's at gbd_txbuf on the target (via kgdb), we notice that 0x78787878 appears until location 839. It is 0x78787878 because that happens to be "xxxx" for registers that are undefined (see gdb_packet.c)
Therefore, shouldn't GDB_BUFSZ be > 840B ?
Thanks
Ravi
>How-To-Repeat:
Run kgdb and connect to a machine running 6.1-Release for amd64. Drop to the loader prompt on boot and type "boot -d" and connect to the debugger (gdb backend).
Try and step through the code after this point.
>Fix:
See "Full description".
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-amd64
mailing list