From owner-svn-src-stable-7@FreeBSD.ORG Wed Nov 4 16:03:59 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E8DF106566C; Wed, 4 Nov 2009 16:03:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 134998FC1E; Wed, 4 Nov 2009 16:03:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nA4G3wAt037463; Wed, 4 Nov 2009 16:03:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA4G3wGd037461; Wed, 4 Nov 2009 16:03:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200911041603.nA4G3wGd037461@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Nov 2009 16:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198901 - stable/7/sbin/ddb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2009 16:03:59 -0000 Author: jhb Date: Wed Nov 4 16:03:58 2009 New Revision: 198901 URL: http://svn.freebsd.org/changeset/base/198901 Log: MFC 198585: When extracting the capture buffer from a crashdump, only read the valid portion of the capture buffer. Modified: stable/7/sbin/ddb/ddb_capture.c Directory Properties: stable/7/sbin/ddb/ (props changed) Modified: stable/7/sbin/ddb/ddb_capture.c ============================================================================== --- stable/7/sbin/ddb/ddb_capture.c Wed Nov 4 16:03:47 2009 (r198900) +++ stable/7/sbin/ddb/ddb_capture.c Wed Nov 4 16:03:58 2009 (r198901) @@ -95,24 +95,24 @@ kread_symbol(kvm_t *kvm, int index, void static void ddb_capture_print_kvm(kvm_t *kvm) { - u_int db_capture_bufsize; + u_int db_capture_bufoff; char *buffer, *db_capture_buf; if (kread_symbol(kvm, X_DB_CAPTURE_BUF, &db_capture_buf, sizeof(db_capture_buf), 0) < 0) errx(-1, "kvm: unable to read db_capture_buf"); - if (kread_symbol(kvm, X_DB_CAPTURE_BUFSIZE, &db_capture_bufsize, - sizeof(db_capture_bufsize), 0) < 0) - errx(-1, "kvm: unable to read db_capture_bufsize"); + if (kread_symbol(kvm, X_DB_CAPTURE_BUFOFF, &db_capture_bufoff, + sizeof(db_capture_bufoff), 0) < 0) + errx(-1, "kvm: unable to read db_capture_bufoff"); - buffer = malloc(db_capture_bufsize + 1); + buffer = malloc(db_capture_bufoff + 1); if (buffer == NULL) - err(-1, "malloc: db_capture_bufsize (%u)", - db_capture_bufsize); - bzero(buffer, db_capture_bufsize + 1); + err(-1, "malloc: db_capture_bufoff (%u)", + db_capture_bufoff); + bzero(buffer, db_capture_bufoff + 1); - if (kread(kvm, db_capture_buf, buffer, db_capture_bufsize, 0) < 0) + if (kread(kvm, db_capture_buf, buffer, db_capture_bufoff, 0) < 0) errx(-1, "kvm: unable to read buffer"); printf("%s\n", buffer); @@ -161,7 +161,7 @@ ddb_capture_status_kvm(kvm_t *kvm) errx(-1, "kvm: unable to read db_capture_bufsize"); if (kread_symbol(kvm, X_DB_CAPTURE_INPROGRESS, &db_capture_inprogress, sizeof(db_capture_inprogress), 0) < 0) - err(-1, "kvm: unable to read db_capture_inpgoress"); + err(-1, "kvm: unable to read db_capture_inprogress"); printf("%u/%u bytes used\n", db_capture_bufoff, db_capture_bufsize); if (db_capture_inprogress) printf("capture is on\n");