beardypig / ghidra-emotionengine

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

Decompiler: Unable to initialize the DecompilerInterface: java.lang.RuntimeException: No Register Defined: s8 #17

Closed rafalh closed 5 years ago

rafalh commented 5 years ago

I'm getting following exception in decompiler (Ghirda 9.0.4):

2019-07-24 14:20:30 ERROR (DecompileProcess) Unexpected Exception: No Register Defined: s8 java.lang.RuntimeException: No Register Defined: s8
    at ghidra.app.decompiler.DecompileCallback.getRegister(DecompileCallback.java:724)
    at ghidra.app.decompiler.DecompileProcess.getRegister(DecompileProcess.java:619)
    at ghidra.app.decompiler.DecompileProcess.readResponse(DecompileProcess.java:322)
    at ghidra.app.decompiler.DecompileProcess.registerProgram(DecompileProcess.java:444)
    at ghidra.app.decompiler.DecompInterface.initializeProcess(DecompInterface.java:228)
    at ghidra.app.decompiler.DecompInterface.openProgram(DecompInterface.java:314)
    at ghidra.app.decompiler.component.Decompiler.getDecompilerInterface(Decompiler.java:79)
    at ghidra.app.decompiler.component.Decompiler.decompile(Decompiler.java:48)
    at ghidra.app.decompiler.component.DecompilerManager.decompile(DecompilerManager.java:167)
    at ghidra.app.decompiler.component.DecompileRunnable.monitoredRun(DecompileRunnable.java:108)
    at ghidra.util.task.RunManager$RunnerJob.doExecute(RunManager.java:334)
    at ghidra.util.task.RunManager$RunnerJob.run(RunManager.java:309)
    at ghidra.util.worker.AbstractWorker$JobCallback.process(AbstractWorker.java:133)
    at ghidra.util.worker.AbstractWorker$JobCallback.process(AbstractWorker.java:123)
    at generic.concurrent.ConcurrentQ$CallbackCallable.call(ConcurrentQ.java:655)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at generic.concurrent.FutureTaskMonitor.run(FutureTaskMonitor.java:70)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

Am I doing something wrong or decompilation is not supported?

beardypig commented 5 years ago

Does it work with 9.0.3, @bigianb else also reported an issue (#14) with 9.0.4, which appears to be the same.

I'll take a look, I've been using an older version of Ghidra :]

rafalh commented 5 years ago

From what I know there was no 9.0.3 release. I tried with 9.0.1 (decompiler seems to work) and 9.0.2 (the same error as in 9.0.4). I think it may be related to issue #14. I've seen it before creating this issue but this exception wasn't mentioned so I supposed it was a different error but maybe it's the same...

rafalh commented 5 years ago

I've checked differences between data/languages directory in extension for 9.0.1 and for 9.0.2 and the biggest difference is r5900.sla file:

astrelsky commented 5 years ago

The .sla is the sleigh compiled file.

rafalh commented 5 years ago

I've managed to run decompilation in Ghirda 9.0.2 after copying sla file from 9.0.1 extension to 9.0.2. So I guess this file is causing No Register Defined issue

astrelsky commented 5 years ago

I've managed to run decompilation in Ghirda 9.0.2 after copying sla file from 9.0.1 extension to 9.0.2. So I guess this file is causing No Register Defined issue

I know 9.1 will do this, but try deleting the .sla file and then using it in 9.0.4 and see if ghidra recompiles it.

beardypig commented 5 years ago

The releases where compiled using the gradle build script provided by Ghidra, but I have not updated the gradle file since the first release - perhaps they changed something in that...

rafalh commented 5 years ago

I tried compiling using Gradle but it didn't generate the .sla file at all: gradle -PGHIDRA_INSTALL_DIR=/home/rafalh/Ghidra/ghidra_9.0.2/ Then I used the sleigh script manually: ../ghidra_9.0.2/support/sleigh -a data/languages/ It generated 909KB r5900.sla file which had "s8" strings included. From what I saw in support/buildExtension.gradle included in build.gradle file all files from repository are included in the built extension zip (expect for blacklisted). I guess @beardypig must have had an invalid sla file in repo during the build of 9.0.2 and 9.0.4 packages.

beardypig commented 5 years ago

Thanks @rafalh, that looks like it was the problem :) There were some old compiles sla files that were getting picked up. I have removed them from the builds and it seems to work for me, please could you test it works for you?

rafalh commented 5 years ago

New packages fixed the problem :) Thank you!