@@ -576,19 +576,19 @@ private void serialize(DataType data_type) throws Exception {
576
576
serializePrototype ((FunctionSignature ) data_type );
577
577
578
578
} else if (data_type instanceof PartialUnion ) {
579
- name ("kind" ).value ("todo" ); // TODO(pag): Implement this
579
+ name ("kind" ).value ("todo:PartialUnion " ); // TODO(pag): Implement this
580
580
name ("size" ).value (data_type .getLength ());
581
581
582
582
} else if (data_type instanceof BitFieldDataType ) {
583
- name ("kind" ).value ("todo" ); // TODO(pag): Implement this
583
+ name ("kind" ).value ("todo:BitFieldDataType " ); // TODO(pag): Implement this
584
584
name ("size" ).value (data_type .getLength ());
585
585
586
586
} else if (data_type instanceof WideCharDataType ) {
587
- name ("kind" ).value ("todo " ); // TODO(pag): Implement this
587
+ name ("kind" ).value ("WideCharDataType " );
588
588
name ("size" ).value (data_type .getLength ());
589
589
590
590
} else if (data_type instanceof StringDataType ) {
591
- name ("kind" ).value ("todo" ); // TODO(pag): Implement this
591
+ name ("kind" ).value ("todo:StringDataType " ); // TODO(pag): Implement this
592
592
name ("size" ).value (data_type .getLength ());
593
593
594
594
} else {
@@ -877,13 +877,17 @@ private String findNullTerminatedString(Address address, Pointer pointer) throws
877
877
Address ram_address = convertAddressToRamSpace (address );
878
878
MemoryBufferImpl memoryBuffer = new MemoryBufferImpl (program .getMemory (), ram_address );
879
879
DataType char_type = pointer .getDataType ();
880
+ //println("Debug: char_type = " + char_type.getName() + ", size = " + char_type.getLength());
881
+ //println("Debug: char_type class = " + char_type.getClass().getName());
880
882
StringDataInstance string_data_instance = StringDataInstance .getStringDataInstance (char_type , memoryBuffer , char_type .getDefaultSettings (), -1 );
881
883
int detectedLength = string_data_instance .getStringLength ();
884
+ //println("Debug: detectedLength = " + detectedLength);
882
885
if (detectedLength == -1 ) {
883
886
return null ;
884
887
}
885
- string_data_instance = new StringDataInstance (char_type , char_type .getDefaultSettings (), memoryBuffer , detectedLength , true );
886
- return string_data_instance .getStringValue ();
888
+ String value = string_data_instance .getStringValue ();
889
+ //println("Debug: stringValue = " + value);
890
+ return value ;
887
891
}
888
892
889
893
private Data getDataReferencedAsConstant (Varnode node ) throws Exception {
@@ -893,7 +897,8 @@ private Data getDataReferencedAsConstant(Varnode node) throws Exception {
893
897
// Ghidra sometime fail to resolve references to Data and show it as const.
894
898
// Check if it is referencing Data as constant from `ram` addresspace.
895
899
Address ram_address = convertAddressToRamSpace (node .getAddress ());
896
- return getDataAt (ram_address );
900
+ Data data = getDataAt (ram_address );
901
+ return data ;
897
902
}
898
903
899
904
// Serialize an input or output varnode.
0 commit comments