Test debug

This commit is contained in:
dragonmacher 2024-07-30 14:33:13 -04:00
parent ca6bed02ee
commit 1a097da011
2 changed files with 16 additions and 0 deletions

View file

@ -27,6 +27,7 @@ import ghidra.framework.options.*;
import ghidra.program.model.listing.Data; import ghidra.program.model.listing.Data;
import ghidra.program.model.listing.Function; import ghidra.program.model.listing.Function;
import ghidra.program.util.*; import ghidra.program.util.*;
import ghidra.util.Msg;
import ghidra.util.classfinder.ClassSearcher; import ghidra.util.classfinder.ClassSearcher;
public class AddressCorrelatorManager { public class AddressCorrelatorManager {
@ -82,6 +83,16 @@ public class AddressCorrelatorManager {
correlatorList.addAll(initializeAddressCorrelators()); correlatorList.addAll(initializeAddressCorrelators());
correlatorList.sort(CORRELATOR_COMPARATOR); correlatorList.sort(CORRELATOR_COMPARATOR);
StringBuilder buffy = new StringBuilder();
for (AddressCorrelator ac : correlatorList) {
buffy.append(ac.getClass().getSimpleName())
.append("; priority: ")
.append(ac.getPriority())
.append('\n');
}
Msg.trace(this, "Finished assembling correlators. Sorted list:\n" + buffy);
} }
private List<AddressCorrelator> initializeAddressCorrelators() { private List<AddressCorrelator> initializeAddressCorrelators() {
@ -101,9 +112,13 @@ public class AddressCorrelatorManager {
private AddressCorrelation getFunctionCorrelator(Function source, Function destination) { private AddressCorrelation getFunctionCorrelator(Function source, Function destination) {
Msg.trace(this, "Source / Destination functions: " + source + "; " + destination);
for (AddressCorrelator correlator : correlatorList) { for (AddressCorrelator correlator : correlatorList) {
Msg.trace(this, "\tchecking correlator: " + correlator.getClass().getSimpleName());
AddressCorrelation correlation = correlator.correlate(source, destination); AddressCorrelation correlation = correlator.correlate(source, destination);
if (correlation != null) { if (correlation != null) {
Msg.trace(this, "\t\tusing correlator: " + correlator);
return correlation; return correlation;
} }
} }

View file

@ -375,6 +375,7 @@ public class AddressCorrelationTest extends AbstractGhidraHeadedIntegrationTest
boolean canBeNoAddress) { boolean canBeNoAddress) {
Collection<VTMarkupItem> appliableMarkupItems = Collection<VTMarkupItem> appliableMarkupItems =
controller.getMatchInfo(testMatch).getAppliableMarkupItems(TaskMonitor.DUMMY); // Initialize the cache. controller.getMatchInfo(testMatch).getAppliableMarkupItems(TaskMonitor.DUMMY); // Initialize the cache.
for (VTMarkupItem vtMarkupItem : appliableMarkupItems) { for (VTMarkupItem vtMarkupItem : appliableMarkupItems) {
Address markupDestAddress = vtMarkupItem.getDestinationAddress(); Address markupDestAddress = vtMarkupItem.getDestinationAddress();
boolean isNoAddress = boolean isNoAddress =