mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
Added print_ptr() util function for debugging
This commit is contained in:
parent
e5751768ba
commit
6f81bd2c76
3 changed files with 20 additions and 7 deletions
19
ujit_utils.c
19
ujit_utils.c
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "ujit_utils.h"
|
||||
#include "ujit_asm.h"
|
||||
|
||||
|
@ -54,6 +55,24 @@ void print_int(codeblock_t* cb, x86opnd_t opnd)
|
|||
pop_regs(cb);
|
||||
}
|
||||
|
||||
static void print_ptr_cfun(int64_t val)
|
||||
{
|
||||
printf("%llX\n", val);
|
||||
}
|
||||
|
||||
void print_ptr(codeblock_t* cb, x86opnd_t opnd)
|
||||
{
|
||||
assert (opnd.num_bits == 64);
|
||||
|
||||
push_regs(cb);
|
||||
|
||||
mov(cb, RDI, opnd);
|
||||
mov(cb, RAX, const_ptr_opnd((void*)&print_ptr_cfun));
|
||||
call(cb, RAX);
|
||||
|
||||
pop_regs(cb);
|
||||
}
|
||||
|
||||
static void print_str_cfun(const char* str)
|
||||
{
|
||||
printf("%s\n", str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue