我读过@mraleph的文章,但仍然无法理解其中的内容 .so
由FlatterAndroid生成的文件。
我做了一个实验:对于我自己的应用程序,我从apk文件中提取.so( mkdir -p 07260818_apk_unzip && unzip 07260818.apk -d 07260818_apk_unzip
),并将说明转储( objdump -d ./07260818_apk_unzip/lib/armeabi-v7a/libapp.so > objdump.txt
). 我还分割调试信息并进行模糊处理,所以我还转储了矮人信息( drawfdump
).
我手动抛出一个异常,如
// debug_page.dart
OutlinedButton(
onPressed: () => throw Exception('hello exception (from simply onPressed) ${DateTime.now()}'),
child: Text('normal'),
),
请参阅堆栈:
https://user-images.githubusercontent.com/5236035/126918360-67885121-c8bc-440a-93cb-38ce971b8bc1.png
让我看看0x5dfbdb:
矮子-
0x001b3d78: DW_TAG_subprogram
DW_AT_abstract_origin (0x000bf66f "__BodyState.build.<anonymous closure>")
DW_AT_low_pc (0x00000000005dfb18)
DW_AT_high_pc (0x00000000005dfbe0)
0x001b3d85: DW_TAG_inlined_subroutine
DW_AT_abstract_origin (0x00006727 "new DateTime.now")
DW_AT_low_pc (0x00000000005dfb54)
DW_AT_high_pc (0x00000000005dfb64)
DW_AT_call_file ("package:yplusplus/pages/debug_page.dart")
DW_AT_call_line (119)
DW_AT_call_column (102)
0x001b3d96: DW_TAG_inlined_subroutine
DW_AT_abstract_origin (0x0000673c "new DateTime._now")
DW_AT_low_pc (0x00000000005dfb54)
DW_AT_high_pc (0x00000000005dfb64)
DW_AT_call_file ("dart:core/date_time.dart")
DW_AT_call_line (209)
DW_AT_call_column (25)
0x001b3da7: NULL
0x001b3da8: NULL
0x001b3da9: DW_TAG_inlined_subroutine
DW_AT_abstract_origin (0x00005e4e "new Exception")
DW_AT_low_pc (0x00000000005dfbbc)
DW_AT_high_pc (0x00000000005dfbc8)
DW_AT_call_file ("package:yplusplus/pages/debug_page.dart")
DW_AT_call_line (119)
DW_AT_call_column (40)
0x001b3dba: NULL
0x001b3dbb: NULL
指示-
5dfb10: f6 f5 0c eb bl #3397592 <_kDartIsolateSnapshotInstructions+0x9112f0>
5dfb14: 70 00 20 e1 bkpt #0
5dfb18: 00 48 2d e9 push {r11, lr}
5dfb1c: 00 b0 8d e2 add r11, sp, #0
5dfb20: 08 d0 4d e2 sub sp, sp, #8
5dfb24: 20 c0 9a e5 ldr r12, [r10, #32]
5dfb28: 0c 00 5d e1 cmp sp, r12
5dfb2c: 71 fa 0c 9b blls #3402180 <_kDartIsolateSnapshotInstructions+0x9124f8>
5dfb30: 68 10 9a e5 ldr r1, [r10, #104]
5dfb34: 04 20 a0 e3 mov r2, #4
5dfb38: 2c fa 0c eb bl #3401904 <_kDartIsolateSnapshotInstructions+0x9123f0>
5dfb3c: 04 00 0b e5 str r0, [r11, #-4]
5dfb40: 0b 20 80 e2 add r2, r0, #11
5dfb44: 19 ca 85 e2 add r12, r5, #102400
5dfb48: 6f c1 9c e5 ldr r12, [r12, #367]
5dfb4c: 00 c0 82 e5 str r12, [r2]
5dfb50: 71 ae e9 eb bl #-5850684 <_kDartIsolateSnapshotInstructions+0x3f51c>
5dfb54: 08 00 0b e5 str r0, [r11, #-8]
5dfb58: 70 c0 9a e5 ldr r12, [r10, #112]
5dfb5c: 0f c0 80 e5 str r12, [r0, #15]
5dfb60: 4e ae e9 eb bl #-5850824 <_kDartIsolateSnapshotInstructions+0x3f4a0>
5dfb64: c0 1f a0 e1 asr r1, r0, #31
5dfb68: c0 20 b0 e1 asrs r2, r0, #1
5dfb6c: 01 00 00 3a blo #4 <_kDartIsolateSnapshotInstructions+0x5d3b78>
5dfb70: 07 20 90 e5 ldr r2, [r0, #7]
5dfb74: 0b 10 90 e5 ldr r1, [r0, #11]
5dfb78: 08 00 1b e5 ldr r0, [r11, #-8]
5dfb7c: 07 20 80 e5 str r2, [r0, #7]
5dfb80: 0b 10 80 e5 str r1, [r0, #11]
5dfb84: 04 10 1b e5 ldr r1, [r11, #-4]
5dfb88: 0f 90 81 e2 add r9, r1, #15
5dfb8c: 00 00 89 e5 str r0, [r9]
5dfb90: 01 00 10 e3 tst r0, #1
5dfb94: 05 00 00 0a beq #20 <_kDartIsolateSnapshotInstructions+0x5d3bb0>
5dfb98: 01 c0 51 e5 ldrb r12, [r1, #-1]
5dfb9c: 01 e0 50 e5 ldrb lr, [r0, #-1]
5dfba0: 2c c1 0e e0 and r12, lr, r12, lsr #2
5dfba4: 24 e0 9a e5 ldr lr, [r10, #36]
5dfba8: 0e 00 1c e1 tst r12, lr
5dfbac: d9 f5 0c 1b blne #3397476 <_kDartIsolateSnapshotInstructions+0x911318>
5dfbb0: 04 00 1b e5 ldr r0, [r11, #-4]
5dfbb4: 04 00 2d e5 str r0, [sp, #-4]!
5dfbb8: a8 b5 e8 eb bl #-6105440 <_kDartIsolateSnapshotInstructions+0x1260>
5dfbbc: 04 d0 8d e2 add sp, sp, #4
5dfbc0: 04 00 0b e5 str r0, [r11, #-4]
5dfbc4: 27 9e e9 eb bl #-5867364 <_kDartIsolateSnapshotInstructions+0x3b468>
5dfbc8: 00 10 a0 e1 mov r1, r0
5dfbcc: 04 00 1b e5 ldr r0, [r11, #-4]
5dfbd0: 03 00 81 e5 str r0, [r1, #3]
5dfbd4: 01 00 a0 e1 mov r0, r1
5dfbd8: c4 f5 0c eb bl #3397392 <_kDartIsolateSnapshotInstructions+0x9112f0>
5dfbdc: 70 00 20 e1 bkpt #0
5dfbe0: 00 48 2d e9 push {r11, lr}
5dfbe4: 00 b0 8d e2 add r11, sp, #0
5dfbe8: 10 d0 4d e2 sub sp, sp, #16
然而,这很奇怪。0x5dfbdb上根本没有指令(这就像是在指令的中间。另外,dart编译器生成的.so文件只不过是机器指令吗?我在.so文件中没有看到dart vm。
谢谢你的建议!
1条答案
按热度按时间polhcujo1#
它使用C/C代码,所以文件是C/C + LIB输出文件,一般是用GNU GCC编译的,可以读取jonathan levin android内部的书(第3章),然后可以得到主概念