Make the memory view properly handle the target address size.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42255 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -37,11 +37,14 @@ MemoryView::MemoryView(::Team* team)
|
|||||||
fLineHeight(0.0),
|
fLineHeight(0.0),
|
||||||
fTextCharsPerLine(0),
|
fTextCharsPerLine(0),
|
||||||
fHexBlocksPerLine(0),
|
fHexBlocksPerLine(0),
|
||||||
fCurrentEndianMode(team->GetArchitecture()->IsBigEndian()
|
|
||||||
? EndianModeBigEndian : EndianModeLittleEndian),
|
|
||||||
fHexMode(HexMode8BitInt),
|
fHexMode(HexMode8BitInt),
|
||||||
fTextMode(TextModeASCII)
|
fTextMode(TextModeASCII)
|
||||||
{
|
{
|
||||||
|
Architecture* architecture = team->GetArchitecture();
|
||||||
|
fTargetAddressSize = architecture->AddressSize() * 2;
|
||||||
|
fCurrentEndianMode = architecture->IsBigEndian()
|
||||||
|
? EndianModeBigEndian : EndianModeLittleEndian;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -133,17 +136,17 @@ MemoryView::Draw(BRect rect)
|
|||||||
rgb_color dataColor = HighColor();
|
rgb_color dataColor = HighColor();
|
||||||
font_height fh;
|
font_height fh;
|
||||||
GetFontHeight(&fh);
|
GetFontHeight(&fh);
|
||||||
uint32 lineAddress = (uint32)fTargetBlock->BaseAddress() + startLine
|
target_addr_t lineAddress = fTargetBlock->BaseAddress() + startLine
|
||||||
* currentCharsPerLine;
|
* currentCharsPerLine;
|
||||||
for (; currentAddress < maxAddress && drawPoint.y < rect.bottom
|
for (; currentAddress < maxAddress && drawPoint.y < rect.bottom
|
||||||
+ fLineHeight; drawPoint.y += fLineHeight) {
|
+ fLineHeight; drawPoint.y += fLineHeight) {
|
||||||
drawPoint.x = 1.0;
|
drawPoint.x = 1.0;
|
||||||
snprintf(buffer, sizeof(buffer), "%" B_PRIx32,
|
snprintf(buffer, sizeof(buffer), "%0*" B_PRIx64,
|
||||||
lineAddress);
|
(int)fTargetAddressSize, lineAddress);
|
||||||
PushState();
|
PushState();
|
||||||
SetHighColor(tint_color(HighColor(), B_LIGHTEN_1_TINT));
|
SetHighColor(tint_color(HighColor(), B_LIGHTEN_1_TINT));
|
||||||
DrawString(buffer, drawPoint);
|
DrawString(buffer, drawPoint);
|
||||||
drawPoint.x += fCharWidth * 10;
|
drawPoint.x += fCharWidth * (fTargetAddressSize + 2);
|
||||||
PopState();
|
PopState();
|
||||||
|
|
||||||
if (fHexMode != HexModeNone) {
|
if (fHexMode != HexModeNone) {
|
||||||
@@ -419,7 +422,8 @@ MemoryView::_RecalcScrollBars()
|
|||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
// the left portion of the view is off limits since it
|
// the left portion of the view is off limits since it
|
||||||
// houses the address offset of the current line
|
// houses the address offset of the current line
|
||||||
float baseWidth = bounds.Width() - (10.0 * fCharWidth);
|
float baseWidth = bounds.Width() - ((fTargetAddressSize + 2)
|
||||||
|
* fCharWidth);
|
||||||
float hexWidth = 0.0;
|
float hexWidth = 0.0;
|
||||||
float textWidth = 0.0;
|
float textWidth = 0.0;
|
||||||
int32 hexDigits = 1 << fHexMode;
|
int32 hexDigits = 1 << fHexMode;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
virtual ~MemoryView();
|
virtual ~MemoryView();
|
||||||
|
|
||||||
static MemoryView* Create(::Team* team);
|
static MemoryView* Create(::Team* team);
|
||||||
// thrws
|
// throws
|
||||||
|
|
||||||
void SetTargetAddress(TeamMemoryBlock* block,
|
void SetTargetAddress(TeamMemoryBlock* block,
|
||||||
target_addr_t address);
|
target_addr_t address);
|
||||||
@@ -77,6 +77,7 @@ private:
|
|||||||
target_addr_t fTargetAddress;
|
target_addr_t fTargetAddress;
|
||||||
float fCharWidth;
|
float fCharWidth;
|
||||||
float fLineHeight;
|
float fLineHeight;
|
||||||
|
int32 fTargetAddressSize;
|
||||||
int32 fTextCharsPerLine;
|
int32 fTextCharsPerLine;
|
||||||
int32 fHexBlocksPerLine;
|
int32 fHexBlocksPerLine;
|
||||||
int32 fCurrentEndianMode;
|
int32 fCurrentEndianMode;
|
||||||
|
|||||||
Reference in New Issue
Block a user