From f20eea8ca91a5c2b1c69e5f2fbabad8f2d8be42b Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 22 Nov 2012 00:05:30 -0500 Subject: [PATCH] Fix various parameter errors and improve output formatting. --- .../controllers/DebugReportGenerator.cpp | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/apps/debugger/controllers/DebugReportGenerator.cpp b/src/apps/debugger/controllers/DebugReportGenerator.cpp index 1173978158..8322326e73 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.cpp +++ b/src/apps/debugger/controllers/DebugReportGenerator.cpp @@ -96,7 +96,8 @@ DebugReportGenerator::_GenerateReportHeader(BString& _output) AutoLocker locker(fTeam); BString data; - data.SetToFormat("Debug information for team %s (%" B_PRId32 "):\n\n"); + data.SetToFormat("Debug information for team %s (%" B_PRId32 "):\n", + fTeam->Name(), fTeam->ID()); _output << data; return B_OK; @@ -108,6 +109,7 @@ DebugReportGenerator::_DumpLoadedImages(BString& _output) { AutoLocker locker(fTeam); + _output << "\nLoaded Images:\n"; BString data; for (ImageList::ConstIterator it = fTeam->Images().GetIterator(); Image* image = it.Next();) { @@ -134,15 +136,17 @@ DebugReportGenerator::_DumpRunningThreads(BString& _output) { AutoLocker locker(fTeam); + _output << "\nActive Threads:\n"; BString data; status_t result = B_OK; for (ThreadList::ConstIterator it = fTeam->Threads().GetIterator(); Thread* thread = it.Next();) { try { - data.SetToFormat("\t%s %s, id: %" B_PRId32", state: %" B_PRId32 - "\n", thread->Name(), thread->IsMainThread() - ? "(main)" : "", UiUtils::ThreadStateToString( - thread->State(), thread->StoppedReason())); + data.SetToFormat("\t%s %s, id: %" B_PRId32", state: %s\n", + thread->Name(), thread->IsMainThread() + ? "(main)" : "", thread->ID(), + UiUtils::ThreadStateToString(thread->State(), + thread->StoppedReason())); _output << data; @@ -168,10 +172,12 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output, Thread* thread) if (trace == NULL) return B_OK; + _output << "\t\tFrame\t\tIP\t\t\tFunction Name\n"; + _output << "\t\t-----------------------------------------------\n"; BString data; for (int32 i = 0; StackFrame* frame = trace->FrameAt(i); i++) { char functionName[512]; - data.SetToFormat("0x%" B_PRIx64 "\t0x%" B_PRIx64 "\t%s\n", + data.SetToFormat("\t\t0x%08" B_PRIx64 "\t0x%08" B_PRIx64 "\t%s\n", frame->FrameAddress(), frame->InstructionPointer(), UiUtils::FunctionNameForFrame(frame, functionName, sizeof(functionName))); @@ -179,16 +185,17 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output, Thread* thread) _output << data; } - _output << "\nRegisters:\n\n"; + _output << "\n\t\tRegisters:\n"; CpuState* state = thread->GetCpuState(); BVariant value; + const Register* reg = NULL; for (int32 i = 0; i < fArchitecture->CountRegisters(); i++) { - const Register* reg = fArchitecture->Registers() + i; + reg = fArchitecture->Registers() + i; state->GetRegisterValue(reg, value); char buffer[64]; - data.SetToFormat("%s\t%0x%s\n", reg->Name(), + data.SetToFormat("\t\t\t%5s:\t%s\n", reg->Name(), UiUtils::VariantToString(value, buffer, sizeof(buffer))); _output << data; }