Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/GP-1495_ghidra007_Add_check_for_error_decompiling_functions--SQUASHED' into Ghidra_10.1

ghidra1331357f2036f
diff --cc Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassUtils.java
index 711bae1f52,aa62742119..175292e794
--- a/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassUtils.java
+++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassUtils.java
@@@ -3313,6 -3313,24 +3313,23 @@@ public class RecoveredClassUtils
// listing has void too, otherwise, leave it as is, probably a void
String returnType = getReturnTypeFromDecompiler(constructorFunction);
+ // Set error bookmark, add error message, and get the listing return type if the
+ // decompiler return type is null
+ if (returnType == null) {
+
- String error = "Decompiler Error: The decompiler failed to decompile function at " +
- constructorFunction.getEntryPoint().toString() +
- " possibly due to the addition of " + className + " class structure.";
++ String msg1 = "Decompiler Error: Failed to decompile function";
++ String msg2 = ", possibly due to the addition of class structure.";
+
- Msg.debug(this, error);
++ Msg.debug(this, msg1 + " at " + constructorFunction.getEntryPoint() + msg2);
+
+ program.getBookmarkManager().setBookmark(constructorFunction.getEntryPoint(),
- BookmarkType.ERROR, "Decompiler Error", error);
++ BookmarkType.ERROR, "Decompiler Error", msg1 + msg2);
+
+ // get the return type from the listing and in some cases it will
+ // indicate the correct type to help determine the below type to add
+ returnType = constructorFunction.getReturnType().getDisplayName();
+ }
+
if (returnType.equals("void")) {
DataType voidDataType = new VoidDataType();
constructorFunction.setReturnType(voidDataType, SourceType.ANALYSIS);