From 2bf866783ca42ba86a7acde1445d3d2a8f9b1dd6 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 22 Nov 2012 11:44:20 -0500 Subject: [PATCH] Cleanups. --- .../controllers/DebugReportGenerator.cpp | 6 ++--- .../cli/CliStackTraceCommand.cpp | 25 ++++--------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/apps/debugger/controllers/DebugReportGenerator.cpp b/src/apps/debugger/controllers/DebugReportGenerator.cpp index ab29467b6f..254f0b8de2 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.cpp +++ b/src/apps/debugger/controllers/DebugReportGenerator.cpp @@ -120,8 +120,8 @@ DebugReportGenerator::_DumpLoadedImages(BString& _output) target_addr_t dataBase = info.DataBase(); data.SetToFormat("\t%s (%" B_PRId32 ", %s) " - "Text: 0x%08" B_PRIx64 " - 0x%08" B_PRIx64 ", Data: 0x%08" - B_PRIx64 " - 0x%08" B_PRIx64 "\n", info.Name().String(), + "Text: %#08" B_PRIx64 " - %#08" B_PRIx64 ", Data: %#08" + B_PRIx64 " - %#08" B_PRIx64 "\n", info.Name().String(), info.ImageID(), UiUtils::ImageTypeToString(info.Type(), buffer, sizeof(buffer)), textBase, textBase + info.TextSize(), dataBase, @@ -183,7 +183,7 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output, Thread* thread) BString data; for (int32 i = 0; StackFrame* frame = trace->FrameAt(i); i++) { char functionName[512]; - data.SetToFormat("\t\t0x%08" B_PRIx64 "\t0x%08" B_PRIx64 "\t%s\n", + data.SetToFormat("\t\t%#08" B_PRIx64 "\t%#08" B_PRIx64 "\t%s\n", frame->FrameAddress(), frame->InstructionPointer(), UiUtils::FunctionNameForFrame(frame, functionName, sizeof(functionName))); diff --git a/src/apps/debugger/user_interface/cli/CliStackTraceCommand.cpp b/src/apps/debugger/user_interface/cli/CliStackTraceCommand.cpp index 5b5b2e168e..9e7f0330a6 100644 --- a/src/apps/debugger/user_interface/cli/CliStackTraceCommand.cpp +++ b/src/apps/debugger/user_interface/cli/CliStackTraceCommand.cpp @@ -11,9 +11,9 @@ #include #include "CliContext.h" -#include "FunctionInstance.h" #include "StackTrace.h" #include "Team.h" +#include "UiUtils.h" CliStackTraceCommand::CliStackTraceCommand() @@ -63,24 +63,9 @@ CliStackTraceCommand::Execute(int argc, const char* const* argv, printf("%3" B_PRId32 " %#" B_PRIx64 " %#" B_PRIx64, i, (uint64)frame->FrameAddress(), (uint64)frame->InstructionPointer()); - Image* image = frame->GetImage(); - FunctionInstance* function = frame->Function(); - if (image == NULL && function == NULL) { - printf(" ???\n"); - continue; - } - - BString name; - target_addr_t baseAddress; - if (function != NULL) { - name = function->PrettyName(); - baseAddress = function->Address(); - } else { - name = image->Name(); - baseAddress = image->Info().TextBase(); - } - - printf(" %s + %#" B_PRIx64 "\n", name.String(), - uint64(frame->InstructionPointer() - baseAddress)); + char functionName[512]; + UiUtils::FunctionNameForFrame(frame, functionName, + sizeof(functionName)); + printf(" %s\n", functionName); } }