GP-1793 - Updated the decompiler hover for structure fields to show the parent name and the offset in the parent

This commit is contained in:
dragonmacher 2022-03-08 17:22:19 -05:00
parent 385529aa08
commit c4054de5db
4 changed files with 207 additions and 150 deletions

View file

@ -25,7 +25,7 @@ import ghidra.program.model.listing.Function;
import ghidra.program.model.pcode.*;
/**
* A base class that represents a variable from the decompiler. This is either a variable
* A base class that represents a variable from the decompiler. This is either a variable
* type or a variable with an optional field access.
*/
public abstract class DecompilerVariable {
@ -51,7 +51,7 @@ public abstract class DecompilerVariable {
return ((ClangTypeToken) variable).getDataType();
}
// not sure if we need this; the type returned here is the structure and not the
// not sure if we need this; the type returned here is the structure and not the
// field's type
// if (variable instanceof ClangFieldToken) {
// return ((ClangFieldToken) variable).getDataType();
@ -79,8 +79,8 @@ public abstract class DecompilerVariable {
}
}
// Prefer the type of the first input varnode, unless that type is a 'void *'.
// Usually, in that special case, the output varnode has the correct type information.
// Prefer the type of the first input varnode, unless that type is a 'void *'.
// Usually, in that special case, the output varnode has the correct type information.
PcodeOp op = variable.getPcodeOp();
dataType = getInputDataType(op);
@ -193,7 +193,7 @@ public abstract class DecompilerVariable {
String castString = casts.isEmpty() ? "" : "\tcasts: " + casts + ",\n";
//@formatter:off
return "{\n" +
castString +
castString +
"\tvariable: " + variable + ",\n" +
"}";
//@formatter:on