fix: Update XrefsEndpoints to use Ghidra API correctly
- Replace getDefinedAddresses with proper Listing methods - Use getInstructions and getDefinedData instead - Check both instructions and data for a valid starting address - Improve fallback strategy for current address retrieval
This commit is contained in:
parent
0eaa19a6e8
commit
9443101298
@ -328,11 +328,18 @@ public class XrefsEndpoints extends AbstractEndpoint {
|
|||||||
if (program.equals(programManager.getCurrentProgram())) {
|
if (program.equals(programManager.getCurrentProgram())) {
|
||||||
ghidra.program.model.listing.Listing listing = program.getListing();
|
ghidra.program.model.listing.Listing listing = program.getListing();
|
||||||
if (listing != null) {
|
if (listing != null) {
|
||||||
// Return the first defined address we can find
|
// Return the first instruction or defined data we can find
|
||||||
ghidra.program.model.address.AddressIterator definedAddresses =
|
ghidra.program.model.listing.InstructionIterator instructions =
|
||||||
listing.getDefinedAddresses();
|
listing.getInstructions(true);
|
||||||
if (definedAddresses.hasNext()) {
|
if (instructions.hasNext()) {
|
||||||
return definedAddresses.next();
|
return instructions.next().getAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or try defined data
|
||||||
|
ghidra.program.model.listing.DataIterator data =
|
||||||
|
listing.getDefinedData(true);
|
||||||
|
if (data.hasNext()) {
|
||||||
|
return data.next().getAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user