Merge remote-tracking branch 'origin/GT-3382_ghidorahrex_PR-745_mumbel_slgh'

This commit is contained in:
Ryan Kurtz 2019-12-10 15:22:17 -05:00
commit c75dcfd1f5
2 changed files with 12 additions and 6 deletions

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,6 +15,10 @@
*/ */
package ghidra.pcodeCPort.slghpatexpress; package ghidra.pcodeCPort.slghpatexpress;
import java.io.PrintStream;
import org.jdom.Element;
import generic.stl.VectorSTL; import generic.stl.VectorSTL;
import ghidra.pcodeCPort.context.*; import ghidra.pcodeCPort.context.*;
import ghidra.pcodeCPort.sleighbase.SleighBase; import ghidra.pcodeCPort.sleighbase.SleighBase;
@ -25,10 +28,6 @@ import ghidra.pcodeCPort.utils.MutableInt;
import ghidra.pcodeCPort.utils.XmlUtils; import ghidra.pcodeCPort.utils.XmlUtils;
import ghidra.sleigh.grammar.Location; import ghidra.sleigh.grammar.Location;
import java.io.PrintStream;
import org.jdom.Element;
public class OperandValue extends PatternValue { public class OperandValue extends PatternValue {
private int index; // This is the defining field of expression private int index; // This is the defining field of expression
@ -50,6 +49,9 @@ public class OperandValue extends PatternValue {
@Override @Override
public TokenPattern genMinPattern(VectorSTL<TokenPattern> ops) { public TokenPattern genMinPattern(VectorSTL<TokenPattern> ops) {
if (index >= ops.size()) {
return null;
}
return ops.get(index); return ops.get(index);
} }

View file

@ -571,7 +571,11 @@ public class Constructor {
} }
} }
else if (defexp != null) { else if (defexp != null) {
oppattern.push_back(defexp.genMinPattern(oppattern)); TokenPattern tmppat = defexp.genMinPattern(oppattern);
if (null == tmppat) {
throw new SleighError("operand " + sym.getName() + " has an issue", location);
}
oppattern.push_back(tmppat);
} }
else { else {
throw new SleighError("operand " + sym.getName() + " is undefined", location); throw new SleighError("operand " + sym.getName() + " is undefined", location);