Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2617 corrected decompiler function actions broken by GP-2520

ghidra1da94a0340e7e
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/AbstractDecompilerAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/AbstractDecompilerAction.java
index 970047aa8b..f20ecf60c2 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/AbstractDecompilerAction.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/AbstractDecompilerAction.java
@@ -236,20 +236,19 @@ public abstract class AbstractDecompilerAction extends DockingAction {
* @return the function associated with the current context token or null if none identified.
*/
protected Function getFunction(DecompilerActionContext context) {
-
ClangToken token = context.getTokenAtCursor();
- if (!(token instanceof ClangFuncNameToken)) {
- return null;
- }
- Program program = context.getProgram();
- Function f = DecompilerUtils.getFunction(program, (ClangFuncNameToken) token);
- if (f == null) {
- return null;
+ Function f = null;
+ if (token instanceof ClangFuncNameToken) {
+ f = DecompilerUtils.getFunction(context.getProgram(), (ClangFuncNameToken) token);
}
-
- // Ignore default thunks
- while (f.isThunk() && f.getSymbol().getSource() == SourceType.DEFAULT) {
+ else {
+ HighSymbol highSymbol = findHighSymbolFromToken(token, context.getHighFunction());
+ if (highSymbol instanceof HighFunctionShellSymbol) {
+ f = (Function) highSymbol.getSymbol().getObject();
+ }
+ }
+ while (f != null && f.isThunk() && f.getSymbol().getSource() == SourceType.DEFAULT) {
f = f.getThunkedFunction(false);
}
return f;