PERFORCE change 54705 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sat Jun 12 06:56:09 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=54705
Change 54705 by marcel at 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);
More information about the p4-projects
mailing list