java - How to use org.jf.dexlib2 get instructions’ byte code in a dexfile -
i want instruction's byte code,but code can opcode's byte code.such 0x38 01 fb ff
means if-eqz v1, -0x5
.i can 0x38
means if-eqz
,but don't know how 0x01 fb ff
means v1, -0x5
for (classdef classdef: dexfile.getclasses()){ (method method : classdef.getmethods()){ if (method.getimplementation()==null) continue; (instruction :method.getimplementation().getinstructions()){ i.getopcode().values(); } } }
you can use baksmali's -d option print annotated hex dump of dex file. produce 2-column hex dump, left column containing raw byte values, , right column containing annotations bytes are, per dex specification.
for example:
> baksmali -n -d penroser.dump penroser.apk > less penroser.dump ... (lots of other stuff :)) |[26] code_item: lafzkl/development/mcolorpicker/views/colorpickerview;->pointtohue(f)f 0075f4: 0600 | registers_size = 6 0075f6: 0200 | ins_size = 2 0075f8: 0100 | outs_size = 1 0075fa: 0000 | tries_size = 0 0075fc: 8690 0100 | debug_info_off = 0x19086 007600: 2100 0000 | insns_size = 0x21 | instructions: 007604: 1503 b443 | const/high16 v3, 1135869952 # 360.000000 007608: 5441 1e00 | iget-object v1, v4, lafzkl/development/mcolorpicker/views/colorpickerview;->mhuerect:landroid/graphics/rectf; 00760c: 6e10 a700 0100 | invoke-virtual {v1}, landroid/graphics/rectf;->height()f 007612: 0a00 | move-result v0 007614: 5212 3b00 | iget v2, v1, landroid/graphics/rectf;->top:f 007618: 2e02 0502 | cmpg-float v2, v5, v2 00761c: 3b02 0900 | if-gez v2, +0x9 007620: 1205 | const/4 v5, 0 007622: a802 0503 | mul-float v2, v5, v3 007626: c902 | div-float/2addr v2, v0 007628: a702 0302 | sub-float v2, v3, v2 00762c: 0f02 | return v2 00762e: 5212 3800 | iget v2, v1, landroid/graphics/rectf;->bottom:f 007632: 2d02 0502 | cmpl-float v2, v5, v2 007636: 3d02 0400 | if-lez v2, +0x4 00763a: 0105 | move v5, v0 00763c: 28f3 | goto -0xd 00763e: 5212 3b00 | iget v2, v1, landroid/graphics/rectf;->top:f 007642: c725 | sub-float/2addr v5, v2 007644: 28ef | goto -0x11 007646: 0000 |
Comments
Post a Comment