mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix issue with block address accessor. Print absolute addresses.
This commit is contained in:
parent
79d6e9618d
commit
9def269b47
2 changed files with 5 additions and 4 deletions
6
ujit.rb
6
ujit.rb
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue