diff options
| author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2021-01-24 18:21:18 -0500 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:27 -0400 |
| commit | 9def269b470f74d8ea4bb7919f927d16efb35cfa (patch) | |
| tree | 7fbd6ab812f2239b2a124e51028cb25f22c542e5 | |
| parent | 79d6e9618d8215f936a3c938d192753906412c02 (diff) | |
Fix issue with block address accessor. Print absolute addresses.
| -rw-r--r-- | ujit.rb | 6 | ||||
| -rw-r--r-- | ujit_iface.c | 3 |
2 files changed, 5 insertions, 4 deletions
@@ -15,14 +15,14 @@ module UJIT str << "\n" # Sort the blocks by increasing addresses - blocks.sort_by(&:address).reverse.each do |block| + blocks.sort_by(&:address).each do |block| str << "== ISEQ RANGE: [#{block.iseq_start_index},#{block.iseq_end_index}[ ".ljust(80, "=") str << "\n" cs.disasm(block.code, 0).each do |i| str << sprintf( - "\t%<address>04X:\t%<instruction>s\t%<details>s\n", - address: i.address, + "\t%<address>08X:\t%<instruction>s\t%<details>s\n", + address: block.address + i.address, instruction: i.mnemonic, details: i.op_str ) diff --git a/ujit_iface.c b/ujit_iface.c index 981c882ceb..7c553f4b3c 100644 --- a/ujit_iface.c +++ b/ujit_iface.c @@ -335,7 +335,8 @@ block_address(VALUE self) { block_t * block; TypedData_Get_Struct(self, block_t, &ujit_block_type, block); - return LONG2NUM((intptr_t)block); + uint8_t* code_addr = cb_get_ptr(cb, block->start_pos); + return LONG2NUM((intptr_t)code_addr); } /* Get the machine code for UJIT::Block as a binary string */ |
