Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disassembling 68HC11 code doesn't form functions properly. #15013

Closed
xuulan opened this issue Sep 10, 2019 · 5 comments
Closed

Disassembling 68HC11 code doesn't form functions properly. #15013

xuulan opened this issue Sep 10, 2019 · 5 comments

Comments

@xuulan
Copy link

xuulan commented Sep 10, 2019

I'm trying to disassemble an embedded 68HC11 file. I'm using Cutter (OS X). I can import the file and have it located in memory correctly. However when I try and define functions, it will get as far as a branch and then end the function there. It doesn't follow the branch properly. This also happens with 6809 code. I have disassembled 68000 and 8086 code and the function definition works properly.

I've included the code here, it's for a 68HC11, starting at 0x8000.
purple_32501.bin.zip

@radare
Copy link
Collaborator

radare commented Sep 13, 2019 via email

@xuulan
Copy link
Author

xuulan commented Sep 13, 2019

I guess I should be more clear. The code is only 68HC11, when I was referring to 68000 and 8086 it was for other files, not this one. I was trying to show that I'm using the same process for other files where Cutter worked properly.
Version 1.9.0
Using r2-3.8.0
Based on Qt 5.12.1 (Clang 10.0 (Apple), 64 bit)
I don't have a script but here is the process:
Open file (purple_32501.bin)
Analysis enabled, use virtual addressing, import de-mangled symbols.
Advanced options:Architecture M680x, CPU 6811
Bits, endianness kernel, format all auto
Load bin offset 0x0000
Map offset 0x8000
Locate to 0x8000 (clra instruction)
Add Function here (at 0x8000)
The function stops at 0x8022 (bra $8027)
I assume you've unzipped the file. Size according to Cutter is 32.8 kB

@radare radare closed this as completed in 8488ee9 Sep 15, 2019
@radare
Copy link
Collaborator

radare commented Sep 15, 2019

the issue is now fixed, but the analysis plugin is far from being perfect, see the commit i fixed the problem and improve it while you go. Basically what i found is that:

  • no ESIL support for m680x (just construct the strings out of the capstone info)
  • opex (aoj~{}) is empty (broken json)
  • many other instructions miss basic analysis info

This is the first binary i see for m680x, so that's why the support for this arch was pretty basic. do you think we can ship it in the testsuite? or there are legal issues for distributing it?

@radare
Copy link
Collaborator

radare commented Sep 15, 2019

btw i have added a test case for this bugfix in db/anal/m680x

@radare
Copy link
Collaborator

radare commented Sep 15, 2019

also i have fixed the broken json in aoj~{}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants