ripnet / ghidra-m32r

M32R Processor Support for Ghidra
5 stars 7 forks source link

Can't read language spec / invalid processor specification file #3

Open Maggggggggus opened 1 year ago

Maggggggggus commented 1 year ago

Describe the bug Error when loading files with m32r language. Directory tree is respected and Module.manifest added.

To Reproduce Steps to reproduce the behavior:

Import a new file Choose M32r as the processor Hit Ok Expected behavior The file should be imported. Instead I get lots of exceptions.

Screenshots

Unbenannt

Environment (please complete the following information):

Build Date: 2023-Jul-11 1640 EDT Ghidra Version: 10.3.2 Java Home: D:\Program Files\Java\jdk-17 JVM Version: Oracle Corporation 17.0.8 OS: Windows 10 10.0 amd64

Additional context

Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec ghidra.app.plugin.processors.sleigh.SleighException: Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:222) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validatePspecFile(SleighLanguageValidator.java:191) at ghidra.app.plugin.processors.sleigh.SleighLanguage.initialize(SleighLanguage.java:139) at ghidra.app.plugin.processors.sleigh.SleighLanguage.(SleighLanguage.java:116) at ghidra.app.plugin.processors.sleigh.SleighLanguageProvider.getLanguage(SleighLanguageProvider.java:132) at ghidra.program.util.DefaultLanguageService$LanguageInfo.lambda$getLanguage$0(DefaultLanguageService.java:332) 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) Caused by: com.sun.msv.verifier.ValidityViolation; lineNumber: 1779; columnNumber: 82; at least one of the following attributes is required for element "memory_block": bit_mapped_address,byte_mapped_address,initialized at com.sun.msv.verifier.Verifier.onError(Verifier.java:367) at com.sun.msv.verifier.Verifier.onError(Verifier.java:363) at com.sun.msv.verifier.Verifier.startElement(Verifier.java:232) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825) at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224) at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637) at org.iso_relax.verifier.impl.VerifierImpl.verify(VerifierImpl.java:121) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:217) ... 11 more

Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec ghidra.app.plugin.processors.sleigh.SleighException: Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:222) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validatePspecFile(SleighLanguageValidator.java:191) at ghidra.app.plugin.processors.sleigh.SleighLanguage.initialize(SleighLanguage.java:139) at ghidra.app.plugin.processors.sleigh.SleighLanguage.(SleighLanguage.java:116) at ghidra.app.plugin.processors.sleigh.SleighLanguageProvider.getLanguage(SleighLanguageProvider.java:132) at ghidra.program.util.DefaultLanguageService$LanguageInfo.lambda$getLanguage$0(DefaultLanguageService.java:332) 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) Caused by: com.sun.msv.verifier.ValidityViolation; lineNumber: 1779; columnNumber: 82; at least one of the following attributes is required for element "memory_block": bit_mapped_address,byte_mapped_address,initialized at com.sun.msv.verifier.Verifier.onError(Verifier.java:367) at com.sun.msv.verifier.Verifier.onError(Verifier.java:363) at com.sun.msv.verifier.Verifier.startElement(Verifier.java:232) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825) at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224) at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637) at org.iso_relax.verifier.impl.VerifierImpl.verify(VerifierImpl.java:121) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:217) ... 11 more


Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec ghidra.app.plugin.processors.sleigh.SleighException: Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:222) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validatePspecFile(SleighLanguageValidator.java:191) at ghidra.app.plugin.processors.sleigh.SleighLanguage.initialize(SleighLanguage.java:139) at ghidra.app.plugin.processors.sleigh.SleighLanguage.(SleighLanguage.java:116) at ghidra.app.plugin.processors.sleigh.SleighLanguageProvider.getLanguage(SleighLanguageProvider.java:132) at ghidra.program.util.DefaultLanguageService$LanguageInfo.getLanguage(DefaultLanguageService.java:341) at ghidra.program.util.DefaultLanguageService.getLanguage(DefaultLanguageService.java:64) at ghidra.app.util.opinion.BinaryLoader.loadProgram(BinaryLoader.java:277) at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:131) 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) Caused by: com.sun.msv.verifier.ValidityViolation; lineNumber: 1779; columnNumber: 82; at least one of the following attributes is required for element "memory_block": bit_mapped_address,byte_mapped_address,initialized at com.sun.msv.verifier.Verifier.onError(Verifier.java:367) at com.sun.msv.verifier.Verifier.onError(Verifier.java:363) at com.sun.msv.verifier.Verifier.startElement(Verifier.java:232) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825) at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224) at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637) at org.iso_relax.verifier.impl.VerifierImpl.verify(VerifierImpl.java:121) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:217) ... 16 more


Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec ghidra.app.plugin.processors.sleigh.SleighException: Invalid processor specification file: D:\Program Files\ghidra_10.3.2_PUBLIC\Ghidra\Processors\M32R\data\languages\m32r.pspec at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:222) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validatePspecFile(SleighLanguageValidator.java:191) at ghidra.app.plugin.processors.sleigh.SleighLanguage.initialize(SleighLanguage.java:139) at ghidra.app.plugin.processors.sleigh.SleighLanguage.(SleighLanguage.java:116) at ghidra.app.plugin.processors.sleigh.SleighLanguageProvider.getLanguage(SleighLanguageProvider.java:132) at ghidra.program.util.DefaultLanguageService$LanguageInfo.getLanguage(DefaultLanguageService.java:341) at ghidra.program.util.DefaultLanguageService.getLanguage(DefaultLanguageService.java:64) at ghidra.app.util.opinion.BinaryLoader.loadProgram(BinaryLoader.java:277) at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:131) 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) Caused by: com.sun.msv.verifier.ValidityViolation; lineNumber: 1779; columnNumber: 82; at least one of the following attributes is required for element "memory_block": bit_mapped_address,byte_mapped_address,initialized at com.sun.msv.verifier.Verifier.onError(Verifier.java:367) at com.sun.msv.verifier.Verifier.onError(Verifier.java:363) at com.sun.msv.verifier.Verifier.startElement(Verifier.java:232) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889) at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825) at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224) at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637) at org.iso_relax.verifier.impl.VerifierImpl.verify(VerifierImpl.java:121) at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:217) ... 16 more


