* Split `rz_core_print_disasm_json` as: `rz_core_print_disasm_json` and `rz_core_disasm` * Use `rz_str_enc_string_as_type` in `ds_init` * Refactor `rz_core_print_disasm` and `rz_core_handle_backwards_disasm` * Add `rz_core_asm_bb_middle` * Move global `disasm_texts` to `RzDisasmState` * Rewrite `core_analysis_bytes_standard` with `rz_core_analysis_bytes` * Add `test_rz_core_print_disasm` and `test_rz_core_analysis_bytes` * Rewrite `rz_core_print_disasm` with `RzCmdStateOutput` * `pdi` -> `pdq` in tests * `pdi` -> `pDq` in tests * `pid` -> `pdq` in tests * `pId` -> `pDq` in tests * `pij` -> `pdj` in tests * `pIj` -> `pDj` in tests * `pdeqq` -> `pdeQ` in tests * Remove `pDJ` from `test/db/json/`
123 lines
3.1 KiB
Text
123 lines
3.1 KiB
Text
NAME=ELF: long symbol names
|
|
FILE=bins/elf/analysis/longsym
|
|
CMDS=?lq `isq~pata`;?vi
|
|
EXPECT=<<EOF
|
|
194
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: simple.elf - code
|
|
FILE=bins/elf/analysis/simple.elf
|
|
CMDS=<<EOF
|
|
e asm.bytes=true
|
|
e asm.sub.names=false
|
|
pdq 4 @ entry0
|
|
EOF
|
|
EXPECT=<<EOF
|
|
0x08000060 section..text:
|
|
0x08000060 b990000008 mov ecx, 0x8000090
|
|
0x08000065 ba0d000000 mov edx, 0xd
|
|
0x0800006a bb01000000 mov ebx, 1
|
|
0x0800006f b804000000 mov eax, 4
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: asm.flags.middle=0 + local symbols
|
|
FILE=bins/elf/analysis/example.elf
|
|
CMDS=e asm.flags.middle=0;e asm.bytes=true;pd 3 @ 0x356
|
|
EXPECT=<<EOF
|
|
: 0x00000356 00f033f9 bl sym.app_uart_get
|
|
: 0x0000035a 0028 cmp r0, 0
|
|
`=< 0x0000035c fad1 bne 0x354
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: asm.flags.middle=1 + local symbols
|
|
FILE=bins/elf/analysis/example.elf
|
|
CMDS=e asm.flags.middle=1;e asm.bytes=true;pd 3 @ 0x356
|
|
EXPECT=<<EOF
|
|
: 0x00000356 00f033f9 bl sym.app_uart_get
|
|
: 0x0000035a 0028 cmp r0, 0
|
|
`=< 0x0000035c fad1 bne 0x354
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: asm.flags.middle + local symbols
|
|
FILE=bins/elf/analysis/example.elf
|
|
CMDS=e asm.bytes=true; pd 3 @ 0x356;
|
|
EXPECT=<<EOF
|
|
: 0x00000356 00f033f9 bl sym.app_uart_get
|
|
: 0x0000035a 0028 cmp r0, 0
|
|
`=< 0x0000035c fad1 bne 0x354
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: asm.flags.middle2 + local symbols
|
|
FILE=bins/elf/analysis/example.elf
|
|
CMDS=<<EOF
|
|
e asm.bytes=true
|
|
e asm.flags.middle=0
|
|
pd 3 @ 0x356
|
|
EOF
|
|
EXPECT=<<EOF
|
|
: 0x00000356 00f033f9 bl sym.app_uart_get
|
|
: 0x0000035a 0028 cmp r0, 0
|
|
`=< 0x0000035c fad1 bne 0x354
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: local symbols
|
|
FILE=bins/elf/analysis/example.elf
|
|
CMDS=is*~d_41
|
|
EXPECT=<<EOF
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: phdr override
|
|
FILE=bins/elf/analysis/phdr-override
|
|
CMDS=iiq
|
|
EXPECT=<<EOF
|
|
system
|
|
__libc_start_main
|
|
__gmon_start__
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: phdr override 2
|
|
FILE=bins/elf/busybox-phdr-shdr
|
|
CMDS=ii~OBJ
|
|
EXPECT=<<EOF
|
|
7 ---------- GLOBAL OBJ __environ
|
|
43 ---------- GLOBAL OBJ __ctype_tolower
|
|
145 ---------- GLOBAL OBJ __stdout
|
|
189 ---------- GLOBAL OBJ stderr
|
|
409 ---------- GLOBAL OBJ stdin
|
|
410 ---------- GLOBAL OBJ __stdin
|
|
417 ---------- GLOBAL OBJ optind
|
|
468 ---------- GLOBAL OBJ environ
|
|
588 ---------- GLOBAL OBJ optarg
|
|
667 ---------- GLOBAL OBJ __ctype_b
|
|
706 ---------- GLOBAL OBJ allCountryList
|
|
718 ---------- GLOBAL OBJ stdout
|
|
EOF
|
|
RUN
|
|
|
|
NAME=ELF: no symbol overwrite
|
|
FILE=bins/elf/libc.so.6
|
|
CMDS=<<EOF
|
|
is~getpid
|
|
fl~getpid
|
|
EOF
|
|
EXPECT=<<EOF
|
|
581 0x000c9420 0x000c9420 WEAK FUNC 12 getpid
|
|
965 0x000c9420 0x000c9420 GLOBAL FUNC 12 __getpid
|
|
3577 0x000c9420 0x000c9420 LOCAL FUNC 12 __GI___getpid
|
|
3807 0x000c9420 0x000c9420 LOCAL FUNC 12 __GI_getpid
|
|
6267 0x000c9420 0x000c9420 WEAK FUNC 12 getpid
|
|
8102 0x000c9420 0x000c9420 GLOBAL FUNC 12 __getpid
|
|
0x000c9420 12 sym.getpid
|
|
0x000c9420 12 sym.__getpid
|
|
0x000c9420 12 sym.__GI___getpid
|
|
0x000c9420 12 sym.__GI_getpid
|
|
EOF
|
|
RUN
|