Merge remote-tracking branch 'origin/GP-0_d-millar_fix_for_ISF_test_failures'

This commit is contained in:
ghidra1
2023-12-01 18:02:23 -05:00
3 changed files with 15 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ public abstract class AbstractIsfWriter implements Closeable {
protected JsonArray objects = new JsonArray();
public AbstractIsfWriter(Writer baseWriter) throws IOException {
if (writer != null) {
if (baseWriter != null) {
this.writer = new JsonWriter(baseWriter);
writer.setIndent(" ");
}

View File

@@ -84,7 +84,6 @@ public class IsfDataTypeWriter extends AbstractIsfWriter {
private List<Address> requestedAddresses = new ArrayList<>();
private List<String> requestedSymbols = new ArrayList<>();
// private List<String> requestedTypes = new ArrayList<>();
private List<DataType> requestedDataTypes = new ArrayList<>();
private boolean skipSymbols = false;
private boolean skipTypes = false;
@@ -99,6 +98,7 @@ public class IsfDataTypeWriter extends AbstractIsfWriter {
*/
public IsfDataTypeWriter(DataTypeManager dtm, List<DataType> target, Writer baseWriter) throws IOException {
super(baseWriter);
this.baseWriter = baseWriter;
this.dtm = dtm;
if (dtm != null) {
dataOrganization = dtm.getDataOrganization();
@@ -113,10 +113,15 @@ public class IsfDataTypeWriter extends AbstractIsfWriter {
enums = new JsonObject();
functions = new JsonObject();
symbols = new JsonObject();
requestedDataTypes = target;
requestedDataTypes = target == null ? new ArrayList<>() : target;
STRICT = true;
}
public JsonObject getRootObject(TaskMonitor monitor) throws CancelledException, IOException {
genRoot(monitor);
return data;
}
@Override
protected void genRoot(TaskMonitor monitor) throws CancelledException, IOException {
genMetadata();

View File

@@ -19,6 +19,8 @@ import java.io.IOException;
import java.io.Writer;
import java.util.List;
import com.google.gson.JsonObject;
import ghidra.program.model.data.Array;
import ghidra.program.model.data.BitFieldDataType;
import ghidra.program.model.data.BuiltInDataType;
@@ -50,6 +52,11 @@ public class ExtIsfDataTypeWriter extends IsfDataTypeWriter {
STRICT = false;
}
public JsonObject getRootObject(TaskMonitor monitor) throws CancelledException, IOException {
genRoot(monitor);
return root;
}
@Override
protected void genRoot(TaskMonitor monitor) throws CancelledException, IOException {
super.genRoot(monitor);