sualk / ghidra-blackfin

Blackfin CPU support for ghidra
22 stars 2 forks source link

<pentry> tags within a group must be distinguished by size or type #1

Closed xyphro closed 2 years ago

xyphro commented 2 years ago

When compiling this plugin with Ghidra Version "10.1-BETA Build PUBLIC 2021-Nov-16 1948 Est", I am getting the below error once trying to import any binary or .elf file:

This somehow does related to the CSPEC file, but looking at other cspec files for other processors, I cannot spot really an issue.

Can you maybe let me know with which Ghidra version you developed/tested this plugin, such that I can downgrade?

Exception reading blackfin:LE:32:default/default(blackfin.cspec): tags within a group must be distinguished by size or type ghidra.program.model.lang.CompilerSpecNotFoundException: Exception reading blackfin:LE:32:default/default(blackfin.cspec): tags within a group must be distinguished by size or type at ghidra.program.model.lang.BasicCompilerSpec.(BasicCompilerSpec.java:157) at ghidra.app.plugin.processors.sleigh.SleighLanguage.getCompilerSpecByID(SleighLanguage.java:1143) at ghidra.app.util.opinion.BinaryLoader.loadProgram(BinaryLoader.java:278) at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:112) at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:404) at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:350) at ghidra.util.task.TaskBuilder$TaskBuilderTask.run(TaskBuilder.java:306) at ghidra.util.task.Task.monitoredRun(Task.java:126) at ghidra.util.task.TaskRunner.lambda$startTaskThread$0(TaskRunner.java:106) 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) Caused by: ghidra.xml.XmlParseException: tags within a group must be distinguished by size or type at ghidra.program.model.lang.ParamEntry.orderWithinGroup(ParamEntry.java:617) at ghidra.program.model.lang.ParamListStandardOut.restoreXml(ParamListStandardOut.java:82) at ghidra.program.model.lang.PrototypeModel.restoreXml(PrototypeModel.java:559) at ghidra.program.model.lang.BasicCompilerSpec.addPrototypeModel(BasicCompilerSpec.java:1030) at ghidra.program.model.lang.BasicCompilerSpec.restoreXml(BasicCompilerSpec.java:636) at ghidra.program.model.lang.BasicCompilerSpec.initialize(BasicCompilerSpec.java:249) at ghidra.program.model.lang.BasicCompilerSpec.(BasicCompilerSpec.java:135) ... 11 more

sualk commented 2 years ago

Development was done with 9.2. Just tested it successfully with 10.0.4.

Seems to be a problem only with the latest 10.1-Beta

xyphro commented 2 years ago

Thanks a lot. It is indeed the fault of this 10.1 Beta version. Could get it work with 10.0.4

sualk commented 2 years ago

This is still a bug in this extension, but only affects the ghidra 10.1-beta release.

hughsie commented 2 years ago

I also see this on ghidra 10.1.1 too :(

bveina commented 2 years ago

just tried on 10.1.1 and got the same error, there are other projects that are encountering similar errors.

this method appears to be the one throwing the error: paramEntry

based on some googling, I could stop the error by commenting out the R1 output entry in the blackfin.cspec and leaving the join.

<output>
    <pentry minsize="1" maxsize="4">
        <register name="R0"/>
    </pentry>
    <!--
    <pentry minsize="1" maxsize="4" >
        <register name="R1"/>
    </pentry>
    -->
    <pentry minsize="5" maxsize="8">
        <addr space="join" piece1="R0" piece2="R1"/>
    </pentry> 

</output>

not going to submit a pull request because im not sure that the change actually results in good disassembly yet. but other, smarter, folks can try this out