/******************************************************************************* | |
* Copyright (c) 2009, 2011 Nokia and others. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v10.html | |
* | |
* Contributors: | |
* Nokia - Initial API and implementation | |
*******************************************************************************/ | |
#pragma once | |
#include "stdafx.h" | |
#include <vector> | |
#include <set> | |
#include "ProcessContext.h" | |
#include "WinDebugMonitor.h" | |
#include "WinHWPageProtMgr.h" | |
#include "WinThread.h" | |
class WinDebugMonitor; | |
class WinProcess : public ProcessContext { | |
public: | |
WinProcess(WinDebugMonitor*, DEBUG_EVENT& debugEvent); | |
WinProcess(DWORD procID, std::string procName); | |
virtual ~WinProcess(void); | |
// | |
// Overrides of RunControlContext | |
// | |
virtual int ReadMemory(const ReadWriteMemoryParams&) throw (AgentException); | |
virtual int WriteMemory(const ReadWriteMemoryParams&) throw (AgentException); | |
virtual void Terminate(const AgentActionParams&) throw (AgentException); | |
virtual void SingleStep(const AgentActionParams&) throw (AgentException); | |
// | |
// end overrides | |
const HANDLE& GetProcessHandle() const; | |
WinDebugMonitor* GetMonitor() const; | |
static WinProcess* GetProcessByID(int processID); | |
std::map<int, Properties>& GetExecutablesByAddress(); | |
int SetWatchpoint(TBreakpoint*); | |
int ClearWatchpoint(TBreakpoint*); | |
size_t SoftwareWatchpointCount() const; | |
private: | |
void Initialize(); | |
friend int WinHWBkptMgr::SetHardwareBreak(TBreakpoint*); | |
void SetDebugRegister(WinHWBkptMgr::DRMask, ContextAddress, WinHWBkptMgr::DRFlags); | |
friend int WinHWBkptMgr::ClearHardwareBreak(TBreakpoint*); | |
void ClearDebugRegister(WinHWBkptMgr::DRMask); | |
bool isRoot_; | |
HANDLE processHandle_; | |
std::string processName_; | |
WinDebugMonitor* monitor_; | |
std::map<int, Properties> executablesByAddress_; | |
static std::map<int, WinProcess*> processIDMap; | |
WinHWBkptMgr hwBkptMgr; | |
friend bool WinThread::HandlePotentialProtctedPage(const DEBUG_EVENT&); | |
friend int WinThread::HandleRestoringProtectedPage(); | |
WinHWPageProtMgr hwPageProtMgr; | |
}; |