Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1071 - Fixed decompiler hover to prevent the Data Type hover from appearing when over a scalar

dragonmacher55ebf73af2b3
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/DataTypeDecompilerHover.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/DataTypeDecompilerHover.java
index 4dd0896557..cebf1d005e 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/DataTypeDecompilerHover.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/DataTypeDecompilerHover.java
@@ -37,6 +37,8 @@ public class DataTypeDecompilerHover extends AbstractConfigurableHover
private static final String NAME = "Data Type Display";
private static final String DESCRIPTION =
"Show data type contents when hovering over a type name.";
+
+ // note: this is relative to other DecompilerHovers; a higher priority gets called first
private static final int PRIORITY = 20;
protected DataTypeDecompilerHover(PluginTool tool) {
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/FunctionSignatureDecompilerHover.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/FunctionSignatureDecompilerHover.java
index 84d94e3d13..eae5792b4e 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/FunctionSignatureDecompilerHover.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/FunctionSignatureDecompilerHover.java
@@ -47,6 +47,8 @@ public class FunctionSignatureDecompilerHover extends AbstractConfigurableHover
private static final String NAME = "Function Signature Display";
private static final String DESCRIPTION =
"Show function signatures when hovering over a function name.";
+
+ // note: this is relative to other DecompilerHovers; a higher priority gets called first
private static final int PRIORITY = 20;
protected FunctionSignatureDecompilerHover(PluginTool tool) {
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ReferenceDecompilerHover.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ReferenceDecompilerHover.java
index 830be23ddf..692af1d4aa 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ReferenceDecompilerHover.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ReferenceDecompilerHover.java
@@ -34,7 +34,11 @@ public class ReferenceDecompilerHover extends AbstractReferenceHover
private static final String DESCRIPTION =
"Shows \"referred to\" code and data from the decompiler.";
- private static final int PRIORITY = 25;
+ // note: this is relative to other DecompilerHovers; a higher priority gets called first
+ // Use high value so this hover gets called first. The method for determining what the user
+ // is hovering in the Decompiler is less then perfect. We choose to allow the more precise
+ // hovers get a chance to process the request first.
+ private static final int PRIORITY = 50;
public ReferenceDecompilerHover(PluginTool tool) {
super(tool, PRIORITY);
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ScalarValueDecompilerHover.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ScalarValueDecompilerHover.java
index e36a659af8..faeac467bd 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ScalarValueDecompilerHover.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/hover/ScalarValueDecompilerHover.java
@@ -36,7 +36,14 @@ import ghidra.program.util.ProgramLocation;
public class ScalarValueDecompilerHover extends AbstractScalarOperandHover
implements DecompilerHoverService {
- private static final int PRIORITY = 20;
+ // note: this is relative to other DecompilerHovers; a higher priority gets called first
+ // Use high value so this hover gets called first. The method for determining what the user
+ // is hovering in the Decompiler is less then perfect. We choose to allow the more precise
+ // hovers to get a chance to process the request first.
+ // We want this hover to go before the data type hovers, due to how that hover decides when it
+ // can show a popup, it decides to work when over a scalar. Having this hover get called
+ // first prevents that.
+ private static final int PRIORITY = 30;
private static final String NAME = "Scalar Operand Display";
private static final String DESCRIPTION =