Displaying (unformatted) function code.
This commit is contained in:
32
src/alloy/runtime/debug_info.cc
Normal file
32
src/alloy/runtime/debug_info.cc
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* 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/debug_info.h>
|
||||
|
||||
using namespace alloy;
|
||||
using namespace alloy::runtime;
|
||||
|
||||
|
||||
DebugInfo::DebugInfo() :
|
||||
source_disasm_(0),
|
||||
raw_hir_disasm_(0),
|
||||
hir_disasm_(0),
|
||||
raw_lir_disasm_(0),
|
||||
lir_disasm_(0),
|
||||
machine_code_disasm_(0) {
|
||||
}
|
||||
|
||||
DebugInfo::~DebugInfo() {
|
||||
xe_free(source_disasm_);
|
||||
xe_free(raw_hir_disasm_);
|
||||
xe_free(hir_disasm_);
|
||||
xe_free(raw_lir_disasm_);
|
||||
xe_free(lir_disasm_);
|
||||
xe_free(machine_code_disasm_);
|
||||
}
|
||||
57
src/alloy/runtime/debug_info.h
Normal file
57
src/alloy/runtime/debug_info.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* 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_DEBUG_INFO_H_
|
||||
#define ALLOY_RUNTIME_DEBUG_INFO_H_
|
||||
|
||||
#include <alloy/core.h>
|
||||
|
||||
|
||||
namespace alloy {
|
||||
namespace runtime {
|
||||
|
||||
|
||||
class DebugInfo {
|
||||
public:
|
||||
DebugInfo();
|
||||
~DebugInfo();
|
||||
|
||||
const char* source_disasm() const { return source_disasm_; }
|
||||
void set_source_disasm(char* value) { source_disasm_ = value; }
|
||||
const char* raw_hir_disasm() const { return raw_hir_disasm_; }
|
||||
void set_raw_hir_disasm(char* value) { raw_hir_disasm_ = value; }
|
||||
const char* hir_disasm() const { return hir_disasm_; }
|
||||
void set_hir_disasm(char* value) { hir_disasm_ = value; }
|
||||
const char* raw_lir_disasm() const { return raw_lir_disasm_; }
|
||||
void set_raw_lir_disasm(char* value) { raw_lir_disasm_ = value; }
|
||||
const char* lir_disasm() const { return lir_disasm_; }
|
||||
void set_lir_disasm(char* value) { lir_disasm_ = value; }
|
||||
const char* machine_code_disasm() const { return machine_code_disasm_; }
|
||||
void set_machine_code_disasm(char* value) { machine_code_disasm_ = value; }
|
||||
|
||||
// map functions: source addr -> hir index (raw?)
|
||||
// hir index (raw?) to lir index (raw?)
|
||||
// lir index (raw?) to machine code offset
|
||||
// source -> machine code offset
|
||||
|
||||
private:
|
||||
char* source_disasm_;
|
||||
char* raw_hir_disasm_;
|
||||
char* hir_disasm_;
|
||||
char* raw_lir_disasm_;
|
||||
char* lir_disasm_;
|
||||
char* machine_code_disasm_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace runtime
|
||||
} // namespace alloy
|
||||
|
||||
|
||||
#endif // ALLOY_RUNTIME_DEBUG_INFO_H_
|
||||
@@ -17,7 +17,7 @@ using namespace alloy::runtime;
|
||||
|
||||
|
||||
Function::Function(Type type, uint64_t address) :
|
||||
type_(type), address_(address) {
|
||||
type_(type), address_(address), debug_info_(0) {
|
||||
}
|
||||
|
||||
Function::~Function() {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#define ALLOY_RUNTIME_FUNCTION_H_
|
||||
|
||||
#include <alloy/core.h>
|
||||
#include <alloy/runtime/debug_info.h>
|
||||
|
||||
|
||||
namespace alloy {
|
||||
@@ -34,6 +35,9 @@ public:
|
||||
Type type() const { return type_; }
|
||||
uint64_t address() const { return address_; }
|
||||
|
||||
DebugInfo* debug_info() const { return debug_info_; }
|
||||
void set_debug_info(DebugInfo* debug_info) { debug_info_ = debug_info; }
|
||||
|
||||
int Call(ThreadState* thread_state, uint64_t return_address);
|
||||
|
||||
protected:
|
||||
@@ -42,6 +46,7 @@ protected:
|
||||
protected:
|
||||
Type type_;
|
||||
uint64_t address_;
|
||||
DebugInfo* debug_info_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Copyright 2013 Ben Vanik. All Rights Reserved.
|
||||
{
|
||||
'sources': [
|
||||
'debug_info.cc',
|
||||
'debug_info.h',
|
||||
'entry_table.cc',
|
||||
'entry_table.h',
|
||||
'function.cc',
|
||||
|
||||
Reference in New Issue
Block a user