From owner-freebsd-amd64@FreeBSD.ORG Fri Feb 2 01:30:15 2007 Return-Path: X-Original-To: freebsd-amd64@hub.freebsd.org Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04DFC16A405 for ; Fri, 2 Feb 2007 01:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id D093C13C471 for ; Fri, 2 Feb 2007 01:30:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l121UEFc045865 for ; Fri, 2 Feb 2007 01:30:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l121UESt045864; Fri, 2 Feb 2007 01:30:14 GMT (envelope-from gnats) Resent-Date: Fri, 2 Feb 2007 01:30:14 GMT Resent-Message-Id: <200702020130.l121UESt045864@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-amd64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ravi Murty Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8FA7116A400 for ; Fri, 2 Feb 2007 01:25:58 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 8158813C478 for ; Fri, 2 Feb 2007 01:25:58 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l121Pwu3079199 for ; Fri, 2 Feb 2007 01:25:58 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l121Pw1I079198; Fri, 2 Feb 2007 01:25:58 GMT (envelope-from nobody) Message-Id: <200702020125.l121Pw1I079198@www.freebsd.org> Date: Fri, 2 Feb 2007 01:25:58 GMT From: Ravi Murty To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: amd64/108673: kgdb doesn't work very well very long X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2007 01:30:15 -0000 >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: