radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.78k stars 3.01k forks source link

Tricore disassembly incorrect #17350

Closed DarrylC03 closed 4 years ago

DarrylC03 commented 4 years ago

OS/arch/bits (mandatory) | Windows 10 X64 File format of the file you reverse (mandatory) | Binary Architecture/bits of the file (mandatory) | Tricore 32 r2 -v full output, not truncated (mandatory) | r2r -v r2r 4.5.0 1 @ windows-x86-32 git.4.5.0 commit: 9d7eda5ec7367d1682e489e92d1be8e37e459296 build: Fri 07/17/2020__11:10:04.28

It looks like you have the same bug in TriCore disassembly that the objdump utility displays.

Here is a sample with IDA, objdump and rasm disassembly of the binary: image

XVilka commented 4 years ago

Could you please craft a test for the r2r? See test/db/asm directory and other files as an example.

DarrylC03 commented 4 years ago

@XVilka I will write a simple script to parse the IDA disassembled versions and create that file. Can you point me to the documentation for this file? Most of it is obvious but I assume the first field describes opcode type and addressing modes?

I will also look at fixing the source you used. There are other bugs like this: image

in that is incorrectly uses the %a15 computed value as the implied address for the %sp (%a10).

This propagated from the original objdump as well.

DarrylC03 commented 4 years ago

Binary supplied was the issue and was generated by perl in Windows and was missing binmode. Apologize and will close the issue.