kernel/vm: Remove hacky stack dumper from vm_page_fault.
As the TODO said, we now have good userland debugging facilities, so this isn't needed (and has been if 0'd out for almost a decade now.) The dprintf on page faults may still be useful under rare circumstances, but we already have a "TRACE_FAULTS" configuration for this file, so guard it behind that. Fixes part of #14360.
This commit is contained in:
parent
e4425315dd
commit
494a6e4e8e
@ -4248,16 +4248,15 @@ vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isExecute,
|
||||
"0x%lx, ip 0x%lx\n", address, faultAddress);
|
||||
}
|
||||
} else {
|
||||
#if 1
|
||||
// TODO: remove me once we have proper userland debugging support
|
||||
// (and tools)
|
||||
Thread* thread = thread_get_current_thread();
|
||||
|
||||
#ifdef TRACE_FAULTS
|
||||
VMArea* area = NULL;
|
||||
if (addressSpace != NULL) {
|
||||
addressSpace->ReadLock();
|
||||
area = addressSpace->LookupArea(faultAddress);
|
||||
}
|
||||
|
||||
Thread* thread = thread_get_current_thread();
|
||||
dprintf("vm_page_fault: thread \"%s\" (%" B_PRId32 ") in team "
|
||||
"\"%s\" (%" B_PRId32 ") tried to %s address %#lx, ip %#lx "
|
||||
"(\"%s\" +%#lx)\n", thread->name, thread->id,
|
||||
@ -4266,60 +4265,6 @@ vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isExecute,
|
||||
faultAddress, area ? area->name : "???", faultAddress - (area ?
|
||||
area->Base() : 0x0));
|
||||
|
||||
// We can print a stack trace of the userland thread here.
|
||||
// TODO: The user_memcpy() below can cause a deadlock, if it causes a page
|
||||
// fault and someone is already waiting for a write lock on the same address
|
||||
// space. This thread will then try to acquire the lock again and will
|
||||
// be queued after the writer.
|
||||
# if 0
|
||||
if (area) {
|
||||
struct stack_frame {
|
||||
#if defined(__INTEL__) || defined(__POWERPC__) || defined(__M68K__)
|
||||
struct stack_frame* previous;
|
||||
void* return_address;
|
||||
#else
|
||||
// ...
|
||||
#warning writeme
|
||||
#endif
|
||||
} frame;
|
||||
# ifdef __INTEL__
|
||||
struct iframe* iframe = x86_get_user_iframe();
|
||||
if (iframe == NULL)
|
||||
panic("iframe is NULL!");
|
||||
|
||||
status_t status = user_memcpy(&frame, (void*)iframe->ebp,
|
||||
sizeof(struct stack_frame));
|
||||
# elif defined(__POWERPC__)
|
||||
struct iframe* iframe = ppc_get_user_iframe();
|
||||
if (iframe == NULL)
|
||||
panic("iframe is NULL!");
|
||||
|
||||
status_t status = user_memcpy(&frame, (void*)iframe->r1,
|
||||
sizeof(struct stack_frame));
|
||||
# else
|
||||
# warning "vm_page_fault() stack trace won't work"
|
||||
status = B_ERROR;
|
||||
# endif
|
||||
|
||||
dprintf("stack trace:\n");
|
||||
int32 maxFrames = 50;
|
||||
while (status == B_OK && --maxFrames >= 0
|
||||
&& frame.return_address != NULL) {
|
||||
dprintf(" %p", frame.return_address);
|
||||
area = addressSpace->LookupArea(
|
||||
(addr_t)frame.return_address);
|
||||
if (area) {
|
||||
dprintf(" (%s + %#lx)", area->name,
|
||||
(addr_t)frame.return_address - area->Base());
|
||||
}
|
||||
dprintf("\n");
|
||||
|
||||
status = user_memcpy(&frame, frame.previous,
|
||||
sizeof(struct stack_frame));
|
||||
}
|
||||
}
|
||||
# endif // 0 (stack trace)
|
||||
|
||||
if (addressSpace != NULL)
|
||||
addressSpace->ReadUnlock();
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user