summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-01-29 23:36:42 +0000
committerjhb <jhb@FreeBSD.org>2008-01-29 23:36:42 +0000
commitbddbfed7ecee639fc330ad2064430f1723898b9d (patch)
tree5c26d43173395be254ddb1f45bf337dc4d749b71 /gnu
parent2b547364abdf5b207fbb3c5c6e77990a6a3d9517 (diff)
downloadFreeBSD-src-bddbfed7ecee639fc330ad2064430f1723898b9d.zip
FreeBSD-src-bddbfed7ecee639fc330ad2064430f1723898b9d.tar.gz
Use target_read_memory() and extract_unsigned_integer() instead of direct
KVM access to read kernel pointers.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/kgdb/kld.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/gnu/usr.bin/gdb/kgdb/kld.c b/gnu/usr.bin/gdb/kgdb/kld.c
index 5995286..95158ea 100644
--- a/gnu/usr.bin/gdb/kgdb/kld.c
+++ b/gnu/usr.bin/gdb/kgdb/kld.c
@@ -136,25 +136,12 @@ find_kld_path (char *filename, char *path, size_t path_size)
static CORE_ADDR
read_pointer (CORE_ADDR address)
{
- union {
- uint32_t d32;
- uint64_t d64;
- } val;
-
- switch (TARGET_PTR_BIT) {
- case 32:
- if (kvm_read(kvm, address, &val.d32, sizeof(val.d32)) !=
- sizeof(val.d32))
- return (0);
- return (val.d32);
- case 64:
- if (kvm_read(kvm, address, &val.d64, sizeof(val.d64)) !=
- sizeof(val.d64))
- return (0);
- return (val.d64);
- default:
- return (0);
- }
+ CORE_ADDR value;
+
+ if (target_read_memory(address, (char *)&value, TARGET_PTR_BIT / 8) !=
+ 0)
+ return (0);
+ return (extract_unsigned_integer(&value, TARGET_PTR_BIT / 8));
}
/*
OpenPOWER on IntegriCloud