ghidra_psx_ldr
ghidra_psx_ldr copied to clipboard
Crash when importing SLES_004.68 or SLUS_004.98 from Moto Racer
When trying to import either SLES_004.68 or SLUS_004.98 from Moto Racer, the import crashes with the following message:
Split cannot be done on block start address
java.lang.IllegalArgumentException: Split cannot be done on block start address
at ghidra.program.database.mem.MemoryMapDB.split(MemoryMapDB.java:959)
at psx.PsxLoader.createCompilerSegments(PsxLoader.java:700)
at psx.PsxLoader.load(PsxLoader.java:313)
at ghidra.app.util.opinion.AbstractLibrarySupportLoader.doLoad(AbstractLibrarySupportLoader.java:752)
at ghidra.app.util.opinion.AbstractLibrarySupportLoader.loadProgram(AbstractLibrarySupportLoader.java:100)
at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:132)
at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:388)
at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:347)
at ghidra.util.task.TaskBuilder$TaskBuilderTask.run(TaskBuilder.java:306)
at ghidra.util.task.Task.monitoredRun(Task.java:134)
at ghidra.util.task.TaskRunner.lambda$startTaskThread$0(TaskRunner.java:106)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
---------------------------------------------------
Build Date: 2023-Mar-04 1101 CET
Ghidra Version: 10.3
Java Home: /usr/lib/jvm/java-17-openjdk
JVM Version: N/A 17.0.6
OS: Linux 5.15.79.1-microsoft-standard-WSL2 amd64
Looking at Ghidra through a debugger, it appears the plugin is trying to split a memory block at address 0x8001b000, which also starts at 0x8001b000. The method MemoryMapDB.split() checks for that and throws an exception.
Patching out the check for an early return inside MemoryMapDB.split() results in a successful import, so maybe the fix would be to skip calls to MemoryMapDB.split() inside the plugin if the memory block start address and the split address are the same.
Thanks. This happens, when my code which looks for segments definition in a game does it incorrectly.