summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2017-08-27 18:36:25 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2017-08-27 18:36:25 +0200
commitba569a7ebe749ea925008baf2b8ff4d1e4cd6cef (patch)
treeb02d38133b9798c402e43897164a67094b4665d1 /i386
parent7913f633c6fea18d8c6683ad465617d54c9eb535 (diff)
ddb: More gracefully handle address errors
* i386/i386/db_interface.h (db_read_bytes): Return boolean_t instead of void. * i386/i386/db_interface.c (db_user_to_kernel_address): Return -1 instead of calling db_error() if address is bogus. (db_read_bytes): Return FALSE instead of calling db_error() if address is bogus. * ddb/db_access.c (db_get_task_value): Return 0 if db_read_bytes failed. * ddb/db_examine.c (db_xcdump): Only print * if db_read_bytes failed.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/db_interface.c12
-rw-r--r--i386/i386/db_interface.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index b3fac0bb..aac29395 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -446,8 +446,6 @@ db_user_to_kernel_address(
}
if (flag) {
db_printf("\nno memory is assigned to address %08x\n", addr);
- db_error(0);
- /* NOTREACHED */
}
return(-1);
}
@@ -459,7 +457,7 @@ db_user_to_kernel_address(
* Read bytes from kernel address space for debugger.
*/
-void
+boolean_t
db_read_bytes(
vm_offset_t addr,
int size,
@@ -477,17 +475,16 @@ db_read_bytes(
while (--size >= 0) {
if (addr < VM_MIN_KERNEL_ADDRESS && task == TASK_NULL) {
db_printf("\nbad address %x\n", addr);
- db_error(0);
- /* NOTREACHED */
+ return FALSE;
}
addr++;
*data++ = *src++;
}
- return;
+ return TRUE;
}
while (size > 0) {
if (db_user_to_kernel_address(task, addr, &kern_addr, 1) < 0)
- return;
+ return FALSE;
src = (char *)kern_addr;
n = intel_trunc_page(addr+INTEL_PGBYTES) - addr;
if (n > size)
@@ -497,6 +494,7 @@ db_read_bytes(
while (--n >= 0)
*data++ = *src++;
}
+ return TRUE;
}
/*
diff --git a/i386/i386/db_interface.h b/i386/i386/db_interface.h
index 9ffb6a60..18ee3291 100644
--- a/i386/i386/db_interface.h
+++ b/i386/i386/db_interface.h
@@ -32,7 +32,7 @@ extern boolean_t kdb_trap (
int code,
struct i386_saved_state *regs);
-extern void db_read_bytes (
+extern boolean_t db_read_bytes (
vm_offset_t addr,
int size,
char *data,