Debugger: Add page protection indicator to inspector.
InspectorWindow: - We now display a label indicating if the currently inspected block is writable or not, so the user knows whether it's possible to modify the contents.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
|
#include <StringView.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
|
|
||||||
#include "Architecture.h"
|
#include "Architecture.h"
|
||||||
@@ -37,11 +38,12 @@ InspectorWindow::InspectorWindow(::Team* team, UserInterfaceListener* listener,
|
|||||||
BHandler* target)
|
BHandler* target)
|
||||||
:
|
:
|
||||||
BWindow(BRect(100, 100, 700, 500), "Inspector", B_TITLED_WINDOW,
|
BWindow(BRect(100, 100, 700, 500), "Inspector", B_TITLED_WINDOW,
|
||||||
B_ASYNCHRONOUS_CONTROLS),
|
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
|
||||||
fListener(listener),
|
fListener(listener),
|
||||||
fAddressInput(NULL),
|
fAddressInput(NULL),
|
||||||
fHexMode(NULL),
|
fHexMode(NULL),
|
||||||
fTextMode(NULL),
|
fTextMode(NULL),
|
||||||
|
fWritableBlockIndicator(NULL),
|
||||||
fMemoryView(NULL),
|
fMemoryView(NULL),
|
||||||
fCurrentBlock(NULL),
|
fCurrentBlock(NULL),
|
||||||
fCurrentAddress(0LL),
|
fCurrentAddress(0LL),
|
||||||
@@ -163,6 +165,11 @@ InspectorWindow::_Init()
|
|||||||
.End()
|
.End()
|
||||||
.Add(scrollView = new BScrollView("memory scroll",
|
.Add(scrollView = new BScrollView("memory scroll",
|
||||||
NULL, 0, false, true), 3.0f)
|
NULL, 0, false, true), 3.0f)
|
||||||
|
.AddGroup(B_HORIZONTAL)
|
||||||
|
.Add(fWritableBlockIndicator = new BStringView("writableIndicator",
|
||||||
|
_GetCurrentWritableIndicator()))
|
||||||
|
.AddGlue()
|
||||||
|
.End()
|
||||||
.End();
|
.End();
|
||||||
|
|
||||||
fHexMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fHexMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
@@ -514,4 +521,23 @@ InspectorWindow::_SetCurrentBlock(TeamMemoryBlock* block)
|
|||||||
|
|
||||||
fCurrentBlock = block;
|
fCurrentBlock = block;
|
||||||
fMemoryView->SetTargetAddress(fCurrentBlock, fCurrentAddress);
|
fMemoryView->SetTargetAddress(fCurrentBlock, fCurrentAddress);
|
||||||
|
_UpdateWritableIndicator();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
InspectorWindow::_UpdateWritableIndicator()
|
||||||
|
{
|
||||||
|
fWritableBlockIndicator->SetText(_GetCurrentWritableIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
InspectorWindow::_GetCurrentWritableIndicator() const
|
||||||
|
{
|
||||||
|
static char buffer[32];
|
||||||
|
snprintf(buffer, sizeof(buffer), "Writable: %s", fCurrentBlock == NULL
|
||||||
|
? "N/A" : fCurrentBlock->IsWritable() ? "Yes" : "No");
|
||||||
|
|
||||||
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011-2014, Rene Gollent, [email protected]. All rights reserved.
|
* Copyright 2011-2015, Rene Gollent, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef INSPECTOR_WINDOW_H
|
#ifndef INSPECTOR_WINDOW_H
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
class BButton;
|
class BButton;
|
||||||
class BMenuField;
|
class BMenuField;
|
||||||
class BMessenger;
|
class BMessenger;
|
||||||
|
class BStringView;
|
||||||
class BTextControl;
|
class BTextControl;
|
||||||
class GuiTeamUiSettings;
|
class GuiTeamUiSettings;
|
||||||
class SourceLanguage;
|
class SourceLanguage;
|
||||||
@@ -75,12 +76,16 @@ private:
|
|||||||
void _SetToAddress(target_addr_t address);
|
void _SetToAddress(target_addr_t address);
|
||||||
void _SetCurrentBlock(TeamMemoryBlock* block);
|
void _SetCurrentBlock(TeamMemoryBlock* block);
|
||||||
|
|
||||||
|
void _UpdateWritableIndicator();
|
||||||
|
const char* _GetCurrentWritableIndicator() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UserInterfaceListener* fListener;
|
UserInterfaceListener* fListener;
|
||||||
BTextControl* fAddressInput;
|
BTextControl* fAddressInput;
|
||||||
BMenuField* fHexMode;
|
BMenuField* fHexMode;
|
||||||
BMenuField* fEndianMode;
|
BMenuField* fEndianMode;
|
||||||
BMenuField* fTextMode;
|
BMenuField* fTextMode;
|
||||||
|
BStringView* fWritableBlockIndicator;
|
||||||
MemoryView* fMemoryView;
|
MemoryView* fMemoryView;
|
||||||
BButton* fPreviousBlockButton;
|
BButton* fPreviousBlockButton;
|
||||||
BButton* fNextBlockButton;
|
BButton* fNextBlockButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user