beardypig / ghidra-emotionengine

Ghidra Processor for the Play Station 2's Emotion Engine MIPS based CPU
Apache License 2.0
198 stars 35 forks source link

"MIPS UnAlligned Instruction Fix" java.lang.NullPointerException #4

Closed NWPlayer123 closed 5 years ago

NWPlayer123 commented 5 years ago

Attempted to disassemble Persona 3 (original), US, got this lovely error. Using the latest release w/e https://github.com/beardypig/ghidra-emotionengine/releases/tag/v1.3.3

Analysis Task: MIPS UnAlligned Instruction Fix - 
java.lang.NullPointerException
    at ghidra.program.util.AbstractStoredProgramContext.getRegisterValue(AbstractStoredProgramContext.java:146)
    at ghidra.program.util.AbstractStoredProgramContext.getRegisterValue(AbstractStoredProgramContext.java:105)
    at ghidra.program.util.AbstractStoredProgramContext.getValue(AbstractStoredProgramContext.java:121)
    at ghidra.app.plugin.core.analysis.MipsPreAnalyzer.findPair(MipsPreAnalyzer.java:208)
    at ghidra.app.plugin.core.analysis.MipsPreAnalyzer.added(MipsPreAnalyzer.java:115)
    at ghidra.app.plugin.core.analysis.AnalysisScheduler.runAnalyzer(AnalysisScheduler.java:185)
    at ghidra.app.plugin.core.analysis.AnalysisTask.applyTo(AnalysisTask.java:39)
    at ghidra.app.plugin.core.analysis.AutoAnalysisManager$AnalysisTaskWrapper.run(AutoAnalysisManager.java:685)
    at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:785)
    at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:664)
    at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:629)
    at ghidra.app.plugin.core.analysis.AnalysisBackgroundCommand.applyTo(AnalysisBackgroundCommand.java:62)
    at ghidra.framework.plugintool.mgr.BackgroundCommandTask.run(BackgroundCommandTask.java:101)
    at ghidra.framework.plugintool.mgr.ToolTaskManager.run(ToolTaskManager.java:315)
    at java.base/java.lang.Thread.run(Thread.java:834)

---------------------------------------------------
Build Date: 2019-Feb-28 1236 EST
Ghidra Version: 9.0
Java Home: C:\Program Files\Java\jdk-11.0.2
JVM Version: Oracle Corporation 11.0.2
OS: Windows 10 10.0 amd64
Workstation: DESKTOP-HLKIA3M
Analysis Task: MIPS UnAlligned Instruction Fix - 
java.lang.NullPointerException

---------------------------------------------------
Build Date: 2019-Feb-28 1236 EST
Ghidra Version: 9.0
Java Home: C:\Program Files\Java\jdk-11.0.2
JVM Version: Oracle Corporation 11.0.2
OS: Windows 10 10.0 amd64
Workstation: DESKTOP-HLKIA3M
Analysis Task: MIPS UnAlligned Instruction Fix - 
java.lang.NullPointerException

---------------------------------------------------
Build Date: 2019-Feb-28 1236 EST
Ghidra Version: 9.0
Java Home: C:\Program Files\Java\jdk-11.0.2
JVM Version: Oracle Corporation 11.0.2
OS: Windows 10 10.0 amd64
Workstation: DESKTOP-HLKIA3M
beardypig commented 5 years ago

Thanks for the bug report. Did you install the processor in the Extensions directory or the Processors directory?

What is the name of the elf for Persona 3? - to make sure I can test the same one.

NWPlayer123 commented 5 years ago

I put it in ghidra_9.0\Ghidra\Extensions alongside the other loaders I use, thought it wouldn't work but it took. SLUS_215.69,

CRC32: 42B7F816
MD5: 143FBDA137A260D741E9974EF6479E19
SHA-1: 7825C34DD94D8B3773CE3422183D2E46AB1F4329
beardypig commented 5 years ago

What if you install it in to ghidra_9.0/Ghidra/Processors?

NWPlayer123 commented 5 years ago

same thing happens

beardypig commented 5 years ago

"MIPS UnAlligned Instruction Fix" is an analysis plugin, you can disable it when you run Auto Analysis. However, I can only recreate this issue when I have the processor installed in ghidra_9.0/Ghidra/Extensions move the emotionengine directory to ghidra_9.0/Ghidra/Processors (along with the built in Processors) and it works fine for me.

Can you try again please, creating a new project and re-importing the ELF?

GenericMadScientist commented 5 years ago

I'd like to add that I have the exact same problem, but with Yu-Gi-Oh!: The Duelists of the Roses (U). I get the same error message. I have the emotionengine directory in the Processors directory as per your suggestion.

The ELF is SLUS_205.15.

CRC-32: 6C3F6844
MD5: 238A9EB09EE00A4215474A68E1CBB3A6 
SHA-1: BEE9FC13D12AB2818822D905D820320FC6427F23
beardypig commented 5 years ago

OK. I have finally be able to recreate this issue - I'm not sure why it was working for me... but I now I can generate this error reliably.

beardypig commented 5 years ago

This is fixed in the latest release v1.4.0.

Please reopen this issue if you still have problems @NWPlayer123.

NWPlayer123 commented 5 years ago

btw there's a 9.0.1 released @beardypig @GenericMadScientist https://ghidra-sre.org/

beardypig commented 5 years ago

Thanks @NWPlayer123! I have included a build for 9.0.1 in the releases too, I suspect it would work just the same though ;)