Debugger: Cleanups, no functional change.

- Add virtual hook to TeamMemory for retrieving area information
  from the target team.
- Implement said hook in DebuggerInterface.
- Adjust RetrieveMemoryBlockJob to use said hook to retrieve the
  writable state of the target block rather than calling
  get_memory_properties() directly.
This commit is contained in:
Rene Gollent
2015-05-25 21:44:14 -04:00
parent 444a32d53b
commit d281548a33
4 changed files with 20 additions and 4 deletions
@@ -13,6 +13,7 @@
#include <Locker.h> #include <Locker.h>
#include <AutoLocker.h> #include <AutoLocker.h>
#include <memory_private.h>
#include <OS.h> #include <OS.h>
#include <system_info.h> #include <system_info.h>
#include <util/DoublyLinkedList.h> #include <util/DoublyLinkedList.h>
@@ -708,6 +709,15 @@ DebuggerInterface::GetCpuFeatures(uint32& flags)
} }
status_t
DebuggerInterface::GetMemoryProperties(target_addr_t address,
uint32& protection, uint32& locking)
{
return get_memory_properties(fTeamID, (const void *)address,
&protection, &locking);
}
ssize_t ssize_t
DebuggerInterface::ReadMemory(target_addr_t address, void* buffer, size_t size) DebuggerInterface::ReadMemory(target_addr_t address, void* buffer, size_t size)
{ {
@@ -1,6 +1,6 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2010-2013, Rene Gollent, [email protected]. * Copyright 2010-2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef DEBUGGER_INTERFACE_H #ifndef DEBUGGER_INTERFACE_H
@@ -83,6 +83,9 @@ public:
virtual status_t GetCpuFeatures(uint32& flags); virtual status_t GetCpuFeatures(uint32& flags);
// TeamMemory // TeamMemory
virtual status_t GetMemoryProperties(target_addr_t address,
uint32& protection, uint32& locking);
virtual ssize_t ReadMemory(target_addr_t address, void* buffer, virtual ssize_t ReadMemory(target_addr_t address, void* buffer,
size_t size); size_t size);
virtual ssize_t WriteMemory(target_addr_t address, virtual ssize_t WriteMemory(target_addr_t address,
@@ -7,7 +7,6 @@
#include "Jobs.h" #include "Jobs.h"
#include <AutoLocker.h> #include <AutoLocker.h>
#include <memory_private.h>
#include "Team.h" #include "Team.h"
#include "TeamMemory.h" #include "TeamMemory.h"
@@ -53,8 +52,8 @@ RetrieveMemoryBlockJob::Do()
uint32 protection = 0; uint32 protection = 0;
uint32 locking = 0; uint32 locking = 0;
status_t error = get_memory_properties(fTeam->ID(), status_t error = fTeamMemory->GetMemoryProperties(
(const void *)fMemoryBlock->BaseAddress(), &protection, &locking); fMemoryBlock->BaseAddress(), protection, locking);
if (error != B_OK) { if (error != B_OK) {
fMemoryBlock->NotifyDataRetrieved(error); fMemoryBlock->NotifyDataRetrieved(error);
return error; return error;
+4
View File
@@ -1,4 +1,5 @@
/* /*
* Copyright 2015, Rene Gollent, [email protected].
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -19,6 +20,9 @@ public:
virtual ~TeamMemory(); virtual ~TeamMemory();
virtual status_t GetMemoryProperties(target_addr_t baseAddress,
uint32& protection, uint32& locking) = 0;
virtual ssize_t ReadMemory(target_addr_t address, void* buffer, virtual ssize_t ReadMemory(target_addr_t address, void* buffer,
size_t size) = 0; size_t size) = 0;
virtual status_t ReadMemoryString(target_addr_t address, virtual status_t ReadMemoryString(target_addr_t address,