Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/GP-7092_dragonmache3r_PR-9387_brothersw_master' (Closes #9386, Closes #9387)

Ryan Kurtz9a151bd89d33
diff --cc Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/DeleteFunctionCmdTest.java
index 757444e533,f60e3f683e..94c60f804f
--- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/DeleteFunctionCmdTest.java
+++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/DeleteFunctionCmdTest.java
@@@ -39,8 -39,8 +39,7 @@@ public class DeleteFunctionCmdTest exte
private Program program;
/**
-- * Constructs this test class with the given test method name.
-- *
++ * Constructs this test class with the given test method name
*/
public DeleteFunctionCmdTest() {
super();
@@@ -56,7 -56,7 +55,7 @@@
}
/**
-- * Tests the deleting of functions via the {@link DeleteFunctionCmd}.
++ * Tests the deleting of functions via the {@link DeleteFunctionCmd}
*/
@Test
public void testDeleteFunction() {
@@@ -115,11 -115,40 +114,38 @@@
program.endTransaction(transactionID, false);
}
- /*
++ /**
+ * This is a regression test. Make sure function deletes work with multiple tags.
- * See github issue #9386.
+ */
+ @Test
+ public void testDeleteFunctionWithMultipleTags() {
+
+ Address address = addr(0x0);
+ String defaultName = SymbolUtilities.getDefaultFunctionName(address);
+
+ int transactionID = program.startTransaction("TEST");
+
+ Function function =
+ createFunction(defaultName, address, new AddressSet(address, address.add(200L)));
+ assertNotNull("The test function was not created as expected.", function);
+
+ function.addTag("tag1");
+ function.addTag("tag2");
+ function.addTag("tag3");
+
+ DeleteFunctionCmd deleteFunctionCmd = new DeleteFunctionCmd(address);
+ deleteFunctionCmd.applyTo(program);
+
+ function = program.getListing().getFunctionAt(address);
+ assertNull("The function was not deleted as expected.", function);
+
+ program.endTransaction(transactionID, false);
+ }
+
// looks through the given symbol array to see if any have the same name
// as the provided string
private boolean containsMatchingSymbolName(Symbol[] symbols, String name) {
for (Symbol symbol : symbols) {
-- System.err.println("checking: " + symbol + " against " + name);
if (symbol.getName().equals(name)) {
return true;
}