leveldown-security / SVD-Loader-Ghidra

GNU General Public License v3.0
480 stars 98 forks source link

GD32: xml.etree.ElementTree.ParseError: The processing instruction target matching "[xX][mM][lL]" is not allowed. #16

Open xobs opened 1 year ago

xobs commented 1 year ago

The attached SVD file fails to load:

Traceback (most recent call last):
  File "C:\Users\smcro\Software\SVD-Loader-Ghidra\SVD-Loader.py", line 62, in <module>
    parser = SVDParser.for_xml_file(str(svd_file))
  File "C:\Users\smcro\Software\SVD-Loader-Ghidra\cmsis_svd\parser.py", line 72, in for_xml_file
    return cls(ET.parse(path), remove_reserved)
  File "C:\Users\smcro\Software\ghidra_10.2.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.3\Lib\xml\etree\ElementTree.py", line 1184, in parse
    tree.parse(source, parser)
  File "C:\Users\smcro\Software\ghidra_10.2.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.3\Lib\xml\etree\ElementTree.py", line 657, in parse
    self._root = parser.close()
  File "C:\Users\smcro\Software\ghidra_10.2.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.3\Lib\xml\etree\ElementTree.py", line 1667, in close
    self._raiseerror(v)
  File "C:\Users\smcro\Software\ghidra_10.2.2_PUBLIC\Ghidra\Features\Python\data\jython-2.7.3\Lib\xml\etree\ElementTree.py", line 1519, in _raiseerror
    raise err
  File "<string>", line None
xml.etree.ElementTree.ParseError: The processing instruction target matching "[xX][mM][lL]" is not allowed.
SVD-Loader.py> Finished!

GD32F4xx.zip

xobs commented 1 year ago

Note: This is fixed if I modify the .svd file and remove two spaces that appeared at the top.

This file is straight from the vendor, so this script probably ought to be able to eat this kind of file.