diff --git a/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj b/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj
index 8be633075..d8e08235b 100644
--- a/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj
+++ b/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj
@@ -106,7 +106,14 @@
-
+
+
+
+
+
+
+
+
@@ -120,8 +127,11 @@
+
+
+
-
+
diff --git a/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj.filters b/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj.filters
index cb7801187..fab11bb67 100644
--- a/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj.filters
+++ b/src/Xenia.Debug.Native/Xenia.Debug.Native.vcxproj.filters
@@ -31,6 +31,15 @@
{e530b0a2-9f4a-4b85-aee8-7185042251b1}
+
+ {3945623c-9ad7-4f3e-9918-b31ede4e115f}
+
+
+ {796d5778-3fc4-42b0-b59a-39340f5b7989}
+
+
+ {d4d6e5f8-e3d4-424e-b195-77fc1b3f5590}
+
@@ -93,9 +102,30 @@
third_party\capstone\arch\X86
-
+
+ src\xenia\base
+
+
+ src\xenia\cpu\frontend
+
+
+ src\xenia\cpu\frontend
+
+
+ src\xenia\base
+
+
+ src\xenia\base
+
+
src\Xenia.Debug.Native
+
+ src\xenia\cpu\frontend
+
+
+ src\xenia\base
+
@@ -131,12 +161,21 @@
third_party\capstone\arch\X86
-
- src\Xenia.Debug.Native
-
src\Xenia.Debug.Native
+
+ src\xenia\base
+
+
+ src\xenia\cpu\frontend
+
+
+ src\Xenia.Debug.Native
+
+
+ src\xenia\cpu\frontend
+
diff --git a/src/Xenia.Debug.Native/disassembler.cc b/src/Xenia.Debug.Native/disassembler.cc
new file mode 100644
index 000000000..26582adc7
--- /dev/null
+++ b/src/Xenia.Debug.Native/disassembler.cc
@@ -0,0 +1,82 @@
+/**
+ ******************************************************************************
+ * Xenia : Xbox 360 Emulator Research Project *
+ ******************************************************************************
+ * Copyright 2015 Ben Vanik. All rights reserved. *
+ * Released under the BSD license - see LICENSE in the root for more details. *
+ ******************************************************************************
+ */
+
+#include "Xenia.Debug.Native/disassembler.h"
+
+#include "xenia/base/byte_order.h"
+#include "xenia/base/string_buffer.h"
+#include "xenia/cpu/frontend/ppc_disasm.h"
+#include "third_party/capstone/include/capstone.h"
+#include "third_party/capstone/include/x86.h"
+
+namespace Xenia {
+namespace Debug {
+namespace Native {
+
+using namespace System;
+using namespace System::Text;
+
+Disassembler::Disassembler()
+ : capstone_handle_(0), string_buffer_(new xe::StringBuffer()) {
+ uintptr_t capstone_handle;
+ if (cs_open(CS_ARCH_X86, CS_MODE_64, &capstone_handle) != CS_ERR_OK) {
+ System::Diagnostics::Debug::Fail("Failed to initialize capstone");
+ return;
+ }
+ capstone_handle_ = capstone_handle;
+ cs_option(capstone_handle_, CS_OPT_SYNTAX, CS_OPT_SYNTAX_INTEL);
+ cs_option(capstone_handle_, CS_OPT_DETAIL, CS_OPT_OFF);
+}
+
+Disassembler::~Disassembler() {
+ if (capstone_handle_) {
+ pin_ptr capstone_handle = &capstone_handle_;
+ cs_close(capstone_handle);
+ }
+ delete string_buffer_;
+}
+
+String^ Disassembler::DisassemblePPC(IntPtr code_address, size_t code_size) {
+ string_buffer_->Reset();
+
+ auto code_base = reinterpret_cast(code_address.ToPointer());
+ for (int i = 0; i < code_size / 4; ++i) {
+ xe::cpu::frontend::InstrData instr;
+ instr.address = uint32_t(code_address.ToInt64()) + i * 4;
+ instr.code = xe::byte_swap(code_base[i]);
+ instr.type = xe::cpu::frontend::GetInstrType(instr.code);
+ string_buffer_->AppendFormat("%.8X %.8X ", instr.address, instr.code);
+ xe::cpu::frontend::DisasmPPC(instr, string_buffer_);
+ string_buffer_->Append("\r\n");
+ }
+
+ return gcnew String(string_buffer_->ToString());
+}
+
+String^ Disassembler::DisassembleX64(IntPtr code_address, size_t code_size) {
+ string_buffer_->Reset();
+
+ auto code_base = reinterpret_cast(code_address.ToPointer());
+ auto code_ptr = code_base;
+ size_t remaining_code_size = code_size;
+ uint64_t address = uint64_t(code_address.ToInt64());
+ cs_insn insn = {0};
+ while (remaining_code_size &&
+ cs_disasm_iter(capstone_handle_, &code_ptr, &remaining_code_size,
+ &address, &insn)) {
+ string_buffer_->AppendFormat("%.8X %-6s %s\n", uint32_t(insn.address),
+ insn.mnemonic, insn.op_str);
+ }
+
+ return gcnew String(string_buffer_->ToString());
+}
+
+} // namespace Native
+} // namespace Debug
+} // namespace Xenia
diff --git a/src/Xenia.Debug.Native/x64_disassembler.h b/src/Xenia.Debug.Native/disassembler.h
similarity index 64%
rename from src/Xenia.Debug.Native/x64_disassembler.h
rename to src/Xenia.Debug.Native/disassembler.h
index 5ac5ecc52..25b5e56b2 100644
--- a/src/Xenia.Debug.Native/x64_disassembler.h
+++ b/src/Xenia.Debug.Native/disassembler.h
@@ -7,11 +7,13 @@
******************************************************************************
*/
-#ifndef XENIA_DEBUG_NATIVE_X64_DISASSEMBLER_H_
-#define XENIA_DEBUG_NATIVE_X64_DISASSEMBLER_H_
+#ifndef XENIA_DEBUG_NATIVE_DISASSEMBLER_H_
+#define XENIA_DEBUG_NATIVE_DISASSEMBLER_H_
#include
+#include "xenia/base/string_buffer.h"
+
namespace Xenia {
namespace Debug {
namespace Native {
@@ -19,20 +21,21 @@ namespace Native {
using namespace System;
using namespace System::Text;
-public ref class X64Disassembler {
+public ref class Disassembler {
public:
- X64Disassembler();
- ~X64Disassembler();
+ Disassembler();
+ ~Disassembler();
- String^ GenerateString(IntPtr code_address, size_t code_size);
+ String^ DisassemblePPC(IntPtr code_address, size_t code_size);
+ String^ DisassembleX64(IntPtr code_address, size_t code_size);
private:
uintptr_t capstone_handle_;
- StringBuilder^ string_builder_;
+ xe::StringBuffer* string_buffer_;
};
} // namespace Native
} // namespace Debug
} // namespace Xenia
-#endif // XENIA_DEBUG_NATIVE_X64_DISASSEMBLER_H_
+#endif // XENIA_DEBUG_NATIVE_DISASSEMBLER_H_
diff --git a/src/Xenia.Debug.Native/x64_disassembler.cc b/src/Xenia.Debug.Native/x64_disassembler.cc
deleted file mode 100644
index 7405a1aad..000000000
--- a/src/Xenia.Debug.Native/x64_disassembler.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- ******************************************************************************
- * Xenia : Xbox 360 Emulator Research Project *
- ******************************************************************************
- * Copyright 2015 Ben Vanik. All rights reserved. *
- * Released under the BSD license - see LICENSE in the root for more details. *
- ******************************************************************************
- */
-
-#include "Xenia.Debug.Native/x64_disassembler.h"
-
-#include "third_party/capstone/include/capstone.h"
-#include "third_party/capstone/include/x86.h"
-
-namespace Xenia {
-namespace Debug {
-namespace Native {
-
-using namespace System;
-using namespace System::Text;
-
-X64Disassembler::X64Disassembler()
- : capstone_handle_(0), string_builder_(gcnew StringBuilder(16 * 1024)) {
- uintptr_t capstone_handle;
- if (cs_open(CS_ARCH_X86, CS_MODE_64, &capstone_handle) != CS_ERR_OK) {
- System::Diagnostics::Debug::Fail("Failed to initialize capstone");
- return;
- }
- capstone_handle_ = capstone_handle;
- cs_option(capstone_handle_, CS_OPT_SYNTAX, CS_OPT_SYNTAX_INTEL);
- cs_option(capstone_handle_, CS_OPT_DETAIL, CS_OPT_OFF);
-}
-
-X64Disassembler::~X64Disassembler() {
- if (capstone_handle_) {
- pin_ptr capstone_handle = &capstone_handle_;
- cs_close(capstone_handle);
- }
-}
-
-String^ X64Disassembler::GenerateString(IntPtr code_address,
- size_t code_size) {
- string_builder_->Clear();
-
- //
-
- return string_builder_->ToString();
-}
-
-} // namespace Native
-} // namespace Debug
-} // namespace Xenia
diff --git a/src/Xenia.Debug/Debugger.cs b/src/Xenia.Debug/Debugger.cs
index 5b1b35518..6769ac848 100644
--- a/src/Xenia.Debug/Debugger.cs
+++ b/src/Xenia.Debug/Debugger.cs
@@ -44,6 +44,8 @@ namespace Xenia.Debug {
private uint nextRequestId = 1;
private FileMappingHandle memoryHandle;
+ private FileMappingHandle codeCacheHandle;
+ private IntPtr codeCachePtr;
public unsafe byte* TranslateVirtual(uint address) {
return (byte*)Memory.VirtualMembase.ToPointer() + address;
@@ -140,7 +142,7 @@ namespace Xenia.Debug {
var attachResponse = new AttachResponse();
response.GetResponseData(attachResponse);
- // Open mmap to share memroy.
+ // Open mmap to share memory.
memoryHandle = FileMapping.OpenFileMapping(
FileMapAccess.FILE_MAP_ALL_ACCESS, false, attachResponse.MemoryFile);
if (memoryHandle.IsInvalid) {
@@ -149,6 +151,19 @@ namespace Xenia.Debug {
return;
}
+ // Open mmap to code cache.
+ codeCacheHandle =
+ FileMapping.OpenFileMapping(FileMapAccess.FILE_MAP_ALL_ACCESS, false,
+ attachResponse.CodeCacheFile);
+ if (codeCacheHandle.IsInvalid) {
+ System.Diagnostics.Debug.Fail("Unable to open target code cache");
+ Detach();
+ return;
+ }
+ codeCachePtr = FileMapping.MapViewOfFileEx(
+ codeCacheHandle, FileMapAccess.FILE_MAP_ALL_ACCESS, 0, 0,
+ attachResponse.CodeCacheSize, attachResponse.CodeCacheBase);
+
// Setup the memory system. This maps the emulator memory into our address
// space.
if (!Memory.InitializeMapping(memoryHandle)) {
@@ -166,6 +181,11 @@ namespace Xenia.Debug {
Memory.UninitializeMapping();
+ if (codeCacheHandle != null) {
+ FileMapping.UnmapViewOfFile(codeCachePtr);
+ codeCacheHandle.Close();
+ codeCacheHandle = null;
+ }
if (memoryHandle != null) {
memoryHandle.Close();
memoryHandle = null;
diff --git a/src/Xenia.Debug/Function.cs b/src/Xenia.Debug/Function.cs
index 692530e4b..dbc807bcd 100644
--- a/src/Xenia.Debug/Function.cs
+++ b/src/Xenia.Debug/Function.cs
@@ -17,6 +17,8 @@ using Xenia.Debug.Utilities;
namespace Xenia.Debug {
public class Function : Changeable {
+ private static Native.Disassembler disassembler = new Native.Disassembler();
+
// status: declared, defined, failed
// behavior: default, prolog, epilog, epilog_return, extern
// extern info?
@@ -25,7 +27,16 @@ namespace Xenia.Debug {
public readonly Module Module;
public readonly ulong Identifier;
public readonly uint AddressStart;
- public readonly uint AddressEnd;
+ public uint AddressEnd {
+ get; private set;
+ }
+
+ public uint MachineCodeStart {
+ get; private set;
+ }
+ public uint MachineCodeEnd {
+ get; private set;
+ }
// source map
@@ -42,17 +53,43 @@ namespace Xenia.Debug {
// caller history
// instruction execution counts
- public string DisasmPpc {
- get; private set;
+ private string disasmPpc;
+ public unsafe string DisasmPpc {
+ get {
+ if (disasmPpc != null) {
+ return disasmPpc;
+ }
+ if (AddressEnd == 0) {
+ return "(unavailable)";
+ }
+ disasmPpc = disassembler.DisassemblePPC(
+ new IntPtr(Debugger.TranslateVirtual(AddressStart)),
+ AddressEnd - AddressStart + 4);
+ return disasmPpc;
+ }
}
+
public string DisasmHirUnoptimized {
get; private set;
}
public string DisasmHirOptimized {
get; private set;
}
+
+ private string disasmMachineCode;
public string DisasmMachineCode {
- get; private set;
+ get {
+ if (disasmMachineCode != null) {
+ return disasmMachineCode;
+ }
+ if (MachineCodeStart == 0) {
+ return null;
+ }
+ disasmMachineCode = disassembler.DisassembleX64(
+ new IntPtr(MachineCodeStart), MachineCodeEnd - MachineCodeStart + 1);
+ disasmMachineCode = disasmMachineCode.Replace("\n", "\r\n");
+ return disasmMachineCode;
+ }
}
public Function(Debugger debugger, Module module, xe.debug.proto.FunctionEntry functionEntry) {
@@ -96,33 +133,21 @@ namespace Xenia.Debug {
response.GetResponseData(responseData);
var functionData = responseData.Function;
- this.DisasmPpc = functionData.DisasmPpc;
+ this.AddressEnd = functionData.AddressEnd;
+
+ this.MachineCodeStart = functionData.MachineCodeStart;
+ this.MachineCodeEnd = functionData.MachineCodeEnd;
+
this.DisasmHirUnoptimized = functionData.DisasmHirRaw;
this.DisasmHirOptimized = functionData.DisasmHirOpt;
- this.DisasmMachineCode = functionData.DisasmMachineCode;
- if (DisasmPpc != null) {
- DisasmPpc = DisasmPpc.Replace("\n", "\r\n");
- }
if (DisasmHirUnoptimized != null) {
DisasmHirUnoptimized = DisasmHirUnoptimized.Replace("\n", "\r\n");
}
if (DisasmHirOptimized != null) {
DisasmHirOptimized = DisasmHirOptimized.Replace("\n", "\r\n");
}
- if (DisasmMachineCode != null) {
- DisasmMachineCode = DisasmMachineCode.Replace("\n", "\r\n");
- }
-
- DisassembleX64();
OnChanged();
}
-
- private static Native.X64Disassembler disassembler = new Native.X64Disassembler();
-
- private void DisassembleX64() {
- var str = disassembler.GenerateString(IntPtr.Zero, 0);
- System.Diagnostics.Debug.WriteLine(str);
- }
}
}
diff --git a/src/Xenia.Debug/Proto/xe/debug/proto/AttachResponse.cs b/src/Xenia.Debug/Proto/xe/debug/proto/AttachResponse.cs
index 0358b24e2..6f7938eb1 100644
--- a/src/Xenia.Debug/Proto/xe/debug/proto/AttachResponse.cs
+++ b/src/Xenia.Debug/Proto/xe/debug/proto/AttachResponse.cs
@@ -11,24 +11,36 @@ public sealed class AttachResponse : Table {
public AttachResponse __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
public string MemoryFile { get { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } }
- public string FunctionsFile { get { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; } }
- public string FunctionsTraceFile { get { int o = __offset(8); return o != 0 ? __string(o + bb_pos) : null; } }
+ public string CodeCacheFile { get { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; } }
+ public uint CodeCacheBase { get { int o = __offset(8); return o != 0 ? bb.GetUint(o + bb_pos) : (uint)0; } }
+ public uint CodeCacheSize { get { int o = __offset(10); return o != 0 ? bb.GetUint(o + bb_pos) : (uint)0; } }
+ public string FunctionsFile { get { int o = __offset(12); return o != 0 ? __string(o + bb_pos) : null; } }
+ public string FunctionsTraceFile { get { int o = __offset(14); return o != 0 ? __string(o + bb_pos) : null; } }
public static int CreateAttachResponse(FlatBufferBuilder builder,
int memory_file = 0,
+ int code_cache_file = 0,
+ uint code_cache_base = 0,
+ uint code_cache_size = 0,
int functions_file = 0,
int functions_trace_file = 0) {
- builder.StartObject(3);
+ builder.StartObject(6);
AttachResponse.AddFunctionsTraceFile(builder, functions_trace_file);
AttachResponse.AddFunctionsFile(builder, functions_file);
+ AttachResponse.AddCodeCacheSize(builder, code_cache_size);
+ AttachResponse.AddCodeCacheBase(builder, code_cache_base);
+ AttachResponse.AddCodeCacheFile(builder, code_cache_file);
AttachResponse.AddMemoryFile(builder, memory_file);
return AttachResponse.EndAttachResponse(builder);
}
- public static void StartAttachResponse(FlatBufferBuilder builder) { builder.StartObject(3); }
+ public static void StartAttachResponse(FlatBufferBuilder builder) { builder.StartObject(6); }
public static void AddMemoryFile(FlatBufferBuilder builder, int memoryFileOffset) { builder.AddOffset(0, memoryFileOffset, 0); }
- public static void AddFunctionsFile(FlatBufferBuilder builder, int functionsFileOffset) { builder.AddOffset(1, functionsFileOffset, 0); }
- public static void AddFunctionsTraceFile(FlatBufferBuilder builder, int functionsTraceFileOffset) { builder.AddOffset(2, functionsTraceFileOffset, 0); }
+ public static void AddCodeCacheFile(FlatBufferBuilder builder, int codeCacheFileOffset) { builder.AddOffset(1, codeCacheFileOffset, 0); }
+ public static void AddCodeCacheBase(FlatBufferBuilder builder, uint codeCacheBase) { builder.AddUint(2, codeCacheBase, 0); }
+ public static void AddCodeCacheSize(FlatBufferBuilder builder, uint codeCacheSize) { builder.AddUint(3, codeCacheSize, 0); }
+ public static void AddFunctionsFile(FlatBufferBuilder builder, int functionsFileOffset) { builder.AddOffset(4, functionsFileOffset, 0); }
+ public static void AddFunctionsTraceFile(FlatBufferBuilder builder, int functionsTraceFileOffset) { builder.AddOffset(5, functionsTraceFileOffset, 0); }
public static int EndAttachResponse(FlatBufferBuilder builder) {
int o = builder.EndObject();
return o;
diff --git a/src/Xenia.Debug/Proto/xe/debug/proto/Function.cs b/src/Xenia.Debug/Proto/xe/debug/proto/Function.cs
index 939737021..53c5991dc 100644
--- a/src/Xenia.Debug/Proto/xe/debug/proto/Function.cs
+++ b/src/Xenia.Debug/Proto/xe/debug/proto/Function.cs
@@ -14,26 +14,26 @@ public sealed class Function : Table {
public uint AddressStart { get { int o = __offset(6); return o != 0 ? bb.GetUint(o + bb_pos) : (uint)0; } }
public uint AddressEnd { get { int o = __offset(8); return o != 0 ? bb.GetUint(o + bb_pos) : (uint)0; } }
public string Name { get { int o = __offset(10); return o != 0 ? __string(o + bb_pos) : null; } }
- public string DisasmPpc { get { int o = __offset(12); return o != 0 ? __string(o + bb_pos) : null; } }
- public string DisasmHirRaw { get { int o = __offset(14); return o != 0 ? __string(o + bb_pos) : null; } }
- public string DisasmHirOpt { get { int o = __offset(16); return o != 0 ? __string(o + bb_pos) : null; } }
- public string DisasmMachineCode { get { int o = __offset(18); return o != 0 ? __string(o + bb_pos) : null; } }
+ public uint MachineCodeStart { get { int o = __offset(12); return o != 0 ? bb.GetUint(o + bb_pos) : (uint)0; } }
+ public uint MachineCodeEnd { get { int o = __offset(14); return o != 0 ? bb.GetUint(o + bb_pos) : (uint)0; } }
+ public string DisasmHirRaw { get { int o = __offset(16); return o != 0 ? __string(o + bb_pos) : null; } }
+ public string DisasmHirOpt { get { int o = __offset(18); return o != 0 ? __string(o + bb_pos) : null; } }
public static int CreateFunction(FlatBufferBuilder builder,
ulong identifier = 0,
uint address_start = 0,
uint address_end = 0,
int name = 0,
- int disasm_ppc = 0,
+ uint machine_code_start = 0,
+ uint machine_code_end = 0,
int disasm_hir_raw = 0,
- int disasm_hir_opt = 0,
- int disasm_machine_code = 0) {
+ int disasm_hir_opt = 0) {
builder.StartObject(8);
Function.AddIdentifier(builder, identifier);
- Function.AddDisasmMachineCode(builder, disasm_machine_code);
Function.AddDisasmHirOpt(builder, disasm_hir_opt);
Function.AddDisasmHirRaw(builder, disasm_hir_raw);
- Function.AddDisasmPpc(builder, disasm_ppc);
+ Function.AddMachineCodeEnd(builder, machine_code_end);
+ Function.AddMachineCodeStart(builder, machine_code_start);
Function.AddName(builder, name);
Function.AddAddressEnd(builder, address_end);
Function.AddAddressStart(builder, address_start);
@@ -45,10 +45,10 @@ public sealed class Function : Table {
public static void AddAddressStart(FlatBufferBuilder builder, uint addressStart) { builder.AddUint(1, addressStart, 0); }
public static void AddAddressEnd(FlatBufferBuilder builder, uint addressEnd) { builder.AddUint(2, addressEnd, 0); }
public static void AddName(FlatBufferBuilder builder, int nameOffset) { builder.AddOffset(3, nameOffset, 0); }
- public static void AddDisasmPpc(FlatBufferBuilder builder, int disasmPpcOffset) { builder.AddOffset(4, disasmPpcOffset, 0); }
- public static void AddDisasmHirRaw(FlatBufferBuilder builder, int disasmHirRawOffset) { builder.AddOffset(5, disasmHirRawOffset, 0); }
- public static void AddDisasmHirOpt(FlatBufferBuilder builder, int disasmHirOptOffset) { builder.AddOffset(6, disasmHirOptOffset, 0); }
- public static void AddDisasmMachineCode(FlatBufferBuilder builder, int disasmMachineCodeOffset) { builder.AddOffset(7, disasmMachineCodeOffset, 0); }
+ public static void AddMachineCodeStart(FlatBufferBuilder builder, uint machineCodeStart) { builder.AddUint(4, machineCodeStart, 0); }
+ public static void AddMachineCodeEnd(FlatBufferBuilder builder, uint machineCodeEnd) { builder.AddUint(5, machineCodeEnd, 0); }
+ public static void AddDisasmHirRaw(FlatBufferBuilder builder, int disasmHirRawOffset) { builder.AddOffset(6, disasmHirRawOffset, 0); }
+ public static void AddDisasmHirOpt(FlatBufferBuilder builder, int disasmHirOptOffset) { builder.AddOffset(7, disasmHirOptOffset, 0); }
public static int EndFunction(FlatBufferBuilder builder) {
int o = builder.EndObject();
return o;
diff --git a/src/xenia/cpu/backend/x64/x64_assembler.cc b/src/xenia/cpu/backend/x64/x64_assembler.cc
index d52bafa84..7140ed648 100644
--- a/src/xenia/cpu/backend/x64/x64_assembler.cc
+++ b/src/xenia/cpu/backend/x64/x64_assembler.cc
@@ -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(machine_code), code_size);
*out_function = fn;
diff --git a/src/xenia/cpu/backend/x64/x64_function.cc b/src/xenia/cpu/backend/x64/x64_function.cc
index bf6d08526..8ca5a6e34 100644
--- a/src/xenia/cpu/backend/x64/x64_function.cc
+++ b/src/xenia/cpu/backend/x64/x64_function.cc
@@ -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) {
diff --git a/src/xenia/cpu/backend/x64/x64_function.h b/src/xenia/cpu/backend/x64/x64_function.h
index 25f6fd798..71e90ceac 100644
--- a/src/xenia/cpu/backend/x64/x64_function.h
+++ b/src/xenia/cpu/backend/x64/x64_function.h
@@ -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
diff --git a/src/xenia/cpu/function.h b/src/xenia/cpu/function.h
index 17a4744da..f93c23a03 100644
--- a/src/xenia/cpu/function.h
+++ b/src/xenia/cpu/function.h
@@ -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);
diff --git a/src/xenia/debug/debugger.cc b/src/xenia/debug/debugger.cc
index 37229cf4f..8763e33b8 100644
--- a/src/xenia/debug/debugger.cc
+++ b/src/xenia/debug/debugger.cc
@@ -20,6 +20,7 @@
#include "xenia/base/logging.h"
#include "xenia/base/string.h"
#include "xenia/base/threading.h"
+#include "xenia/cpu/backend/code_cache.h"
#include "xenia/cpu/function.h"
#include "xenia/cpu/processor.h"
#include "xenia/emulator.h"
@@ -211,11 +212,14 @@ void Debugger::OnMessage(std::vector buffer) {
switch (request->request_data_type()) {
case proto::RequestData_AttachRequest: {
// Send debug info.
+ auto code_cache = emulator()->processor()->backend()->code_cache();
response_data_type = proto::ResponseData_AttachResponse;
response_data_offset =
proto::CreateAttachResponse(
fbb, fbb.CreateString(
xe::to_string(emulator()->memory()->file_name())),
+ fbb.CreateString(xe::to_string(code_cache->file_name())),
+ code_cache->base_address(), code_cache->total_size(),
fbb.CreateString(xe::to_string(functions_path_)),
fbb.CreateString(xe::to_string(functions_trace_path_))).Union();
@@ -355,19 +359,19 @@ void Debugger::OnMessage(std::vector buffer) {
auto function_info =
reinterpret_cast(request_data->identifier());
auto function = function_info->function();
+ if (!function) {
+ // Attempt to resolve.
+ emulator_->processor()->ResolveFunction(function_info->address(),
+ &function);
+ }
flatbuffers::Offset name_offset;
if (!function_info->name().empty()) {
name_offset = fbb.CreateString(function_info->name());
}
- flatbuffers::Offset disasm_ppc_offset;
flatbuffers::Offset disasm_hir_raw_offset;
flatbuffers::Offset disasm_hir_opt_offset;
- flatbuffers::Offset disasm_machine_code_offset;
if (function && function->debug_info()) {
auto debug_info = function->debug_info();
- if (debug_info->source_disasm()) {
- disasm_ppc_offset = fbb.CreateString(debug_info->source_disasm());
- }
if (debug_info->raw_hir_disasm()) {
disasm_hir_raw_offset =
fbb.CreateString(debug_info->raw_hir_disasm());
@@ -375,20 +379,20 @@ void Debugger::OnMessage(std::vector buffer) {
if (debug_info->hir_disasm()) {
disasm_hir_opt_offset = fbb.CreateString(debug_info->hir_disasm());
}
- if (debug_info->machine_code_disasm()) {
- disasm_machine_code_offset =
- fbb.CreateString(debug_info->machine_code_disasm());
- }
}
auto function_data = proto::FunctionBuilder(fbb);
function_data.add_identifier(request_data->identifier());
function_data.add_address_start(function_info->address());
function_data.add_address_end(function_info->end_address());
function_data.add_name(name_offset);
- function_data.add_disasm_ppc(disasm_ppc_offset);
+ if (function) {
+ function_data.add_machine_code_start(
+ uint32_t(uintptr_t(function->machine_code())));
+ function_data.add_machine_code_end(uint32_t(uintptr_t(
+ function->machine_code() + function->machine_code_length())));
+ }
function_data.add_disasm_hir_raw(disasm_hir_raw_offset);
function_data.add_disasm_hir_opt(disasm_hir_opt_offset);
- function_data.add_disasm_machine_code(disasm_machine_code_offset);
auto function_offset = function_data.Finish();
response_data_type = proto::ResponseData_GetFunctionResponse;
auto response_data = proto::GetFunctionResponseBuilder(fbb);
diff --git a/src/xenia/debug/proto/messages.fbs b/src/xenia/debug/proto/messages.fbs
index 9c3017915..8bd684e30 100644
--- a/src/xenia/debug/proto/messages.fbs
+++ b/src/xenia/debug/proto/messages.fbs
@@ -11,6 +11,9 @@ table AttachRequest {
}
table AttachResponse {
memory_file:string;
+ code_cache_file:string;
+ code_cache_base:uint;
+ code_cache_size:uint;
functions_file:string;
functions_trace_file:string;
}
diff --git a/src/xenia/debug/proto/messages_generated.h b/src/xenia/debug/proto/messages_generated.h
index fad763993..2e13c9166 100644
--- a/src/xenia/debug/proto/messages_generated.h
+++ b/src/xenia/debug/proto/messages_generated.h
@@ -98,15 +98,7 @@ enum RequestData {
};
inline const char **EnumNamesRequestData() {
- static const char *names[] = {
- "NONE", "AttachRequest",
- "ListBreakpointsRequest", "AddBreakpointsRequest",
- "UpdateBreakpointsRequest", "RemoveBreakpointsRequest",
- "ListModulesRequest", "GetModuleRequest",
- "ListFunctionsRequest", "GetFunctionRequest",
- "StopRequest", "BreakRequest",
- "ContinueRequest", "StepRequest",
- nullptr};
+ static const char *names[] = { "NONE", "AttachRequest", "ListBreakpointsRequest", "AddBreakpointsRequest", "UpdateBreakpointsRequest", "RemoveBreakpointsRequest", "ListModulesRequest", "GetModuleRequest", "ListFunctionsRequest", "GetFunctionRequest", "StopRequest", "BreakRequest", "ContinueRequest", "StepRequest", nullptr };
return names;
}
@@ -134,16 +126,7 @@ enum ResponseData {
};
inline const char **EnumNamesResponseData() {
- static const char *names[] = {
- "NONE", "AttachResponse",
- "ListBreakpointsResponse", "AddBreakpointsResponse",
- "UpdateBreakpointsResponse", "RemoveBreakpointsResponse",
- "ListModulesResponse", "GetModuleResponse",
- "ListFunctionsResponse", "GetFunctionResponse",
- "StopResponse", "BreakResponse",
- "ContinueResponse", "StepResponse",
- "BreakpointEvent", "AccessViolationEvent",
- nullptr};
+ static const char *names[] = { "NONE", "AttachResponse", "ListBreakpointsResponse", "AddBreakpointsResponse", "UpdateBreakpointsResponse", "RemoveBreakpointsResponse", "ListModulesResponse", "GetModuleResponse", "ListFunctionsResponse", "GetFunctionResponse", "StopResponse", "BreakResponse", "ContinueResponse", "StepResponse", "BreakpointEvent", "AccessViolationEvent", nullptr };
return names;
}
@@ -176,15 +159,22 @@ inline flatbuffers::Offset CreateAttachRequest(flatbuffers::FlatB
struct AttachResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::String *memory_file() const { return GetPointer(4); }
- const flatbuffers::String *functions_file() const { return GetPointer(6); }
- const flatbuffers::String *functions_trace_file() const { return GetPointer(8); }
+ const flatbuffers::String *code_cache_file() const { return GetPointer(6); }
+ uint32_t code_cache_base() const { return GetField(8, 0); }
+ uint32_t code_cache_size() const { return GetField(10, 0); }
+ const flatbuffers::String *functions_file() const { return GetPointer(12); }
+ const flatbuffers::String *functions_trace_file() const { return GetPointer(14); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField(verifier, 4 /* memory_file */) &&
verifier.Verify(memory_file()) &&
- VerifyField(verifier, 6 /* functions_file */) &&
+ VerifyField(verifier, 6 /* code_cache_file */) &&
+ verifier.Verify(code_cache_file()) &&
+ VerifyField(verifier, 8 /* code_cache_base */) &&
+ VerifyField(verifier, 10 /* code_cache_size */) &&
+ VerifyField(verifier, 12 /* functions_file */) &&
verifier.Verify(functions_file()) &&
- VerifyField(verifier, 8 /* functions_trace_file */) &&
+ VerifyField(verifier, 14 /* functions_trace_file */) &&
verifier.Verify(functions_trace_file()) &&
verifier.EndTable();
}
@@ -194,23 +184,32 @@ struct AttachResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_memory_file(flatbuffers::Offset memory_file) { fbb_.AddOffset(4, memory_file); }
- void add_functions_file(flatbuffers::Offset functions_file) { fbb_.AddOffset(6, functions_file); }
- void add_functions_trace_file(flatbuffers::Offset functions_trace_file) { fbb_.AddOffset(8, functions_trace_file); }
+ void add_code_cache_file(flatbuffers::Offset code_cache_file) { fbb_.AddOffset(6, code_cache_file); }
+ void add_code_cache_base(uint32_t code_cache_base) { fbb_.AddElement(8, code_cache_base, 0); }
+ void add_code_cache_size(uint32_t code_cache_size) { fbb_.AddElement(10, code_cache_size, 0); }
+ void add_functions_file(flatbuffers::Offset functions_file) { fbb_.AddOffset(12, functions_file); }
+ void add_functions_trace_file(flatbuffers::Offset functions_trace_file) { fbb_.AddOffset(14, functions_trace_file); }
AttachResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
AttachResponseBuilder &operator=(const AttachResponseBuilder &);
flatbuffers::Offset Finish() {
- auto o = flatbuffers::Offset(fbb_.EndTable(start_, 3));
+ auto o = flatbuffers::Offset(fbb_.EndTable(start_, 6));
return o;
}
};
inline flatbuffers::Offset CreateAttachResponse(flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset memory_file = 0,
+ flatbuffers::Offset code_cache_file = 0,
+ uint32_t code_cache_base = 0,
+ uint32_t code_cache_size = 0,
flatbuffers::Offset functions_file = 0,
flatbuffers::Offset functions_trace_file = 0) {
AttachResponseBuilder builder_(_fbb);
builder_.add_functions_trace_file(functions_trace_file);
builder_.add_functions_file(functions_file);
+ builder_.add_code_cache_size(code_cache_size);
+ builder_.add_code_cache_base(code_cache_base);
+ builder_.add_code_cache_file(code_cache_file);
builder_.add_memory_file(memory_file);
return builder_.Finish();
}
@@ -303,14 +302,8 @@ inline bool VerifyRequestData(flatbuffers::Verifier &verifier, const void *union
case RequestData_RemoveBreakpointsRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
case RequestData_ListModulesRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
case RequestData_GetModuleRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
- case RequestData_ListFunctionsRequest:
- return verifier.VerifyTable(
- reinterpret_cast(
- union_obj));
- case RequestData_GetFunctionRequest:
- return verifier.VerifyTable(
- reinterpret_cast(
- union_obj));
+ case RequestData_ListFunctionsRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
+ case RequestData_GetFunctionRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
case RequestData_StopRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
case RequestData_BreakRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
case RequestData_ContinueRequest: return verifier.VerifyTable(reinterpret_cast(union_obj));
@@ -329,14 +322,8 @@ inline bool VerifyResponseData(flatbuffers::Verifier &verifier, const void *unio
case ResponseData_RemoveBreakpointsResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
case ResponseData_ListModulesResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
case ResponseData_GetModuleResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
- case ResponseData_ListFunctionsResponse:
- return verifier.VerifyTable(
- reinterpret_cast(
- union_obj));
- case ResponseData_GetFunctionResponse:
- return verifier.VerifyTable(
- reinterpret_cast(
- union_obj));
+ case ResponseData_ListFunctionsResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
+ case ResponseData_GetFunctionResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
case ResponseData_StopResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
case ResponseData_BreakResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
case ResponseData_ContinueResponse: return verifier.VerifyTable(reinterpret_cast(union_obj));
diff --git a/src/xenia/debug/proto/modules.fbs b/src/xenia/debug/proto/modules.fbs
index b41271f54..ff484e64b 100644
--- a/src/xenia/debug/proto/modules.fbs
+++ b/src/xenia/debug/proto/modules.fbs
@@ -45,10 +45,11 @@ table Function {
address_end:uint;
name:string;
- disasm_ppc:string;
+ machine_code_start:uint;
+ machine_code_end:uint;
+
disasm_hir_raw:string;
disasm_hir_opt:string;
- disasm_machine_code:string;
}
table ListFunctionsRequest {
diff --git a/src/xenia/debug/proto/modules_generated.h b/src/xenia/debug/proto/modules_generated.h
index 6ca094f3f..bbc567657 100644
--- a/src/xenia/debug/proto/modules_generated.h
+++ b/src/xenia/debug/proto/modules_generated.h
@@ -49,13 +49,10 @@ MANUALLY_ALIGNED_STRUCT(4) ListModuleEntry FLATBUFFERS_FINAL_CLASS {
public:
ListModuleEntry(uint32_t handle, uint32_t function_count)
- : handle_(flatbuffers::EndianScalar(handle)),
- function_count_(flatbuffers::EndianScalar(function_count)) {}
+ : handle_(flatbuffers::EndianScalar(handle)), function_count_(flatbuffers::EndianScalar(function_count)) { }
uint32_t handle() const { return flatbuffers::EndianScalar(handle_); }
- uint32_t function_count() const {
- return flatbuffers::EndianScalar(function_count_);
- }
+ uint32_t function_count() const { return flatbuffers::EndianScalar(function_count_); }
};
STRUCT_END(ListModuleEntry, 8);
@@ -128,23 +125,19 @@ inline flatbuffers::Offset CreateListModulesRequest(flatbuff
}
struct ListModulesResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
- const flatbuffers::Vector *entry() const {
- return GetPointer *>(4);
- }
+ const flatbuffers::Vector *entry() const { return GetPointer *>(4); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField(verifier, 4 /* entry */) &&
- verifier.Verify(entry()) && verifier.EndTable();
+ verifier.Verify(entry()) &&
+ verifier.EndTable();
}
};
struct ListModulesResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_entry(
- flatbuffers::Offset> entry) {
- fbb_.AddOffset(4, entry);
- }
+ void add_entry(flatbuffers::Offset> entry) { fbb_.AddOffset(4, entry); }
ListModulesResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListModulesResponseBuilder &operator=(const ListModulesResponseBuilder &);
flatbuffers::Offset Finish() {
@@ -153,10 +146,8 @@ struct ListModulesResponseBuilder {
}
};
-inline flatbuffers::Offset CreateListModulesResponse(
- flatbuffers::FlatBufferBuilder &_fbb,
- flatbuffers::Offset> entry =
- 0) {
+inline flatbuffers::Offset CreateListModulesResponse(flatbuffers::FlatBufferBuilder &_fbb,
+ flatbuffers::Offset> entry = 0) {
ListModulesResponseBuilder builder_(_fbb);
builder_.add_entry(entry);
return builder_.Finish();
@@ -223,37 +214,26 @@ struct FunctionEntry FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
uint64_t identifier() const { return GetField(4, 0); }
uint32_t address_start() const { return GetField(6, 0); }
uint32_t address_end() const { return GetField(8, 0); }
- const flatbuffers::String *name() const {
- return GetPointer(10);
- }
+ const flatbuffers::String *name() const { return GetPointer(10); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField(verifier, 4 /* identifier */) &&
VerifyField(verifier, 6 /* address_start */) &&
VerifyField(verifier, 8 /* address_end */) &&
VerifyField(verifier, 10 /* name */) &&
- verifier.Verify(name()) && verifier.EndTable();
+ verifier.Verify(name()) &&
+ verifier.EndTable();
}
};
struct FunctionEntryBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_identifier(uint64_t identifier) {
- fbb_.AddElement(4, identifier, 0);
- }
- void add_address_start(uint32_t address_start) {
- fbb_.AddElement(6, address_start, 0);
- }
- void add_address_end(uint32_t address_end) {
- fbb_.AddElement(8, address_end, 0);
- }
- void add_name(flatbuffers::Offset name) {
- fbb_.AddOffset(10, name);
- }
- FunctionEntryBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
+ void add_identifier(uint64_t identifier) { fbb_.AddElement(4, identifier, 0); }
+ void add_address_start(uint32_t address_start) { fbb_.AddElement(6, address_start, 0); }
+ void add_address_end(uint32_t address_end) { fbb_.AddElement(8, address_end, 0); }
+ void add_name(flatbuffers::Offset name) { fbb_.AddOffset(10, name); }
+ FunctionEntryBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
FunctionEntryBuilder &operator=(const FunctionEntryBuilder &);
flatbuffers::Offset Finish() {
auto o = flatbuffers::Offset(fbb_.EndTable(start_, 4));
@@ -261,10 +241,11 @@ struct FunctionEntryBuilder {
}
};
-inline flatbuffers::Offset CreateFunctionEntry(
- flatbuffers::FlatBufferBuilder &_fbb, uint64_t identifier = 0,
- uint32_t address_start = 0, uint32_t address_end = 0,
- flatbuffers::Offset name = 0) {
+inline flatbuffers::Offset CreateFunctionEntry(flatbuffers::FlatBufferBuilder &_fbb,
+ uint64_t identifier = 0,
+ uint32_t address_start = 0,
+ uint32_t address_end = 0,
+ flatbuffers::Offset name = 0) {
FunctionEntryBuilder builder_(_fbb);
builder_.add_identifier(identifier);
builder_.add_name(name);
@@ -277,21 +258,11 @@ struct Function FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
uint64_t identifier() const { return GetField(4, 0); }
uint32_t address_start() const { return GetField(6, 0); }
uint32_t address_end() const { return GetField(8, 0); }
- const flatbuffers::String *name() const {
- return GetPointer(10);
- }
- const flatbuffers::String *disasm_ppc() const {
- return GetPointer(12);
- }
- const flatbuffers::String *disasm_hir_raw() const {
- return GetPointer(14);
- }
- const flatbuffers::String *disasm_hir_opt() const {
- return GetPointer(16);
- }
- const flatbuffers::String *disasm_machine_code() const {
- return GetPointer(18);
- }
+ const flatbuffers::String *name() const { return GetPointer(10); }
+ uint32_t machine_code_start() const { return GetField(12, 0); }
+ uint32_t machine_code_end() const { return GetField(14, 0); }
+ const flatbuffers::String *disasm_hir_raw() const { return GetPointer(16); }
+ const flatbuffers::String *disasm_hir_opt() const { return GetPointer(18); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField(verifier, 4 /* identifier */) &&
@@ -299,53 +270,28 @@ struct Function FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VerifyField(verifier, 8 /* address_end */) &&
VerifyField(verifier, 10 /* name */) &&
verifier.Verify(name()) &&
- VerifyField(verifier, 12 /* disasm_ppc */) &&
- verifier.Verify(disasm_ppc()) &&
- VerifyField(verifier,
- 14 /* disasm_hir_raw */) &&
+ VerifyField(verifier, 12 /* machine_code_start */) &&
+ VerifyField(verifier, 14 /* machine_code_end */) &&
+ VerifyField(verifier, 16 /* disasm_hir_raw */) &&
verifier.Verify(disasm_hir_raw()) &&
- VerifyField(verifier,
- 16 /* disasm_hir_opt */) &&
+ VerifyField(verifier, 18 /* disasm_hir_opt */) &&
verifier.Verify(disasm_hir_opt()) &&
- VerifyField(verifier,
- 18 /* disasm_machine_code */) &&
- verifier.Verify(disasm_machine_code()) && verifier.EndTable();
+ verifier.EndTable();
}
};
struct FunctionBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_identifier(uint64_t identifier) {
- fbb_.AddElement(4, identifier, 0);
- }
- void add_address_start(uint32_t address_start) {
- fbb_.AddElement(6, address_start, 0);
- }
- void add_address_end(uint32_t address_end) {
- fbb_.AddElement(8, address_end, 0);
- }
- void add_name(flatbuffers::Offset name) {
- fbb_.AddOffset(10, name);
- }
- void add_disasm_ppc(flatbuffers::Offset disasm_ppc) {
- fbb_.AddOffset(12, disasm_ppc);
- }
- void add_disasm_hir_raw(
- flatbuffers::Offset disasm_hir_raw) {
- fbb_.AddOffset(14, disasm_hir_raw);
- }
- void add_disasm_hir_opt(
- flatbuffers::Offset disasm_hir_opt) {
- fbb_.AddOffset(16, disasm_hir_opt);
- }
- void add_disasm_machine_code(
- flatbuffers::Offset disasm_machine_code) {
- fbb_.AddOffset(18, disasm_machine_code);
- }
- FunctionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
+ void add_identifier(uint64_t identifier) { fbb_.AddElement(4, identifier, 0); }
+ void add_address_start(uint32_t address_start) { fbb_.AddElement(6, address_start, 0); }
+ void add_address_end(uint32_t address_end) { fbb_.AddElement(8, address_end, 0); }
+ void add_name(flatbuffers::Offset name) { fbb_.AddOffset(10, name); }
+ void add_machine_code_start(uint32_t machine_code_start) { fbb_.AddElement(12, machine_code_start, 0); }
+ void add_machine_code_end(uint32_t machine_code_end) { fbb_.AddElement(14, machine_code_end, 0); }
+ void add_disasm_hir_raw(flatbuffers::Offset disasm_hir_raw) { fbb_.AddOffset(16, disasm_hir_raw); }
+ void add_disasm_hir_opt(flatbuffers::Offset disasm_hir_opt) { fbb_.AddOffset(18, disasm_hir_opt); }
+ FunctionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
FunctionBuilder &operator=(const FunctionBuilder &);
flatbuffers::Offset Finish() {
auto o = flatbuffers::Offset(fbb_.EndTable(start_, 8));
@@ -353,28 +299,28 @@ struct FunctionBuilder {
}
};
-inline flatbuffers::Offset CreateFunction(
- flatbuffers::FlatBufferBuilder &_fbb, uint64_t identifier = 0,
- uint32_t address_start = 0, uint32_t address_end = 0,
- flatbuffers::Offset name = 0,
- flatbuffers::Offset disasm_ppc = 0,
- flatbuffers::Offset disasm_hir_raw = 0,
- flatbuffers::Offset disasm_hir_opt = 0,
- flatbuffers::Offset disasm_machine_code = 0) {
+inline flatbuffers::Offset CreateFunction(flatbuffers::FlatBufferBuilder &_fbb,
+ uint64_t identifier = 0,
+ uint32_t address_start = 0,
+ uint32_t address_end = 0,
+ flatbuffers::Offset name = 0,
+ uint32_t machine_code_start = 0,
+ uint32_t machine_code_end = 0,
+ flatbuffers::Offset disasm_hir_raw = 0,
+ flatbuffers::Offset disasm_hir_opt = 0) {
FunctionBuilder builder_(_fbb);
builder_.add_identifier(identifier);
- builder_.add_disasm_machine_code(disasm_machine_code);
builder_.add_disasm_hir_opt(disasm_hir_opt);
builder_.add_disasm_hir_raw(disasm_hir_raw);
- builder_.add_disasm_ppc(disasm_ppc);
+ builder_.add_machine_code_end(machine_code_end);
+ builder_.add_machine_code_start(machine_code_start);
builder_.add_name(name);
builder_.add_address_end(address_end);
builder_.add_address_start(address_start);
return builder_.Finish();
}
-struct ListFunctionsRequest FLATBUFFERS_FINAL_CLASS
- : private flatbuffers::Table {
+struct ListFunctionsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
uint32_t module_id() const { return GetField(4, 0); }
uint32_t function_index_start() const { return GetField(6, 0); }
uint32_t function_index_end() const { return GetField(8, 0); }
@@ -390,30 +336,21 @@ struct ListFunctionsRequest FLATBUFFERS_FINAL_CLASS
struct ListFunctionsRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_module_id(uint32_t module_id) {
- fbb_.AddElement(4, module_id, 0);
- }
- void add_function_index_start(uint32_t function_index_start) {
- fbb_.AddElement(6, function_index_start, 0);
- }
- void add_function_index_end(uint32_t function_index_end) {
- fbb_.AddElement(8, function_index_end, 0);
- }
- ListFunctionsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
- : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
+ void add_module_id(uint32_t module_id) { fbb_.AddElement(4, module_id, 0); }
+ void add_function_index_start(uint32_t function_index_start) { fbb_.AddElement(6, function_index_start, 0); }
+ void add_function_index_end(uint32_t function_index_end) { fbb_.AddElement(8, function_index_end, 0); }
+ ListFunctionsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListFunctionsRequestBuilder &operator=(const ListFunctionsRequestBuilder &);
flatbuffers::Offset Finish() {
- auto o =
- flatbuffers::Offset(fbb_.EndTable(start_, 3));
+ auto o = flatbuffers::Offset(fbb_.EndTable(start_, 3));
return o;
}
};
-inline flatbuffers::Offset CreateListFunctionsRequest(
- flatbuffers::FlatBufferBuilder &_fbb, uint32_t module_id = 0,
- uint32_t function_index_start = 0, uint32_t function_index_end = 0) {
+inline flatbuffers::Offset CreateListFunctionsRequest(flatbuffers::FlatBufferBuilder &_fbb,
+ uint32_t module_id = 0,
+ uint32_t function_index_start = 0,
+ uint32_t function_index_end = 0) {
ListFunctionsRequestBuilder builder_(_fbb);
builder_.add_function_index_end(function_index_end);
builder_.add_function_index_start(function_index_start);
@@ -421,16 +358,13 @@ inline flatbuffers::Offset CreateListFunctionsRequest(
return builder_.Finish();
}
-struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS
- : private flatbuffers::Table {
- const flatbuffers::Vector> *entry() const {
- return GetPointer<
- const flatbuffers::Vector> *>(4);
- }
+struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ const flatbuffers::Vector> *entry() const { return GetPointer> *>(4); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField(verifier, 4 /* entry */) &&
- verifier.Verify(entry()) && verifier.VerifyVectorOfTables(entry()) &&
+ verifier.Verify(entry()) &&
+ verifier.VerifyVectorOfTables(entry()) &&
verifier.EndTable();
}
};
@@ -438,26 +372,17 @@ struct ListFunctionsResponse FLATBUFFERS_FINAL_CLASS
struct ListFunctionsResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_entry(flatbuffers::Offset<
- flatbuffers::Vector>> entry) {
- fbb_.AddOffset(4, entry);
- }
- ListFunctionsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
- : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
+ void add_entry(flatbuffers::Offset>> entry) { fbb_.AddOffset(4, entry); }
+ ListFunctionsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
ListFunctionsResponseBuilder &operator=(const ListFunctionsResponseBuilder &);
flatbuffers::Offset Finish() {
- auto o =
- flatbuffers::Offset(fbb_.EndTable(start_, 1));
+ auto o = flatbuffers::Offset(fbb_.EndTable(start_, 1));
return o;
}
};
-inline flatbuffers::Offset CreateListFunctionsResponse(
- flatbuffers::FlatBufferBuilder &_fbb,
- flatbuffers::Offset>>
- entry = 0) {
+inline flatbuffers::Offset CreateListFunctionsResponse(flatbuffers::FlatBufferBuilder &_fbb,
+ flatbuffers::Offset>> entry = 0) {
ListFunctionsResponseBuilder builder_(_fbb);
builder_.add_entry(entry);
return builder_.Finish();
@@ -475,12 +400,8 @@ struct GetFunctionRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
struct GetFunctionRequestBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_identifier(uint64_t identifier) {
- fbb_.AddElement(4, identifier, 0);
- }
- GetFunctionRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
+ void add_identifier(uint64_t identifier) { fbb_.AddElement(4, identifier, 0); }
+ GetFunctionRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
GetFunctionRequestBuilder &operator=(const GetFunctionRequestBuilder &);
flatbuffers::Offset Finish() {
auto o = flatbuffers::Offset(fbb_.EndTable(start_, 1));
@@ -488,33 +409,28 @@ struct GetFunctionRequestBuilder {
}
};
-inline flatbuffers::Offset CreateGetFunctionRequest(
- flatbuffers::FlatBufferBuilder &_fbb, uint64_t identifier = 0) {
+inline flatbuffers::Offset CreateGetFunctionRequest(flatbuffers::FlatBufferBuilder &_fbb,
+ uint64_t identifier = 0) {
GetFunctionRequestBuilder builder_(_fbb);
builder_.add_identifier(identifier);
return builder_.Finish();
}
-struct GetFunctionResponse FLATBUFFERS_FINAL_CLASS
- : private flatbuffers::Table {
+struct GetFunctionResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const Function *function() const { return GetPointer(4); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField(verifier, 4 /* function */) &&
- verifier.VerifyTable(function()) && verifier.EndTable();
+ verifier.VerifyTable(function()) &&
+ verifier.EndTable();
}
};
struct GetFunctionResponseBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
- void add_function(flatbuffers::Offset function) {
- fbb_.AddOffset(4, function);
- }
- GetFunctionResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
- : fbb_(_fbb) {
- start_ = fbb_.StartTable();
- }
+ void add_function(flatbuffers::Offset function) { fbb_.AddOffset(4, function); }
+ GetFunctionResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
GetFunctionResponseBuilder &operator=(const GetFunctionResponseBuilder &);
flatbuffers::Offset Finish() {
auto o = flatbuffers::Offset(fbb_.EndTable(start_, 1));
@@ -522,9 +438,8 @@ struct GetFunctionResponseBuilder {
}
};
-inline flatbuffers::Offset CreateGetFunctionResponse(
- flatbuffers::FlatBufferBuilder &_fbb,
- flatbuffers::Offset function = 0) {
+inline flatbuffers::Offset CreateGetFunctionResponse(flatbuffers::FlatBufferBuilder &_fbb,
+ flatbuffers::Offset function = 0) {
GetFunctionResponseBuilder builder_(_fbb);
builder_.add_function(function);
return builder_.Finish();