PLEASE HELP

RyanHope commented 8 months ago

I also get this

ripnet commented 8 months ago

@RyanHope Which version of Ghidra are you running? I suspect there are differences in the version. I'll check.

RyanHope commented 8 months ago

Here is the fix

diff --git a/data/languages/m32r.pspec b/data/languages/m32r.pspec
index e577ffc..b801b83 100644
--- a/data/languages/m32r.pspec
+++ b/data/languages/m32r.pspec
@@ -1776,12 +1776,12 @@
                <symbol name="DEC4CT" address="0x80204E"/>
        </default_symbols>
        <default_memory_blocks>
-               <memory_block name="CS0" start_address="0x100000" length="0x100000" mode="rw"/>
-               <memory_block name="CS1" start_address="0x200000" length="0x200000" mode="rw"/>
-               <memory_block name="CS2" start_address="0x400000" length="0x200000" mode="rw"/>
-               <memory_block name="CS3" start_address="0x600000" length="0x200000" mode="rw"/>
-               <memory_block name="SFR" start_address="0x800000" length="0x4000" mode="rw"/>
-               <memory_block name="RAM" start_address="0x804000" length="0x1C000" mode="rw"/>
+               <memory_block name="CS0" start_address="0x100000" length="0x100000" initialized="false" mode="rw"/>
+               <memory_block name="CS1" start_address="0x200000" length="0x200000" initialized="false" mode="rw"/>
+               <memory_block name="CS2" start_address="0x400000" length="0x200000" initialized="false" mode="rw"/>
+               <memory_block name="CS3" start_address="0x600000" length="0x200000" initialized="false" mode="rw"/>
+               <memory_block name="SFR" start_address="0x800000" length="0x4000" initialized="false" mode="rw"/>
+               <memory_block name="RAM" start_address="0x804000" length="0x1C000" initialized="false" mode="rw"/>
        </default_memory_blocks>

 </processor_spec>
\ No newline at end of file
ripnet commented 8 months ago

I apparently have this completed, just forgot to commit and push to github.

I sent you an email, Ryan.

nickdaria commented 1 week ago

I had this issue followed by an access denied exception. I had to run Ghidra as an administrator.