Closed kaityo256 closed 4 years ago
Thank you for your proposal, but the implementation is too costly only for a debug. Could you use a disassembler instead of the feature? For example,
#include <stdio.h>
#include <xbyak/xbyak_util.h>
struct Code : Xbyak::CodeGenerator {
Code()
{
lea(rax, ptr[rsi+rdi]);
ret();
}
};
int main()
{
Code c;
write(1, c.getCode(), c.getSize());
}
g++ -I <xbyak dir> t.cpp && ./a.out > dump-code
objdump -M x86-64 -D -b binary -m i386 dump-code
0: 48 8d 04 37 lea (%rdi,%rsi,1),%rax
4: c3 retq
Thank you for the information. This is exactly what I need. I will now use this method for debugging.
Hello,
I know that Xbyak can dump machine codes using
Xbyak::CodeGenerator::dump
, but I want to see the assembly codes instead. I need this for debugging. When some error occurs in codes I generated using Xbyak, I want to see the assembly codes instead of machine codes. Now I check the assembly code on gdb, but it would be better if the Xbyak can dump the assembly codes.Are there any official functions to dump assembly codes in Xbyak?