Restrict the address range dumped in crash reports.

This commit is contained in:
Rene Gollent
2013-01-22 20:09:47 -05:00
parent e449bae891
commit b68166e1da
2 changed files with 24 additions and 9 deletions
@@ -341,8 +341,11 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output,
if (frame->CountParameters() == 0 if (frame->CountParameters() == 0
&& frame->CountLocalVariables() == 0) { && frame->CountLocalVariables() == 0) {
// only dump the topmost frame // only dump the topmost frame
if (i == 0) if (i == 0) {
_DumpStackFrameMemory(_output, thread->GetCpuState()); _DumpStackFrameMemory(_output, thread->GetCpuState(),
frame->FrameAddress(), thread->GetTeam()->GetArchitecture()
->StackGrowthDirection());
}
continue; continue;
} }
@@ -384,19 +387,29 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output,
void void
DebugReportGenerator::_DumpStackFrameMemory(BString& _output, DebugReportGenerator::_DumpStackFrameMemory(BString& _output,
CpuState* state) CpuState* state, target_addr_t framePointer, uint8 stackDirection)
{ {
target_addr_t address = state->StackPointer(); target_addr_t startAddress;
if (fCurrentBlock == NULL || !fCurrentBlock->Contains(address)) { target_addr_t endAddress;
fListener->InspectRequested(address, this); if (stackDirection == STACK_GROWTH_DIRECTION_POSITIVE) {
startAddress = framePointer;
endAddress = state->StackPointer();
} else {
startAddress = state->StackPointer();
endAddress = framePointer;
}
if (fCurrentBlock == NULL || !fCurrentBlock->Contains(startAddress)) {
fListener->InspectRequested(startAddress, this);
status_t result = B_OK; status_t result = B_OK;
do { do {
result = acquire_sem(fTeamDataSem); result = acquire_sem(fTeamDataSem);
} while (result == B_INTERRUPTED); } while (result == B_INTERRUPTED);
} }
_output << "\t\t\tFrame memory:\n"; _output << "\t\t\tFrame memory:\n";
UiUtils::DumpMemory(_output, 3, fCurrentBlock, address, 1, 16, UiUtils::DumpMemory(_output, 3, fCurrentBlock, startAddress, 1, 16,
fCurrentBlock->BaseAddress() + fCurrentBlock->Size() - address); endAddress - startAddress);
} }
@@ -60,7 +60,9 @@ private:
status_t _DumpDebuggedThreadInfo(BString& _output, status_t _DumpDebuggedThreadInfo(BString& _output,
::Thread* thread); ::Thread* thread);
void _DumpStackFrameMemory(BString& _output, void _DumpStackFrameMemory(BString& _output,
CpuState* state); CpuState* state,
target_addr_t framePointer,
uint8 stackDirection);
status_t _ResolveValueIfNeeded(ValueNode* node, status_t _ResolveValueIfNeeded(ValueNode* node,
StackFrame* frame, int32 maxDepth); StackFrame* frame, int32 maxDepth);