Added SetPieceAt() and Dump() methods.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31635 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-07-18 23:19:08 +00:00
parent f3516af2ca
commit bcbd46eba3
2 changed files with 43 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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<ValuePieceLocation> PieceArray;