From bcbd46eba3910ee7769bfa415a69b3903cff787f Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 18 Jul 2009 23:19:08 +0000 Subject: [PATCH] Added SetPieceAt() and Dump() methods. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31635 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/types/ValueLocation.cpp | 39 +++++++++++++++++++++++ src/apps/debugger/types/ValueLocation.h | 4 +++ 2 files changed, 43 insertions(+) diff --git a/src/apps/debugger/types/ValueLocation.cpp b/src/apps/debugger/types/ValueLocation.cpp index cbd71d72a3..24acd6aba0 100644 --- a/src/apps/debugger/types/ValueLocation.cpp +++ b/src/apps/debugger/types/ValueLocation.cpp @@ -56,9 +56,48 @@ ValueLocation::PieceAt(int32 index) const } +void +ValueLocation::SetPieceAt(int32 index, const ValuePieceLocation& piece) +{ + if (index < 0 || index >= fPieces.Size()) + return; + + fPieces.ElementAt(index) = piece; +} + + ValueLocation& ValueLocation::operator=(const ValueLocation& other) { fPieces = other.fPieces; return *this; } + + +void +ValueLocation::Dump() const +{ + int32 count = fPieces.Size(); + printf("ValueLocation: %ld pieces:\n", count); + + for (int32 i = 0; i < count; i++) { + const ValuePieceLocation& piece = fPieces[i]; + switch (piece.type) { + case VALUE_PIECE_LOCATION_INVALID: + printf(" invalid\n"); + continue; + case VALUE_PIECE_LOCATION_UNKNOWN: + printf(" unknown"); + break; + case VALUE_PIECE_LOCATION_MEMORY: + printf(" address %#llx", piece.address); + break; + case VALUE_PIECE_LOCATION_REGISTER: + printf(" register %lu", piece.reg); + break; + } + + printf(" size: %llu+%u, offset: %u\n", piece.size, piece.bitSize, + piece.bitOffset); + } +} diff --git a/src/apps/debugger/types/ValueLocation.h b/src/apps/debugger/types/ValueLocation.h index e437f5be92..f9ac47c756 100644 --- a/src/apps/debugger/types/ValueLocation.h +++ b/src/apps/debugger/types/ValueLocation.h @@ -85,9 +85,13 @@ public: int32 CountPieces() const; ValuePieceLocation PieceAt(int32 index) const; + void SetPieceAt(int32 index, + const ValuePieceLocation& piece); ValueLocation& operator=(const ValueLocation& other); + void Dump() const; + private: typedef Array PieceArray;