ghidra
ghidra copied to clipboard
dsPIC30F6014 Emulation Error
Describe the bug Attempting to emulate a dsPIC30F6014 file causes:
java.lang.IllegalArgumentException: Memory-mapped register PC does not map to space register:
To Reproduce Steps to reproduce the behavior:
- Compile program with the XC16 compiler:
#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}
- Compile for dsPIC30F6014:
xc16-gcc -mcpu=30f6014 -o hello_world2.elf hello_world2.c
- Load program into Ghidra and analyze.
- Navigate to
_main - Right click on instruction and click
Emulate Program in new Trace
Expected behavior The ability to emulate the instructions.
Screenshots If applicable, add screenshots to help explain your problem.
Attachments error2.log
Environment (please complete the following information):
- OS: Ubuntu 20.04 Linux 5.15.0-71-generic amd64
- Java Version: openjdk 17.0.7
- Ghidra Version: 10.2.3
- Ghidra Origin: Official GitHub distro
Let me know if you need me to provide anything else.
Can you tell which instruction this is occurring at?
It has occurred on every instruction I have tested (I think). The main instructions I have tried are the first ones in _main:
0x0B86 lnk 0x0B88 mov.w 0x0B8A push
The emulator has changed quite a bit from 10.2.3 to 10.3. Can you confirm this is still an issue in 10.3?
Anything else I can test or assist with/any pointers on how I can work to solve this? I am not a Java guy, but this is a blocker for me at work, so I am planning to try and debug if possible.
Interesting. Thanks for the full stack trace, as it explains why (perhaps) this error isn't caught in our unit tests. The error is actually produced by the "Stack" window. For emulation, that window doesn't (yet) produce anything useful anyway, so you might try disabling it and seeing if things improve:
- Open the Debugger or Emulator tool (probably Emulator).
- Select File -> Configure in the menus.
- Click the "Configure" link in the "Debugger" category.
- Un-check the "DebuggerStackPlugin" and confirm/dismiss all the dialogs.
- Try emulating your program again.
(Sorry for the delay. I was out the last 2 weeks.)
OK. Nevermind my previous advice. It happens in a lot of UI components. I've started working on a patch.
Great! Thanks so much!