Moving PPC disasm to on-demand in debugger.

This commit is contained in:
Ben Vanik
2015-06-16 20:18:48 -07:00
parent 5f33087a12
commit 165d49ad3a
18 changed files with 389 additions and 337 deletions

View File

@@ -115,7 +115,7 @@ bool X64Assembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
X64Function* fn = new X64Function(symbol_info);
fn->set_debug_info(std::move(debug_info));
fn->Setup(machine_code, code_size);
fn->Setup(reinterpret_cast<uint8_t*>(machine_code), code_size);
*out_function = fn;

View File

@@ -19,15 +19,15 @@ namespace backend {
namespace x64 {
X64Function::X64Function(FunctionInfo* symbol_info)
: Function(symbol_info), machine_code_(nullptr), code_size_(0) {}
: Function(symbol_info), machine_code_(nullptr), machine_code_length_(0) {}
X64Function::~X64Function() {
// machine_code_ is freed by code cache.
}
void X64Function::Setup(void* machine_code, size_t code_size) {
void X64Function::Setup(uint8_t* machine_code, size_t machine_code_length) {
machine_code_ = machine_code;
code_size_ = code_size;
machine_code_length_ = machine_code_length;
}
bool X64Function::AddBreakpointImpl(debug::Breakpoint* breakpoint) {

View File

@@ -24,10 +24,10 @@ class X64Function : public Function {
X64Function(FunctionInfo* symbol_info);
virtual ~X64Function();
void* machine_code() const { return machine_code_; }
size_t code_size() const { return code_size_; }
uint8_t* machine_code() const override { return machine_code_; }
size_t machine_code_length() const override { return machine_code_length_; }
void Setup(void* machine_code, size_t code_size);
void Setup(uint8_t* machine_code, size_t machine_code_length);
protected:
virtual bool AddBreakpointImpl(debug::Breakpoint* breakpoint);
@@ -35,8 +35,8 @@ class X64Function : public Function {
virtual bool CallImpl(ThreadState* thread_state, uint32_t return_address);
private:
void* machine_code_;
size_t code_size_;
uint8_t* machine_code_;
size_t machine_code_length_;
};
} // namespace x64

View File

@@ -37,6 +37,9 @@ class Function {
debug_info_ = std::move(debug_info);
}
virtual uint8_t* machine_code() const = 0;
virtual size_t machine_code_length() const = 0;
bool AddBreakpoint(debug::Breakpoint* breakpoint);
bool RemoveBreakpoint(debug::Breakpoint* breakpoint);