From owner-p4-projects@FreeBSD.ORG Mon Jun 14 01:14:38 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 73CC816A4D1; Mon, 14 Jun 2004 01:14:38 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F6C516A4CE for ; Mon, 14 Jun 2004 01:14:38 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 49AC743D31 for ; Mon, 14 Jun 2004 01:14:38 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5E1EMDk022544 for ; Mon, 14 Jun 2004 01:14:22 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5E1EL5v022541 for perforce@freebsd.org; Mon, 14 Jun 2004 01:14:21 GMT (envelope-from marcel@freebsd.org) Date: Mon, 14 Jun 2004 01:14:21 GMT Message-Id: <200406140114.i5E1EL5v022541@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 54878 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2004 01:14:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=54878 Change 54878 by marcel@marcel_nfs on 2004/06/14 01:13:22 Make it possible to synthesize information. Synthesized info does not live in the core file and thus should not be fetched with kvm_read first. The implementation is a bit primitive, but it's not clear how frequently it's needed, let alone how complex the use cases can get. Affected files ... .. //depot/projects/gdb/usr.bin/kgdb/kgdb.h#8 edit .. //depot/projects/gdb/usr.bin/kgdb/packet.c#6 edit Differences ... ==== //depot/projects/gdb/usr.bin/kgdb/kgdb.h#8 (text+ko) ==== @@ -27,6 +27,8 @@ #ifndef _KGDB_H_ #define _KGDB_H_ +extern unsigned char gdb_membuf[]; + extern char *gdb_rxp; extern size_t gdb_rxsz; extern char *gdb_txp; ==== //depot/projects/gdb/usr.bin/kgdb/packet.c#6 (text+ko) ==== @@ -56,6 +56,8 @@ 10 + (((c) < 'a') ? (c) - 'A' : (c) - 'a')) #define N2C(n) (((n) < 10) ? (n) + '0' : (n) + 'a' - 10) +unsigned char gdb_membuf[256]; + static int gdb_packet(void) { @@ -318,21 +320,24 @@ int gdb_tx_mem(const unsigned char *addr, size_t size) { - unsigned char sbuf[256]; unsigned char *dbuf, *p; ssize_t res; - dbuf = (size > sizeof(sbuf)) ? malloc(size) : sbuf; - res = kvm_read(kvm, (unsigned long)addr, dbuf, size); - if (res != (ssize_t)size) - return (0); + if (addr != gdb_membuf) { + dbuf = (size > sizeof(gdb_membuf)) ? malloc(size) : gdb_membuf; + res = kvm_read(kvm, (unsigned long)addr, dbuf, size); + if (res != (ssize_t)size) + return (0); + } else + dbuf = (unsigned char *)(uintptr_t)addr; + p = dbuf; while (size-- > 0) { *gdb_txp++ = N2C(*p >> 4); *gdb_txp++ = N2C(*p & 0x0f); p++; } - if (dbuf != sbuf) + if (dbuf != gdb_membuf) free(dbuf); return (1); }