diff --git a/Ghidra/Features/Base/src/main/help/help/topics/FunctionComparison/FunctionComparison.htm b/Ghidra/Features/Base/src/main/help/help/topics/FunctionComparison/FunctionComparison.htm index b211f66635..420ff2d108 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/FunctionComparison/FunctionComparison.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/FunctionComparison/FunctionComparison.htm @@ -8,7 +8,8 @@
-+ +diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramLocationActionContext.java b/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramLocationActionContext.java index 0038465489..0f89d4738d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramLocationActionContext.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/context/ProgramLocationActionContext.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -125,10 +125,14 @@ public class ProgramLocationActionContext extends ProgramActionContext } private Function getFunctionForLocation() { - if (!(location instanceof FunctionLocation functionLocation)) { - return null; + if (location instanceof FunctionLocation functionLocation) { + Address functionAddress = functionLocation.getFunctionAddress(); + return program.getFunctionManager().getFunctionAt(functionAddress); } - Address functionAddress = functionLocation.getFunctionAddress(); - return program.getFunctionManager().getFunctionAt(functionAddress); + Address address = getAddress(); + if (address != null) { + return program.getFunctionManager().getFunctionContaining(address); + } + return null; } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/model/DefaultFunctionComparisonModel.java b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/model/AnyToAnyFunctionComparisonModel.java similarity index 93% rename from Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/model/DefaultFunctionComparisonModel.java rename to Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/model/AnyToAnyFunctionComparisonModel.java index 30c84a9d44..f5d06f36f1 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/model/DefaultFunctionComparisonModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/features/base/codecompare/model/AnyToAnyFunctionComparisonModel.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,10 +28,10 @@ import ghidra.util.datastruct.Duo.Side; /** * Basic FunctionComparisonModel where a set of functions can be compared with each other */ -public class DefaultFunctionComparisonModel extends AbstractFunctionComparisonModel { +public class AnyToAnyFunctionComparisonModel extends AbstractFunctionComparisonModel { private SetTo Compare Functions, select one or more functions from the Listing, Decompiler or the + Functions Table, then + right-click and select the Compare Functions(s) action (In the Listing, it is + Function Compare Function(s)). -
To begin, select a function (or multiple functions) from the listing or - the function table. - Then right-click and select the Compare Selected Functions option.
+ +If an existing function comparison window is + already showing, the Compare Function(s) action will add the selected functions to + the existing comparison. To get a new Function Comparison window, use the + Compare in New Window action instead.
-A new function comparison window will appear (subsequent - invocations of this option will create a new tab in the existing window).
- -- -Additional functions can be added to the - last comparison window using the Add To Last Comparison popup action that will - appear on components that can supply one or more functions. (Currently supported in the Listing - and the Functions Window.) -