mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 12:00:04 +02:00
GP-493 fixed graph navigation to go to 'fake' functions if a vertex repersenting an external function is cliked
This commit is contained in:
parent
e32276b5bd
commit
97fc20a50e
1 changed files with 16 additions and 2 deletions
|
@ -20,6 +20,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import docking.widgets.EventTrigger;
|
import docking.widgets.EventTrigger;
|
||||||
import ghidra.app.events.*;
|
import ghidra.app.events.*;
|
||||||
|
import ghidra.app.nav.NavigationUtils;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.framework.plugintool.PluginEvent;
|
import ghidra.framework.plugintool.PluginEvent;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
|
@ -158,9 +159,22 @@ public abstract class AddressBasedGraphDisplayListener
|
||||||
if (symbols.isEmpty()) {
|
if (symbols.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// there should only be one external symbol with the same name, so just assume the first one is good
|
|
||||||
return symbols.get(0).getAddress();
|
|
||||||
|
|
||||||
|
// There should only be one external symbol with the same name.
|
||||||
|
// Since externals are not shown in the listing, we are going to do a hack and try
|
||||||
|
// and navigate to a "fake" function if one exists. A "fake" function in Ghidra is just
|
||||||
|
// an indirect pointer to the external function. If such a pointer exists, Ghidra marks
|
||||||
|
// up the location with the function signature.
|
||||||
|
Address symbolAddress = symbols.get(0).getAddress();
|
||||||
|
if (symbolAddress.isExternalAddress()) {
|
||||||
|
Address[] externalLinkageAddresses =
|
||||||
|
NavigationUtils.getExternalLinkageAddresses(program, symbolAddress);
|
||||||
|
// If this is a "fake" function situation, then there should only be one address
|
||||||
|
if (externalLinkageAddresses.length == 1) {
|
||||||
|
symbolAddress = externalLinkageAddresses[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return symbolAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Address getAddress(AttributedVertex vertex) {
|
protected Address getAddress(AttributedVertex vertex) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue