From f39acd678c80de07c376b008cc5b274717959595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 14 Jan 2007 23:26:20 +0000 Subject: [PATCH] * Made vm_area_lookup() part of the kernel private API. * "sc"/"where"/"bt" now prints the area where the function of the stack frame is located in case there is no other information (using the above function). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19800 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/vm.h | 4 ++-- src/system/kernel/arch/x86/arch_debug.c | 24 +++++++++++++++++------- src/system/kernel/vm/vm.cpp | 4 ++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/headers/private/kernel/vm.h b/headers/private/kernel/vm.h index d3c3bb9665..092263cdb6 100644 --- a/headers/private/kernel/vm.h +++ b/headers/private/kernel/vm.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -9,7 +9,6 @@ #define _KERNEL_VM_H -//#include #include #include #include @@ -58,6 +57,7 @@ area_id vm_clone_area(team_id team, const char *name, void **address, area_id sourceArea); status_t vm_delete_area(team_id aid, area_id id); status_t vm_create_vnode_cache(void *vnode, vm_cache_ref **_cacheRef); +vm_area *vm_area_lookup(vm_address_space *addressSpace, addr_t address); status_t vm_set_area_memory_type(area_id id, addr_t physicalBase, uint32 type); diff --git a/src/system/kernel/arch/x86/arch_debug.c b/src/system/kernel/arch/x86/arch_debug.c index 8979953e1c..f28feb0fdd 100644 --- a/src/system/kernel/arch/x86/arch_debug.c +++ b/src/system/kernel/arch/x86/arch_debug.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001, Travis Geiselbrecht. All rights reserved. @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -91,16 +92,25 @@ print_stack_frame(struct thread *thread, addr_t eip, addr_t ebp, addr_t nextEbp) status = image_debug_lookup_user_symbol_address(thread->team, eip, &baseAddress, &symbol, &image, &exactMatch); } + + kprintf("%08lx (+%4ld) %08lx", ebp, diff, eip); + if (status == B_OK) { if (symbol != NULL) { - kprintf("%08lx (+%4ld) %08lx <%s>:%s + 0x%04lx%s\n", ebp, diff, eip, - image, symbol, eip - baseAddress, exactMatch ? "" : " (nearest)"); + kprintf(" <%s>:%s + 0x%04lx%s\n", image, symbol, + eip - baseAddress, exactMatch ? "" : " (nearest)"); } else { - kprintf("%08lx (+%4ld) %08lx <%s@%p>:unknown + 0x%04lx\n", ebp, diff, - eip, image, (void *)baseAddress, eip - baseAddress); + kprintf(" <%s@%p>:unknown + 0x%04lx\n", image, + (void *)baseAddress, eip - baseAddress); } - } else - kprintf("%08lx (+%4ld) %08lx\n", ebp, diff, eip); + } else { + vm_area *area = vm_area_lookup(thread->team->address_space, eip); + if (area != NULL) { + kprintf(" %ld:%s@%p + %#lx\n", area->id, area->name, (void *)area->base, + eip - area->base); + } else + kprintf("\n"); + } } diff --git a/src/system/kernel/vm/vm.cpp b/src/system/kernel/vm/vm.cpp index d9a7b05a3a..76ad8811a6 100644 --- a/src/system/kernel/vm/vm.cpp +++ b/src/system/kernel/vm/vm.cpp @@ -2961,8 +2961,8 @@ vm_soft_fault(addr_t originalAddress, bool isWrite, bool isUser) } -/* NOTE: must have the address space's sem held */ -static vm_area * +/*! You must have the address space's sem held */ +vm_area * vm_area_lookup(vm_address_space *addressSpace, addr_t address) { vm_area *area;