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;