* TeamMemoryBlock: Now stores whether or not the block it represents is writable.
* RetrieveMemoryBlockJob: Make use of get_memory_properties() to retrieve the block's protection bits and mark it appropriately. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42132 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,7 +3,7 @@ SubDir HAIKU_TOP src apps debugger ;
|
|||||||
CCFLAGS += -Werror ;
|
CCFLAGS += -Werror ;
|
||||||
C++FLAGS += -Werror ;
|
C++FLAGS += -Werror ;
|
||||||
|
|
||||||
UsePrivateHeaders debug interface kernel shared ;
|
UsePrivateHeaders debug interface kernel shared libroot ;
|
||||||
UsePrivateSystemHeaders ;
|
UsePrivateSystemHeaders ;
|
||||||
|
|
||||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) arch ] ;
|
SEARCH_SOURCE += [ FDirName $(SUBDIR) arch ] ;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "Jobs.h"
|
#include "Jobs.h"
|
||||||
|
|
||||||
#include <AutoLocker.h>
|
#include <AutoLocker.h>
|
||||||
|
#include <memory_private.h>
|
||||||
|
|
||||||
#include "Architecture.h"
|
#include "Architecture.h"
|
||||||
#include "BitBuffer.h"
|
#include "BitBuffer.h"
|
||||||
@@ -637,10 +638,11 @@ ResolveValueNodeValueJob::_ResolveParentNodeValue(ValueNode* parentNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RetrieveMemoryBlockJob::RetrieveMemoryBlockJob(TeamMemory* teamMemory,
|
RetrieveMemoryBlockJob::RetrieveMemoryBlockJob(Team* team,
|
||||||
TeamMemoryBlock* memoryBlock)
|
TeamMemory* teamMemory, TeamMemoryBlock* memoryBlock)
|
||||||
:
|
:
|
||||||
fKey(memoryBlock, JOB_TYPE_GET_MEMORY_BLOCK),
|
fKey(memoryBlock, JOB_TYPE_GET_MEMORY_BLOCK),
|
||||||
|
fTeam(team),
|
||||||
fTeamMemory(teamMemory),
|
fTeamMemory(teamMemory),
|
||||||
fMemoryBlock(memoryBlock)
|
fMemoryBlock(memoryBlock)
|
||||||
{
|
{
|
||||||
@@ -664,12 +666,19 @@ RetrieveMemoryBlockJob::Key() const
|
|||||||
status_t
|
status_t
|
||||||
RetrieveMemoryBlockJob::Do()
|
RetrieveMemoryBlockJob::Do()
|
||||||
{
|
{
|
||||||
|
|
||||||
ssize_t result = fTeamMemory->ReadMemory(fMemoryBlock->BaseAddress(),
|
ssize_t result = fTeamMemory->ReadMemory(fMemoryBlock->BaseAddress(),
|
||||||
fMemoryBlock->Data(), fMemoryBlock->Size());
|
fMemoryBlock->Data(), fMemoryBlock->Size());
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
uint32 protection = 0;
|
||||||
|
uint32 locking = 0;
|
||||||
|
status_t error = get_memory_properties(fTeam->ID(),
|
||||||
|
(const void *)fMemoryBlock->BaseAddress(), &protection, &locking);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
fMemoryBlock->SetWritable((protection & B_WRITE_AREA) != 0);
|
||||||
fMemoryBlock->MarkValid();
|
fMemoryBlock->MarkValid();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ private:
|
|||||||
|
|
||||||
class RetrieveMemoryBlockJob : public Job {
|
class RetrieveMemoryBlockJob : public Job {
|
||||||
public:
|
public:
|
||||||
RetrieveMemoryBlockJob(
|
RetrieveMemoryBlockJob(Team* team,
|
||||||
TeamMemory* teamMemory,
|
TeamMemory* teamMemory,
|
||||||
TeamMemoryBlock* memoryBlock);
|
TeamMemoryBlock* memoryBlock);
|
||||||
virtual ~RetrieveMemoryBlockJob();
|
virtual ~RetrieveMemoryBlockJob();
|
||||||
@@ -194,6 +194,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SimpleJobKey fKey;
|
SimpleJobKey fKey;
|
||||||
|
Team* fTeam;
|
||||||
TeamMemory* fTeamMemory;
|
TeamMemory* fTeamMemory;
|
||||||
TeamMemoryBlock* fMemoryBlock;
|
TeamMemoryBlock* fMemoryBlock;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1338,7 +1338,8 @@ TeamDebugger::_HandleInspectAddress(target_addr_t address,
|
|||||||
// schedule the job
|
// schedule the job
|
||||||
status_t result;
|
status_t result;
|
||||||
if ((result = fWorker->ScheduleJob(
|
if ((result = fWorker->ScheduleJob(
|
||||||
new(std::nothrow) RetrieveMemoryBlockJob(memory, memoryBlock),
|
new(std::nothrow) RetrieveMemoryBlockJob(fTeam, memory,
|
||||||
|
memoryBlock),
|
||||||
this)) != B_OK) {
|
this)) != B_OK) {
|
||||||
memoryBlock->ReleaseReference();
|
memoryBlock->ReleaseReference();
|
||||||
_NotifyUser("Inspect Address", "Failed to retrieve memory data: %s",
|
_NotifyUser("Inspect Address", "Failed to retrieve memory data: %s",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ TeamMemoryBlock::TeamMemoryBlock(target_addr_t baseAddress,
|
|||||||
TeamMemoryBlockOwner* owner)
|
TeamMemoryBlockOwner* owner)
|
||||||
:
|
:
|
||||||
fValid(false),
|
fValid(false),
|
||||||
|
fWritable(false),
|
||||||
fBaseAddress(baseAddress),
|
fBaseAddress(baseAddress),
|
||||||
fBlockOwner(owner)
|
fBlockOwner(owner)
|
||||||
{
|
{
|
||||||
@@ -76,6 +77,13 @@ TeamMemoryBlock::Invalidate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TeamMemoryBlock::SetWritable(bool writable)
|
||||||
|
{
|
||||||
|
fWritable = writable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TeamMemoryBlock::NotifyDataRetrieved()
|
TeamMemoryBlock::NotifyDataRetrieved()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ public:
|
|||||||
uint8* Data() { return fData; };
|
uint8* Data() { return fData; };
|
||||||
size_t Size() const { return sizeof(fData); };
|
size_t Size() const { return sizeof(fData); };
|
||||||
|
|
||||||
|
bool IsWritable() const { return fWritable; }
|
||||||
|
void SetWritable(bool writable);
|
||||||
|
|
||||||
void NotifyDataRetrieved();
|
void NotifyDataRetrieved();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -50,6 +53,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool fValid;
|
bool fValid;
|
||||||
|
bool fWritable;
|
||||||
target_addr_t fBaseAddress;
|
target_addr_t fBaseAddress;
|
||||||
uint8 fData[B_PAGE_SIZE];
|
uint8 fData[B_PAGE_SIZE];
|
||||||
ListenerList fListeners;
|
ListenerList fListeners;
|
||||||
|
|||||||
Reference in New Issue
Block a user