mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GP-0 Corrected loongarch ilp32f pentry sizing issue. Improved cspec
parse error reporting to include line number.
This commit is contained in:
parent
ece2739b29
commit
e65bede08b
4 changed files with 48 additions and 49 deletions
|
@ -139,11 +139,9 @@ public class SleighLanguageValidator {
|
|||
throw new SleighException(
|
||||
specFile + " is not properly case dependent: " + result.getMessage());
|
||||
}
|
||||
try {
|
||||
InputStream in = specFile.getInputStream();
|
||||
try (InputStream in = specFile.getInputStream()) {
|
||||
verifier.setErrorHandler(new VerifierErrorHandler(specFile));
|
||||
verifier.verify(new InputSource(in));
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new SleighException(
|
||||
|
@ -211,11 +209,9 @@ public class SleighLanguageValidator {
|
|||
catch (Exception e) {
|
||||
throw new SleighException("Error creating verifier", e);
|
||||
}
|
||||
try {
|
||||
InputStream in = fileToValidate.getInputStream();
|
||||
try (InputStream in = fileToValidate.getInputStream()) {
|
||||
verifier.setErrorHandler(new VerifierErrorHandler(fileToValidate));
|
||||
verifier.verify(new InputSource(in));
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new SleighException(
|
||||
|
|
|
@ -121,36 +121,41 @@ public class BasicCompilerSpec implements CompilerSpec {
|
|||
Exception parseException = null;
|
||||
|
||||
ErrorHandler errHandler = getErrorHandler(cspecFile.toString());
|
||||
InputStream stream;
|
||||
XmlPullParser parser = null;
|
||||
try {
|
||||
SleighLanguageValidator.validateCspecFile(cspecFile);
|
||||
|
||||
stream = cspecFile.getInputStream();
|
||||
XmlPullParser parser =
|
||||
XmlPullParserFactory.create(stream, cspecFile.getAbsolutePath(), errHandler, false);
|
||||
initialize(cspecFile.getAbsolutePath(), parser);
|
||||
stream.close();
|
||||
try (InputStream stream = cspecFile.getInputStream()) {
|
||||
parser = XmlPullParserFactory.create(stream, cspecFile.getAbsolutePath(),
|
||||
errHandler, false);
|
||||
initialize(cspecFile.getAbsolutePath(), parser);
|
||||
}
|
||||
|
||||
if (models == null || models.length == 0) {
|
||||
throw new SAXException("No prototype models defined");
|
||||
}
|
||||
}
|
||||
catch (SleighException e) {
|
||||
catch (Exception e) {
|
||||
parseException = e;
|
||||
Throwable cause = e.getCause(); // Recover the cause (from the validator exception)
|
||||
if (cause != null) {
|
||||
if (cause instanceof SAXException || cause instanceof IOException) {
|
||||
parseException = (Exception) cause;
|
||||
if (e instanceof SleighException) {
|
||||
Throwable cause = e.getCause(); // Recover the cause (from the validator exception)
|
||||
if (cause != null) {
|
||||
if (cause instanceof SAXException || cause instanceof IOException) {
|
||||
parseException = (Exception) cause;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException | SAXException | XmlParseException | DuplicateNameException e) {
|
||||
parseException = e;
|
||||
}
|
||||
|
||||
if (parseException != null) {
|
||||
String lineInfo = "";
|
||||
if (parser != null) {
|
||||
lineInfo = ":" + parser.getLineNumber();
|
||||
}
|
||||
throw new CompilerSpecNotFoundException(language.getLanguageID(),
|
||||
description.getCompilerSpecID(), cspecFile.getName(), parseException);
|
||||
description.getCompilerSpecID(), cspecFile.getName() + lineInfo, parseException);
|
||||
}
|
||||
finally {
|
||||
if (parser != null) {
|
||||
parser.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1084,8 +1089,7 @@ public class BasicCompilerSpec implements CompilerSpec {
|
|||
|
||||
@Override
|
||||
public PrototypeModel matchConvention(String conventionName) {
|
||||
if (conventionName == null ||
|
||||
CALLING_CONVENTION_unknown.equals(conventionName) ||
|
||||
if (conventionName == null || CALLING_CONVENTION_unknown.equals(conventionName) ||
|
||||
CALLING_CONVENTION_default.equals(conventionName)) {
|
||||
return defaultModel;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue