From 9a4802db55d5e9a02cbc2983b2bf74f2a16bf0a5 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 18 Dec 2012 23:30:18 -0500 Subject: [PATCH] Add an indent parameter to DumpMemory(). - Adjust callers. --- .../user_interface/cli/CliDumpMemoryCommand.cpp | 2 +- src/apps/debugger/user_interface/util/UiUtils.cpp | 10 +++++++--- src/apps/debugger/user_interface/util/UiUtils.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/apps/debugger/user_interface/cli/CliDumpMemoryCommand.cpp b/src/apps/debugger/user_interface/cli/CliDumpMemoryCommand.cpp index cd9049a1c2..4d8c7d8b66 100644 --- a/src/apps/debugger/user_interface/cli/CliDumpMemoryCommand.cpp +++ b/src/apps/debugger/user_interface/cli/CliDumpMemoryCommand.cpp @@ -120,7 +120,7 @@ CliDumpMemoryCommand::Execute(int argc, const char* const* argv, printf("\"\n"); } else { BString output; - UiUtils::DumpMemory(output, block, address, itemSize, displayWidth, + UiUtils::DumpMemory(output, 0, block, address, itemSize, displayWidth, num); printf("%s\n", output.String()); } diff --git a/src/apps/debugger/user_interface/util/UiUtils.cpp b/src/apps/debugger/user_interface/util/UiUtils.cpp index 28418222a9..2b3e2d157f 100644 --- a/src/apps/debugger/user_interface/util/UiUtils.cpp +++ b/src/apps/debugger/user_interface/util/UiUtils.cpp @@ -230,19 +230,23 @@ UiUtils::PrintValueNodeGraph(BString& _output, ValueNodeChild* child, } -/*static*/ void UiUtils::DumpMemory(BString& _output, TeamMemoryBlock* block, - target_addr_t address, int32 itemSize, int32 displayWidth, int32 count) +/*static*/ void UiUtils::DumpMemory(BString& _output, int32 indentLevel, + TeamMemoryBlock* block, target_addr_t address, int32 itemSize, + int32 displayWidth, int32 count) { BString data; int32 j; + _output.Append('\t', indentLevel); for (int32 i = 0; i < count; i++) { uint8* value; if ((i % displayWidth) == 0) { int32 displayed = min_c(displayWidth, (count-i)) * itemSize; - if (i != 0) + if (i != 0) { _output.Append("\n"); + _output.Append('\t', indentLevel); + } data.SetToFormat("[%#" B_PRIx64 "] ", address + i * itemSize); _output += data; diff --git a/src/apps/debugger/user_interface/util/UiUtils.h b/src/apps/debugger/user_interface/util/UiUtils.h index cffb70043e..7f6447d06e 100644 --- a/src/apps/debugger/user_interface/util/UiUtils.h +++ b/src/apps/debugger/user_interface/util/UiUtils.h @@ -42,6 +42,7 @@ public: int32 indentLevel, int32 maxDepth); static void DumpMemory(BString& _output, + int32 indentLevel, TeamMemoryBlock* block, target_addr_t address, int32 itemSize, int32 displayWidth, int32 count);