metasm/cpu/dalvik/decode.rb in metasm-1.0.3 vs metasm/cpu/dalvik/decode.rb in metasm-1.0.4
- old
+ new
@@ -104,10 +104,14 @@
val << edata.decode_imm(:u16, @endianness)
DexType.new(@dex, val.last)
when :str16
val << edata.decode_imm(:u16, @endianness)
DexString.new(@dex, val.last)
+ when :str32
+ val << edata.decode_imm(:u16, @endianness)
+ val << edata.decode_imm(:u16, @endianness)
+ DexString.new(@dex, (val[-2] | (val[-1] << 16)))
else raise SyntaxError, "Internal error: invalid argument #{a} in #{op.name}"
end
}
di.bin_length = val.length*2
@@ -124,14 +128,10 @@
end
di
end
- def backtrace_binding
- @backtrace_binding ||= init_backtrace_binding
- end
-
def init_backtrace_binding
@backtrace_binding ||= {}
sz = @size/8
@opcode_list.each { |op|
case op.name
@@ -145,31 +145,9 @@
:callstack => Expression[:callstack, :+, sz]
} }
end
}
@backtrace_binding
- end
-
- def get_backtrace_binding(di)
- a = di.instruction.args.map { |arg|
- case arg
- when Reg; arg.symbolic
- else arg
- end
- }
-
- if binding = backtrace_binding[di.opcode.name]
- binding[di, *a]
- else
- puts "unhandled instruction to backtrace: #{di}" if $VERBOSE
- # assume nothing except the 1st arg is modified
- case a[0]
- when Indirection, Symbol; { a[0] => Expression::Unknown }
- when Expression; (x = a[0].externals.first) ? { x => Expression::Unknown } : {}
- else {}
- end.update(:incomplete_binding => Expression[1])
- end
-
end
def get_xrefs_x(dasm, di)
if di.opcode.props[:saveip]
m = di.instruction.args.first