mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Merge remote-tracking branch
'origin/GP-5604_James_bsim_overview_listener--SQUASHED' (Closes #7903)
This commit is contained in:
commit
ce8835ef7d
4 changed files with 40 additions and 11 deletions
|
@ -98,7 +98,8 @@ public class BSimOverviewModel extends AddressBasedTableModel<BSimOverviewRowObj
|
|||
|
||||
for (SimilarityVectorResult result : response.result) {
|
||||
Address addr = BSimMatchResultsModel.recoverAddress(result.getBase(), program);
|
||||
BSimOverviewRowObject row = new BSimOverviewRowObject(result, addr, vectorFactory);
|
||||
BSimOverviewRowObject row =
|
||||
new BSimOverviewRowObject(result, addr, vectorFactory, program);
|
||||
addObject(row);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +114,8 @@ public class BSimOverviewModel extends AddressBasedTableModel<BSimOverviewRowObj
|
|||
results.clear();
|
||||
for (SimilarityVectorResult result : response.result) {
|
||||
Address addr = BSimMatchResultsModel.recoverAddress(result.getBase(), program);
|
||||
BSimOverviewRowObject row = new BSimOverviewRowObject(result, addr, vectorFactory);
|
||||
BSimOverviewRowObject row =
|
||||
new BSimOverviewRowObject(result, addr, vectorFactory, program);
|
||||
results.add(row);
|
||||
}
|
||||
super.reload();
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.features.bsim.gui.overview;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
@ -36,6 +39,7 @@ import ghidra.features.bsim.gui.search.dialog.BSimSearchSettings;
|
|||
import ghidra.features.bsim.gui.search.results.BSimSearchInfoDisplayDialog;
|
||||
import ghidra.features.bsim.query.BSimServerInfo;
|
||||
import ghidra.features.bsim.query.protocol.ResponseNearestVector;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
@ -62,6 +66,7 @@ public class BSimOverviewProvider extends ComponentProviderAdapter {
|
|||
private BSimServerInfo serverInfo;
|
||||
|
||||
private BSimSearchSettings settings;
|
||||
private DomainObjectListener listener;
|
||||
|
||||
public BSimOverviewProvider(BSimSearchPlugin plugin, BSimServerInfo serverInfo, Program program,
|
||||
LSHVectorFactory vFactory, BSimSearchSettings settings) {
|
||||
|
@ -87,6 +92,13 @@ public class BSimOverviewProvider extends ComponentProviderAdapter {
|
|||
|
||||
createActions();
|
||||
updateSubTitle();
|
||||
listener = ev -> {
|
||||
if (ev.contains(SYMBOL_RENAMED, RESTORED)) {
|
||||
overviewModel.fireTableDataChanged();
|
||||
}
|
||||
};
|
||||
program.addListener(listener);
|
||||
|
||||
}
|
||||
|
||||
public Program getProgram() {
|
||||
|
@ -217,6 +229,7 @@ public class BSimOverviewProvider extends ComponentProviderAdapter {
|
|||
public void componentHidden() {
|
||||
super.componentHidden();
|
||||
if (plugin != null) {
|
||||
program.removeListener(listener);
|
||||
plugin.providerClosed(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,21 +21,31 @@ import ghidra.features.bsim.query.description.FunctionDescription;
|
|||
import ghidra.features.bsim.query.description.SignatureRecord;
|
||||
import ghidra.features.bsim.query.protocol.SimilarityVectorResult;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
||||
/**
|
||||
* Table row object for BSim Overview results table
|
||||
*/
|
||||
public class BSimOverviewRowObject {
|
||||
private Address addr;
|
||||
private FunctionDescription func;
|
||||
private SimilarityVectorResult simvec;
|
||||
private double selfsignif; // Maximum significance score a query with this function could return
|
||||
private long vectorHash;
|
||||
private Function function;
|
||||
|
||||
public BSimOverviewRowObject(SimilarityVectorResult result,Address ad,LSHVectorFactory vectorFactory) {
|
||||
/**
|
||||
* Constructor.
|
||||
* @param result results for queried function
|
||||
* @param ad address of function
|
||||
* @param vectorFactory vectoryFactory
|
||||
* @param program program containing queried function
|
||||
*/
|
||||
public BSimOverviewRowObject(SimilarityVectorResult result, Address ad,
|
||||
LSHVectorFactory vectorFactory, Program program) {
|
||||
addr = ad;
|
||||
simvec = result;
|
||||
func = simvec.getBase();
|
||||
FunctionDescription func = simvec.getBase();
|
||||
selfsignif = 0.0;
|
||||
SignatureRecord sigrec = func.getSignatureRecord();
|
||||
if (sigrec != null) {
|
||||
|
@ -43,11 +53,14 @@ public class BSimOverviewRowObject {
|
|||
}
|
||||
LSHVector lshVector = func.getSignatureRecord().getLSHVector();
|
||||
vectorHash = lshVector.calcUniqueHash();
|
||||
|
||||
function = program.getFunctionManager().getFunctionAt(ad);
|
||||
}
|
||||
|
||||
public String getFunctionName() {
|
||||
return func.getFunctionName();
|
||||
if (function == null || function.isDeleted()) {
|
||||
return null;
|
||||
}
|
||||
return function.getName();
|
||||
}
|
||||
|
||||
public Address getFunctionEntryPoint() {
|
||||
|
|
|
@ -127,6 +127,7 @@ public class BSimSearchResultsProvider extends ComponentProviderAdapter {
|
|||
public void componentHidden() {
|
||||
super.componentHidden();
|
||||
if (plugin != null) {
|
||||
program.removeListener(listener);
|
||||
plugin.providerClosed(this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue