blob: 92783dcf28351459b3cbf3ce9dea1898d1be5ed4 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 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
*******************************************************************************/
#ifndef BREAKPOINTSERVICE_H_
#define BREAKPOINTSERVICE_H_
#include <map>
#include <string>
#include <vector>
#include "TCFService.h"
#include "TCFContext.h"
struct Protocol;
struct Channel;
//
// To store the breakpoint info
//
struct TBreakpoint
{
std::vector<std::string> iContextIds;
HANDLE procHandle; // Win32 handle of the hosting process
std::string hostBreakPointId; // breakpoint ID from host debugger.
ContextAddress address;
bool enabled;
unsigned char originalByte; // original byte where we set the bp.
TBreakpoint(): address(0), enabled(true), originalByte(0)
{}
};
typedef std::map<std::string, TBreakpoint*> TID2BreakpointMap;
/*
* A list of breakpoints in all processes in the debug session.
*/
static TID2BreakpointMap sBreakPointMap;
//
// Breakpoint service implementation
//
class BreakpointsService: public TCFService
{
public:
BreakpointsService(Protocol * proto);
const char* GetName();
static void CommandAddBreakpoint(const char *, Channel *);
static void CommandRemoveBreakpoint(const char *, Channel *);
static int InsertBreak(const TBreakpoint* bpInfo);
static int ClearBreak(const TBreakpoint* bpInfo);
static TBreakpoint* FindBreakpointByAddress(HANDLE processHandle, unsigned long address);
static void RemoveBreakpointsFromMemoryRead(HANDLE, ContextAddress, char*, unsigned long);
static void ReInsertBreakpointsAfterMemoryWrite(HANDLE, ContextAddress, char*, unsigned long);
static bool ServiceInstalled();
private:
static bool sServiceInstalled;
};
#endif /* BREAKPOINTSERVICE_H_ */