mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
Version Tracking test fixes
This commit is contained in:
parent
f854828f73
commit
67c0ff8c27
@ -57,6 +57,9 @@ public class StraightLineCorrelation implements AddressCorrelation {
|
||||
TaskMonitor monitor) throws CancelledException {
|
||||
initialize(monitor);
|
||||
AddressRange range = cachedForwardAddressMap.get(sourceAddress);
|
||||
if (range == null) {
|
||||
return null;
|
||||
}
|
||||
return new AddressCorrelationRange(range, getName());
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,7 @@ import org.jdom.Element;
|
||||
|
||||
import generic.cache.FixedSizeMRUCachingFactory;
|
||||
import generic.stl.Pair;
|
||||
import ghidra.feature.vt.api.correlator.address.ExactMatchAddressCorrelator;
|
||||
import ghidra.feature.vt.api.correlator.address.VTHashedFunctionAddressCorrelator;
|
||||
import ghidra.feature.vt.api.correlator.address.*;
|
||||
import ghidra.features.codecompare.correlator.CodeCompareAddressCorrelator;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.program.model.listing.Data;
|
||||
@ -74,10 +73,11 @@ public class AddressCorrelatorManager {
|
||||
correlatorList.add(new CodeCompareAddressCorrelator());
|
||||
|
||||
// Note: at the time of writing this comment, the linear address correlator will not be
|
||||
// executed. The VTHashedFunctionAddressCorrelator handles correlation between programs
|
||||
// with the same architecture and the CodeCompareAddressCorrelator handles correlation
|
||||
// between programs with different architectures.
|
||||
// correlatorList.add(new LinearAddressCorrelator());
|
||||
// executed for functions. The VTHashedFunctionAddressCorrelator handles function
|
||||
// correlation between programs with the same architecture and the
|
||||
// CodeCompareAddressCorrelator handles function correlation between programs with different
|
||||
// architectures. This will still get called for data correlation.
|
||||
correlatorList.add(new LinearAddressCorrelator());
|
||||
|
||||
correlatorList.addAll(initializeAddressCorrelators());
|
||||
|
||||
|
@ -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.
|
||||
@ -32,7 +32,7 @@ public abstract class VtTask extends Task {
|
||||
private boolean success = false;
|
||||
private boolean cancelled = false;
|
||||
|
||||
private List<String> errors = new ArrayList<>();
|
||||
private List<Throwable> errors = new ArrayList<>();
|
||||
|
||||
protected VtTask(String title, VTSession session) {
|
||||
super(title, true, true, true, true);
|
||||
@ -124,31 +124,21 @@ public abstract class VtTask extends Task {
|
||||
if (errors.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String title = getErrorDialogTitle();
|
||||
String message = getErrorDetails();
|
||||
Msg.showError(this, null, title, message);
|
||||
if (errors.size() == 1) {
|
||||
Msg.showError(this, null, title, message, errors.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
Msg.showError(this, null, title, message);
|
||||
}
|
||||
|
||||
protected String getErrorHeader() {
|
||||
return "Errors encountered for task \"" + getTaskTitle() + "\":";
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes any error messages from the task to the log.
|
||||
*/
|
||||
public void logErrors() {
|
||||
if (errors.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
StringBuilder buf = new StringBuilder(getErrorHeader());
|
||||
buf.append("\n");
|
||||
for (String error : errors) {
|
||||
buf.append("\t").append(error).append("\n");
|
||||
}
|
||||
Msg.error(this, buf.toString());
|
||||
}
|
||||
|
||||
private String getErrorDialogTitle() {
|
||||
if (success) {
|
||||
return "Task \"" + getTaskTitle() + "\" Partially Completed";
|
||||
@ -164,8 +154,14 @@ public abstract class VtTask extends Task {
|
||||
StringBuilder buf = new StringBuilder("<html>" + getErrorHeader());
|
||||
int errorCount = 0;
|
||||
buf.append("<blockquote><br>");
|
||||
for (String error : errors) {
|
||||
buf.append(error).append("<br>");
|
||||
for (Throwable t : errors) {
|
||||
|
||||
String message = t.getMessage();
|
||||
if (message == null) {
|
||||
message = "Unexpected Exception: " + t.toString();
|
||||
}
|
||||
|
||||
buf.append(message).append("<br>");
|
||||
if (++errorCount > MAX_ERRORS) {
|
||||
buf.append("...and " + (errors.size() - errorCount) + " more!");
|
||||
break;
|
||||
@ -180,15 +176,7 @@ public abstract class VtTask extends Task {
|
||||
if (cause != null) {
|
||||
t = cause;
|
||||
}
|
||||
String message = t.getMessage();
|
||||
if (message == null) {
|
||||
message = "Unexpected Exception: " + e.toString();
|
||||
}
|
||||
errors.add(message);
|
||||
}
|
||||
|
||||
protected void reportError(String message) {
|
||||
errors.add(message);
|
||||
errors.add(t);
|
||||
}
|
||||
|
||||
protected void addErrors(VtTask task) {
|
||||
|
@ -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.
|
||||
@ -73,8 +73,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
super();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcludeCallingConvention() throws Exception {
|
||||
@Test
|
||||
public void testExcludeCallingConvention() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setCallingConvention(sourceFunction, "__cdecl"); // unknown, default, __stdcall, __cdecl, __fastcall, __thiscall
|
||||
@ -118,8 +118,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatchReplaceCallingConventionBothSpecified() throws Exception {
|
||||
@Test
|
||||
public void testNameMatchReplaceCallingConventionBothSpecified() throws Exception {
|
||||
setLanguage(destinationProgram, "Toy:LE:32:default", "default");
|
||||
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
@ -165,8 +165,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameMatchNotFoundCallingConventionBothSpecified() throws Exception {
|
||||
@Test
|
||||
public void testNameMatchNotFoundCallingConventionBothSpecified() throws Exception {
|
||||
setLanguage(destinationProgram, "Toy:LE:32:default", "default");
|
||||
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
@ -212,8 +212,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceSrcCallFixupNoDestCallFixup() {
|
||||
@Test
|
||||
public void testReplaceSrcCallFixupNoDestCallFixup() {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setCallFixup(sourceFunction, "SEH_prolog4");
|
||||
@ -256,8 +256,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceNoSrcCallFixupDestCallFixup() {
|
||||
@Test
|
||||
public void testReplaceNoSrcCallFixupDestCallFixup() {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setCallFixup(destinationFunction, "SEH_prolog4");
|
||||
@ -300,8 +300,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceSrcCallFixupSameDestCallFixup() {
|
||||
@Test
|
||||
public void testReplaceSrcCallFixupSameDestCallFixup() {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setCallFixup(sourceFunction, "SEH_prolog4");
|
||||
@ -345,8 +345,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceSrcCallFixupDifferentDestCallFixup() {
|
||||
@Test
|
||||
public void testReplaceSrcCallFixupDifferentDestCallFixup() {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setCallFixup(sourceFunction, "SEH_prolog4");
|
||||
@ -390,8 +390,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcludeSrcCallFixupDifferentDestCallFixup() {
|
||||
@Test
|
||||
public void testExcludeSrcCallFixupDifferentDestCallFixup() {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setCallFixup(sourceFunction, "SEH_prolog4");
|
||||
@ -435,8 +435,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceNoSrcCallFixupNoDestCallFixup() {
|
||||
@Test
|
||||
public void testReplaceNoSrcCallFixupNoDestCallFixup() {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
checkSignatures("void addPerson(Person * * list, char * name)",
|
||||
@ -477,8 +477,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcludeReturnType() throws Exception {
|
||||
@Test
|
||||
public void testExcludeReturnType() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setReturnType(sourceFunction, new FloatDataType(), SourceType.USER_DEFINED);
|
||||
@ -518,8 +518,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceDefinedReturnTypeWithDefined() throws Exception {
|
||||
@Test
|
||||
public void testReplaceDefinedReturnTypeWithDefined() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setReturnType(sourceFunction, new FloatDataType(), SourceType.USER_DEFINED);
|
||||
@ -560,8 +560,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceUndefinedReturnTypeWithDefinedForReplace() throws Exception {
|
||||
@Test
|
||||
public void testReplaceUndefinedReturnTypeWithDefinedForReplace() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setReturnType(sourceFunction, new FloatDataType(), SourceType.USER_DEFINED);
|
||||
@ -601,8 +601,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDontReplaceDefinedReturnTypeWithDefinedForUndefinedOnly() throws Exception {
|
||||
@Test
|
||||
public void testDontReplaceDefinedReturnTypeWithDefinedForUndefinedOnly() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setReturnType(sourceFunction, new FloatDataType(), SourceType.USER_DEFINED);
|
||||
@ -644,8 +644,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceUndefinedReturnTypeWithDefinedForUndefinedOnly() throws Exception {
|
||||
@Test
|
||||
public void testReplaceUndefinedReturnTypeWithDefinedForUndefinedOnly() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setReturnType(sourceFunction, new FloatDataType(), SourceType.USER_DEFINED);
|
||||
@ -687,8 +687,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceDefaultReturnTypeWithUndefined() throws Exception {
|
||||
@Test
|
||||
public void testReplaceDefaultReturnTypeWithUndefined() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setReturnType(sourceFunction, new Undefined4DataType(), SourceType.USER_DEFINED);
|
||||
@ -728,8 +728,8 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDontReplaceDefinedReturnTypeWithUndefined() throws Exception {
|
||||
@Test
|
||||
public void testDontReplaceDefinedReturnTypeWithUndefined() throws Exception {
|
||||
useMatch("0x00411860", "0x00411830");
|
||||
|
||||
setReturnType(sourceFunction, new Undefined4DataType(), SourceType.USER_DEFINED);
|
||||
@ -770,15 +770,13 @@ public class FunctionSignatureMarkupOptionsTest extends AbstractFunctionSignatur
|
||||
checkMarkupStatus(functionSignatureMarkupItems, VTMarkupItemStatus.UNAPPLIED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO
|
||||
// TODO
|
||||
// TODO this address needs to be updated: I think it is 00411da0/00411d80
|
||||
// TODO
|
||||
// TODO
|
||||
|
||||
private void setLanguage(Program program, String languageID, String compilerSpecName)
|
||||
private void setLanguage(Program program, String languageID, String compilerSpecName)
|
||||
throws IllegalStateException, LockException, IncompatibleLanguageException,
|
||||
LanguageNotFoundException {
|
||||
int transaction = -1;
|
||||
|
@ -73,7 +73,8 @@
|
||||
<logger name="ghidra.app.util.opinion" level="DEBUG" />
|
||||
<logger name="ghidra.util.classfinder" level="DEBUG" />
|
||||
<logger name="ghidra.util.extensions" level="DEBUG" />
|
||||
<logger name="ghidra.util.task" level="DEBUG" />
|
||||
<logger name="ghidra.util.task" level="DEBUG" />
|
||||
<logger name="ghidra.sleigh.grammar" level="DEBUG" />
|
||||
<logger name="functioncalls" level="DEBUG" />
|
||||
<logger name="org.jungrapht.visualization" level="WARN" />
|
||||
<logger name="org.jungrapht.visualization.DefaultVisualizationServer" level="DEBUG" />
|
||||
|
@ -72,6 +72,7 @@
|
||||
<logger name="ghidra.util.classfinder" level="DEBUG" />
|
||||
<logger name="ghidra.util.extensions" />
|
||||
<logger name="ghidra.util.task" level="DEBUG" />
|
||||
<logger name="ghidra.sleigh.grammar" level="DEBUG" />
|
||||
<logger name="functioncalls" level="DEBUG" />
|
||||
<logger name="org.jungrapht.visualization" level="WARN" />
|
||||
<logger name="org.jungrapht.visualization.DefaultVisualizationServer" level="DEBUG" />
|
||||
|
Loading…
Reference in New Issue
Block a user