Skip to content

Commit

Permalink
Debugger: Cleanups, no functional change.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
anevilyak committed May 26, 2015
1 parent 444a32d commit d281548
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/apps/debugger/debugger_interface/DebuggerInterface.cpp
Expand Up @@ -13,6 +13,7 @@
#include <Locker.h>

#include <AutoLocker.h>
#include <memory_private.h>
#include <OS.h>
#include <system_info.h>
#include <util/DoublyLinkedList.h>
Expand Down Expand Up @@ -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
DebuggerInterface::ReadMemory(target_addr_t address, void* buffer, size_t size)
{
Expand Down
5 changes: 4 additions & 1 deletion src/apps/debugger/debugger_interface/DebuggerInterface.h
@@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2010-2013, Rene Gollent, rene@gollent.com.
* Copyright 2010-2015, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef DEBUGGER_INTERFACE_H
Expand Down Expand Up @@ -83,6 +83,9 @@ class DebuggerInterface : public TeamMemory {
virtual status_t GetCpuFeatures(uint32& flags);

// TeamMemory
virtual status_t GetMemoryProperties(target_addr_t address,
uint32& protection, uint32& locking);

virtual ssize_t ReadMemory(target_addr_t address, void* buffer,
size_t size);
virtual ssize_t WriteMemory(target_addr_t address,
Expand Down
5 changes: 2 additions & 3 deletions src/apps/debugger/jobs/RetrieveMemoryBlockJob.cpp
Expand Up @@ -7,7 +7,6 @@
#include "Jobs.h"

#include <AutoLocker.h>
#include <memory_private.h>

#include "Team.h"
#include "TeamMemory.h"
Expand Down Expand Up @@ -53,8 +52,8 @@ RetrieveMemoryBlockJob::Do()

uint32 protection = 0;
uint32 locking = 0;
status_t error = get_memory_properties(fTeam->ID(),
(const void *)fMemoryBlock->BaseAddress(), &protection, &locking);
status_t error = fTeamMemory->GetMemoryProperties(
fMemoryBlock->BaseAddress(), protection, locking);
if (error != B_OK) {
fMemoryBlock->NotifyDataRetrieved(error);
return error;
Expand Down
4 changes: 4 additions & 0 deletions src/apps/debugger/model/TeamMemory.h
@@ -1,4 +1,5 @@
/*
* Copyright 2015, Rene Gollent, rene@gollent.com.
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
Expand All @@ -19,6 +20,9 @@ class TeamMemory : public BReferenceable {
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,
size_t size) = 0;
virtual status_t ReadMemoryString(target_addr_t address,
Expand Down

0 comments on commit d281548

Please sign in to comment.