From owner-p4-projects@FreeBSD.ORG Sat Jun 12 06:56:08 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 88A7616A4D1; Sat, 12 Jun 2004 06:56:08 +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 6392916A4CE for ; Sat, 12 Jun 2004 06:56:08 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E85043D45 for ; Sat, 12 Jun 2004 06:56:08 +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 i5C6trO7090183 for ; Sat, 12 Jun 2004 06:55:53 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5C6trOR090180 for perforce@freebsd.org; Sat, 12 Jun 2004 06:55:53 GMT (envelope-from marcel@freebsd.org) Date: Sat, 12 Jun 2004 06:55:53 GMT Message-Id: <200406120655.i5C6trOR090180@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 54705 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: Sat, 12 Jun 2004 06:56:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=54705 Change 54705 by marcel@marcel_nfs on 2004/06/12 06:55:42 o Remove gdb_cpu_frame(). o Do not dereference the frame pointer. It's a kernel address. Use getreg() to fetch it from the core file. Affected files ... .. //depot/projects/gdb/usr.bin/kgdb/md_ia64.c#3 edit Differences ... ==== //depot/projects/gdb/usr.bin/kgdb/md_ia64.c#3 (text+ko) ==== @@ -44,14 +44,13 @@ #include "kgdb.h" -struct trapframe * -gdb_cpu_frame(struct thread *td) +static uint64_t +getreg(uint64_t *addr) { - struct trapframe *tf; + uint64_t val; - tf = malloc(sizeof(*tf)); - kvm_read(kvm, (uintptr_t)td->td_last_frame, tf, sizeof(*tf)); - return (tf); + kvm_read(kvm, (uintptr_t)addr, &val, sizeof(val)); + return (val); } void * @@ -59,6 +58,7 @@ { static uint64_t synth; struct trapframe *tf = curkthr->td_frame; + uint64_t bspstore; *regsz = gdb_cpu_regsz(regnum); switch (regnum) { @@ -126,10 +126,10 @@ * space, setup bspstore to point to the base of the * kernel stack. */ - synth = (tf->tf_special.bspstore >= IA64_RR_BASE(5)) ? - tf->tf_special.bspstore : (curkthr->td_kstack + - (tf->tf_special.bspstore & 0x1ffUL)); - synth += tf->tf_special.ndirty; + bspstore = getreg(&tf->tf_special.bspstore); + synth = (bspstore >= IA64_RR_BASE(5)) ? bspstore : + (curkthr->td_kstack + (bspstore & 0x1ffUL)); + synth += getreg(&tf->tf_special.ndirty); return (&synth); case 352: /* bspstore. */ /* @@ -137,9 +137,9 @@ * space, setup bacpstore to point to the base of the * kernel stack. */ - synth = (tf->tf_special.bspstore >= IA64_RR_BASE(5)) ? - tf->tf_special.bspstore : (curkthr->td_kstack + - (tf->tf_special.bspstore & 0x1ffUL)); + bspstore = getreg(&tf->tf_special.bspstore); + synth = (bspstore >= IA64_RR_BASE(5)) ? bspstore : + (curkthr->td_kstack + (bspstore & 0x1ffUL)); return (&synth); } return (NULL);