metasm/disassemble.rb in metasm-1.0.2 vs metasm/disassemble.rb in metasm-1.0.3
- old
+ new
@@ -24,10 +24,12 @@
attr_accessor :comment
# a cache of the binding used by the backtracker to emulate this instruction
attr_accessor :backtrace_binding
# used during fixed-size instruction decoding to hold the decoded raw opcode
attr_accessor :raw_data
+ # arbitrary data used during decoding, architecture-specific
+ attr_accessor :misc
# create a new DecodedInstruction with an Instruction whose cpu is the argument
# can take an existing Instruction as argument
def initialize(arg, addr=nil)
case arg
@@ -542,11 +544,10 @@
# returns the canonical form of addr (absolute address integer or label of start of section + section offset)
def normalize(addr)
return addr if not addr or addr == :default
addr = Expression[addr].bind(@old_prog_binding).reduce if not addr.kind_of? Integer
- addr %= 1 << [@cpu.size, 32].max if @cpu and addr.kind_of? Integer
addr
end
# returns [edata, edata_base] or nil
# edata.ptr points to addr
@@ -1569,9 +1570,10 @@
next false if expr.kind_of? StoppedExpr
t = h[:looptrace]
oldexpr = t[0][0]
next false if expr == oldexpr # unmodifying loop
puts " bt loop at #{Expression[t[0][1]]}: #{oldexpr} => #{expr} (#{t.map { |z| Expression[z[1]] }.join(' <- ')})" if debug_backtrace
+ bt_log << [:loop, expr, oldexpr, t.map { |z| z[1] }] if bt_log
false
when :up
next false if only_upto and h[:to] != only_upto
next expr if expr.kind_of? StoppedExpr
oldexpr = expr