From a5e54e1bcf9e589786ef3295f1d8a87a4d4a9bd4 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 4 Apr 2013 15:14:02 -0400 Subject: [PATCH] Add model classes for representing area information. --- src/apps/debugger/Jamfile | 1 + src/apps/debugger/model/AreaInfo.cpp | 67 ++++++++++++++++++++++++++++ src/apps/debugger/model/AreaInfo.h | 51 +++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 src/apps/debugger/model/AreaInfo.cpp create mode 100644 src/apps/debugger/model/AreaInfo.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 053121c22a..3a84c23ce8 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -139,6 +139,7 @@ Application Debugger : RetrieveMemoryBlockJob.cpp # model + AreaInfo.cpp Breakpoint.cpp DisassembledCode.cpp FileSourceCode.cpp diff --git a/src/apps/debugger/model/AreaInfo.cpp b/src/apps/debugger/model/AreaInfo.cpp new file mode 100644 index 0000000000..ee1a856324 --- /dev/null +++ b/src/apps/debugger/model/AreaInfo.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ + + +#include "AreaInfo.h" + + +AreaInfo::AreaInfo() + : + fTeam(-1), + fArea(-1), + fName(), + fAddress(0), + fSize(0), + fRamSize(0), + fLock(0), + fProtection(0) +{ +} + + +AreaInfo::AreaInfo(const AreaInfo &other) + : + fTeam(other.fTeam), + fArea(other.fArea), + fName(other.fName), + fAddress(other.fAddress), + fSize(other.fSize), + fRamSize(other.fRamSize), + fLock(other.fLock), + fProtection(other.fProtection) +{ +} + + +AreaInfo::AreaInfo(team_id team, area_id area, const BString& name, + target_addr_t address, target_size_t size, target_size_t ramSize, + uint32 lock, uint32 protection) + : + fTeam(team), + fArea(area), + fName(name), + fAddress(address), + fSize(size), + fRamSize(ramSize), + fLock(lock), + fProtection(protection) +{ +} + + +void +AreaInfo::SetTo(team_id team, area_id area, const BString& name, + target_addr_t address, target_size_t size, target_size_t ramSize, + uint32 lock, uint32 protection) +{ + fTeam = team; + fArea = area; + fName = name; + fAddress = address; + fSize = size; + fRamSize = ramSize; + fLock = lock; + fProtection = protection; +} diff --git a/src/apps/debugger/model/AreaInfo.h b/src/apps/debugger/model/AreaInfo.h new file mode 100644 index 0000000000..660673e917 --- /dev/null +++ b/src/apps/debugger/model/AreaInfo.h @@ -0,0 +1,51 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef AREA_INFO_H +#define AREA_INFO_H + +#include +#include + +#include "Types.h" + + +class AreaInfo { +public: + AreaInfo(); + AreaInfo(const AreaInfo& other); + AreaInfo(team_id team, area_id area, + const BString& name, target_addr_t address, + target_size_t size, target_size_t ram_size, + uint32 lock, uint32 protection); + + void SetTo(team_id team, area_id area, + const BString& name, target_addr_t address, + target_size_t size, target_size_t ram_size, + uint32 lock, uint32 protection); + + team_id TeamID() const { return fTeam; } + area_id AreaID() const { return fArea; } + const BString& Name() const { return fName; } + + target_addr_t BaseAddress() const { return fAddress; } + target_size_t Size() const { return fSize; } + target_size_t RamSize() const { return fRamSize; } + uint32 Lock() const { return fLock; } + uint32 Protection() const { return fProtection; } + + +private: + team_id fTeam; + area_id fArea; + BString fName; + target_addr_t fAddress; + target_size_t fSize; + target_size_t fRamSize; + uint32 fLock; + uint32 fProtection; +}; + + +#endif // AREA_INFO_H