AVR - CPSE branch doesn't appear on graph mode
Work environment
| Questions | Answers |
|---|---|
| OS/arch/bits (mandatory) | Windows 10 x64, Arch Linux x64 (reproduced on both |
| File format of the file you reverse (mandatory) | AVR ROM |
| Architecture/bits of the file (mandatory) | AVR 8bit |
| r2 -v full output, not truncated (mandatory) | radare2 3.0.0-git 19608 @ windows-x86-64 git.2.9.0-232-g18de6e4af ; commit: 18de6e4affe0e2fb45f43e9706aac3339bb63aba build: Fri 09/28/2018__ 9:28:04.10 |
Expected behavior
CPSE (compare skip is equal) should branch in graph view into 2 blocks, as depending on the operation result it might skip the next instruction.
Actual behavior
The instruction does end the control flow block (similarly to br* instructions) but it doesn't branch and shows only one edge, pointing to the instruction after the instruction that may be skipped - the instruction after cpse simply doesn't appear on the graph. This is the actual code, from function disassembly view:
[0x0000042c]> pd 3
│ ╭─< 0x0000042c 8111 cpse r24, r1
│ 0x0000042e 0e947500 call 0xea ; fcn.000000ea
│ │ ; CODE XREF from setupAndLoop (0x42c)
│ ╰─> 0x00000432 eb2d mov r30, r11 ; branch between switch states
And this is what it looks like in graph view:
As you can see, the call 0xea instruction on 0x0000042e is omitted from the graph.
Steps to reproduce the behavior
- Open the binary - leds.bin.zip
- Analyze with
aaa/aaaa(tested with both) - Seek to a location with
cpseinstruction (0x42cis such a place) - Open graph view (
vv)
*Not really related to this issue but it is worth mentioning that the r2 suite (r2 & rasm2) was unable to assemble this instruction (though disassembly worked, as seen in this example)
next time send a PR fixing it, its simpler than reporting this kind of bugs
On 28 Sep 2018, at 06:40, yarjor [email protected] wrote:
Work environment
Questions Answers OS/arch/bits (mandatory) Windows 10 x64, Arch Linux x64 (reproduced on both File format of the file you reverse (mandatory) AVR ROM Architecture/bits of the file (mandatory) AVR 8bit r2 -v full output, not truncated (mandatory) radare2 3.0.0-git 19608 @ windows-x86-64 git.2.9.0-232-g18de6e4af ; commit: 18de6e4 https://github.com/radare/radare2/commit/18de6e4affe0e2fb45f43e9706aac3339bb63aba build: Fri 09/28/2018__ 9:28:04.10 Expected behavior
CPSE (compare skip is equal) should branch in graph view into 2 blocks, as depending on the operation result it might skip the next instruction.
Actual behavior
The instruction does end the control flow block (similarly to br* instructions) but it doesn't branch and shows only one edge, pointing to the instruction after the instruction that may be skipped - the instruction after cpse simply doesn't appear on the graph. This is the actual code, from function disassembly view:
[0x0000042c]> pd 3 │ ╭─< 0x0000042c 8111 cpse r24, r1 │ 0x0000042e 0e947500 call 0xea ; fcn.000000ea │ │ ; CODE XREF from setupAndLoop (0x42c) │ ╰─> 0x00000432 eb2d mov r30, r11 ; branch between switch states And this is what it looks like in graph view: https://user-images.githubusercontent.com/18593594/46203146-85260a80-c321-11e8-9053-82bc36c5ac1e.png As you can see, the call 0xea instruction on 0x0000042e is omitted from the graph.
Steps to reproduce the behavior
Open the binary - leds.bin.zip https://github.com/radare/radare2/files/2427821/leds.bin.zip Analyze with aaa / aaaa (tested with both) Seek to a location with cpse instruction (0x42c is such a place) Open graph view (vv) *Not really related to this issue but it is worth mentioning that the r2 suite (r2 & rasm2) was unable to assemble this instruction (though disassembly worked, as seen in this example)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/11684, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-lh4pWFBwPiP7RYVMd013P2OnRVHGks5uffyjgaJpZM4W-RUC.