From 20c8eb1561ea002ca92904bb40c2eefa5bfd30f3 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 26 Jan 2014 03:24:55 -0800 Subject: [PATCH] Making debug disassembly look a bit better. --- src/alloy/backend/x64/lowering/lowering_sequences.cc | 10 ++++++++-- src/alloy/backend/x64/x64_emitter.cc | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/alloy/backend/x64/lowering/lowering_sequences.cc b/src/alloy/backend/x64/lowering/lowering_sequences.cc index b8f7af8d2..4d493663a 100644 --- a/src/alloy/backend/x64/lowering/lowering_sequences.cc +++ b/src/alloy/backend/x64/lowering/lowering_sequences.cc @@ -520,8 +520,14 @@ void alloy::backend::x64::lowering::RegisterSequences(LoweringTable* table) { // -------------------------------------------------------------------------- table->AddSequence(OPCODE_SOURCE_OFFSET, [](X64Emitter& e, Instr*& i) { - // TODO(benvanik): translate source offsets for mapping? We're just passing - // down the original offset - it may be nice to have two. +#if XE_DEBUG + e.nop(); + e.nop(); + e.mov(e.eax, (uint32_t)i->src1.offset); + e.nop(); + e.nop(); +#endif // XE_DEBUG + e.MarkSourceOffset(i); i = e.Advance(i); return true; diff --git a/src/alloy/backend/x64/x64_emitter.cc b/src/alloy/backend/x64/x64_emitter.cc index c0053b848..d72ad91b8 100644 --- a/src/alloy/backend/x64/x64_emitter.cc +++ b/src/alloy/backend/x64/x64_emitter.cc @@ -162,6 +162,14 @@ int X64Emitter::Emit(HIRBuilder* builder) { } ret(); +#if XE_DEBUG + nop(); + nop(); + nop(); + nop(); + nop(); +#endif // XE_DEBUG + return 0; }