Plumbing breakpoints down into alloy Debugger interface.

This commit is contained in:
Ben Vanik
2013-12-22 17:50:14 -08:00
parent e45a7afabc
commit 7098ed3b02
8 changed files with 213 additions and 16 deletions

View File

@@ -0,0 +1,40 @@
/**
******************************************************************************
* 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. *
******************************************************************************
*/
#include <alloy/runtime/debugger.h>
using namespace alloy;
using namespace alloy::runtime;
Breakpoint::Breakpoint(Type type, uint64_t address) :
type_(type), address_(address) {
}
Breakpoint::~Breakpoint() {
}
Debugger::Debugger(Runtime* runtime) :
runtime_(runtime) {
}
Debugger::~Debugger() {
}
int Debugger::AddBreakpoint(Breakpoint* breakpoint) {
return 1;
}
int Debugger::RemoveBreakpoint(Breakpoint* breakpoint) {
return 1;
}
int Debugger::RemoveAllBreakpoints() {
return 1;
}

View File

@@ -0,0 +1,61 @@
/**
******************************************************************************
* 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>
namespace alloy {
namespace runtime {
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);
int RemoveAllBreakpoints();
private:
Runtime* runtime_;
};
} // namespace runtime
} // namespace alloy
#endif // ALLOY_RUNTIME_DEBUGGER_H_

View File

@@ -25,7 +25,7 @@ DEFINE_string(runtime_backend, "any",
Runtime::Runtime(Memory* memory) :
memory_(memory), backend_(0), frontend_(0),
memory_(memory), debugger_(0), backend_(0), frontend_(0),
access_callbacks_(0) {
tracing::Initialize();
modules_lock_ = AllocMutex(10000);
@@ -51,6 +51,7 @@ Runtime::~Runtime() {
delete frontend_;
delete backend_;
delete debugger_;
tracing::Flush();
}
@@ -67,6 +68,9 @@ int Runtime::Initialize(Frontend* frontend, Backend* backend) {
return result;
}
// Create debugger first. Other types hook up to it.
debugger_ = new Debugger(this);
if (frontend_ || backend_) {
return 1;
}

View File

@@ -14,6 +14,7 @@
#include <alloy/memory.h>
#include <alloy/backend/backend.h>
#include <alloy/frontend/frontend.h>
#include <alloy/runtime/debugger.h>
#include <alloy/runtime/entry_table.h>
#include <alloy/runtime/module.h>
#include <alloy/runtime/register_access.h>
@@ -34,6 +35,7 @@ public:
virtual ~Runtime();
Memory* memory() const { return memory_; }
Debugger* debugger() const { return debugger_; }
frontend::Frontend* frontend() const { return frontend_; }
backend::Backend* backend() const { return backend_; }
RegisterAccessCallbacks* access_callbacks() const {
@@ -62,6 +64,8 @@ private:
protected:
Memory* memory_;
Debugger* debugger_;
frontend::Frontend* frontend_;
backend::Backend* backend_;

View File

@@ -1,13 +0,0 @@
# Copyright 2013 Ben Vanik. All Rights Reserved.
{
'sources': [
'simple_context.cc',
'simple_context.h',
'simple_memory.cc',
'simple_memory.h',
'simple_runtime.cc',
'simple_runtime.h',
'simple_thread_state.cc',
'simple_thread_state.h',
],
}

View File

@@ -3,6 +3,8 @@
'sources': [
'debug_info.cc',
'debug_info.h',
'debugger.cc',
'debugger.h',
'entry_table.cc',
'entry_table.h',
'function.cc',
@@ -22,6 +24,5 @@
],
'includes': [
#'simple/sources.gypi',
],
}