Debugger: Improvements to crash report generator.

- If debug information is available for a given stack frame, show the
corresponding source file path and line number in the crash report.
This commit is contained in:
Rene Gollent
2014-05-18 11:05:28 -04:00
parent 4abae4aba8
commit fd8693ea29
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013, Rene Gollent, [email protected].
* Copyright 2012-2014, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -490,10 +490,30 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output,
BString data;
for (int32 i = 0; StackFrame* frame = trace->FrameAt(i); i++) {
char functionName[512];
data.SetToFormat("\t\t%#08" B_PRIx64 "\t%#08" B_PRIx64 "\t%s\n",
frame->FrameAddress(), frame->InstructionPointer(),
UiUtils::FunctionNameForFrame(frame, functionName,
sizeof(functionName)));
BString sourcePath;
target_addr_t ip = frame->InstructionPointer();
FunctionInstance* functionInstance;
Statement* statement;
if (fTeam->GetStatementAtAddress(ip,
functionInstance, statement) == B_OK) {
BReference<Statement> statementReference(statement, true);
int32 line = statement->StartSourceLocation().Line();
LocatableFile* sourceFile = functionInstance->GetFunction()
->SourceFile();
if (sourceFile != NULL) {
sourceFile->GetPath(sourcePath);
sourcePath.SetToFormat("(%s:%" B_PRId32 ")",
sourcePath.String(), line);
}
}
data.SetToFormat("\t\t%#08" B_PRIx64 "\t%#08" B_PRIx64 "\t%s %s\n",
frame->FrameAddress(), ip, UiUtils::FunctionNameForFrame(
frame, functionName, sizeof(functionName)),
sourcePath.String());
_output << data;