2013-12-23 02:50:14 +01:00
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Copyright 2013 Ben Vanik. All rights reserved. *
|
|
|
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef ALLOY_RUNTIME_DEBUGGER_H_
|
|
|
|
|
#define ALLOY_RUNTIME_DEBUGGER_H_
|
|
|
|
|
|
|
|
|
|
#include <alloy/core.h>
|
|
|
|
|
|
2013-12-23 07:03:06 +01:00
|
|
|
#include <map>
|
|
|
|
|
|
2013-12-23 02:50:14 +01:00
|
|
|
|
|
|
|
|
namespace alloy {
|
|
|
|
|
namespace runtime {
|
|
|
|
|
|
2013-12-23 07:03:06 +01:00
|
|
|
class Function;
|
|
|
|
|
class FunctionInfo;
|
2013-12-23 02:50:14 +01:00
|
|
|
class Runtime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Breakpoint {
|
|
|
|
|
public:
|
|
|
|
|
enum Type {
|
|
|
|
|
TEMP_TYPE,
|
|
|
|
|
CODE_TYPE,
|
|
|
|
|
};
|
|
|
|
|
public:
|
|
|
|
|
Breakpoint(Type type, uint64_t address);
|
|
|
|
|
~Breakpoint();
|
|
|
|
|
|
|
|
|
|
Type type() const { return type_; }
|
|
|
|
|
uint64_t address() const { return address_; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Type type_;
|
|
|
|
|
uint64_t address_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Debugger {
|
|
|
|
|
public:
|
|
|
|
|
Debugger(Runtime* runtime);
|
|
|
|
|
~Debugger();
|
|
|
|
|
|
|
|
|
|
Runtime* runtime() const { return runtime_; }
|
|
|
|
|
|
|
|
|
|
int AddBreakpoint(Breakpoint* breakpoint);
|
|
|
|
|
int RemoveBreakpoint(Breakpoint* breakpoint);
|
2013-12-23 07:03:06 +01:00
|
|
|
void FindBreakpoints(
|
|
|
|
|
uint64_t address, std::vector<Breakpoint*>& out_breakpoints);
|
|
|
|
|
|
|
|
|
|
void OnFunctionDefined(FunctionInfo* symbol_info, Function* function);
|
2013-12-23 02:50:14 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Runtime* runtime_;
|
2013-12-23 07:03:06 +01:00
|
|
|
|
|
|
|
|
Mutex* breakpoints_lock_;
|
|
|
|
|
typedef std::multimap<uint64_t, Breakpoint*> BreakpointsMultimap;
|
|
|
|
|
BreakpointsMultimap breakpoints_;
|
2013-12-23 02:50:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace runtime
|
|
|
|
|
} // namespace alloy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ALLOY_RUNTIME_DEBUGGER_H_
|