diff --git a/Ghidra/Debug/Debugger/ghidra_scripts/PopulateDemoTrace.java b/Ghidra/Debug/Debugger/ghidra_scripts/PopulateDemoTrace.java index 97f410f72c..c050947e5e 100644 --- a/Ghidra/Debug/Debugger/ghidra_scripts/PopulateDemoTrace.java +++ b/Ghidra/Debug/Debugger/ghidra_scripts/PopulateDemoTrace.java @@ -26,7 +26,7 @@ import ghidra.app.services.DebuggerTraceManagerService; import ghidra.program.model.address.*; import ghidra.program.model.data.PointerDataType; import ghidra.program.model.lang.*; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Instruction; import ghidra.program.model.symbol.SourceType; import ghidra.program.model.util.CodeUnitInsertionException; @@ -409,8 +409,7 @@ public class PopulateDemoTrace extends GhidraScript { trace.getCodeManager() .codeUnits() .getAt(0, cloneLabel.getAddress()) - .setComment( - CodeUnit.EOL_COMMENT, "Pretend this is a syscall"); + .setComment(CommentType.EOL, "Pretend this is a syscall"); /** * Stub out "exit" @@ -419,8 +418,7 @@ public class PopulateDemoTrace extends GhidraScript { trace.getCodeManager() .codeUnits() .getAt(0, exitLabel.getAddress()) - .setComment( - CodeUnit.EOL_COMMENT, "Pretend this is a syscall"); + .setComment(CommentType.EOL, "Pretend this is a syscall"); /** * "Launch" the program by initializing RIP and RSP of the main thread diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/AnalysisUnwoundFrame.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/AnalysisUnwoundFrame.java index 8e931d3ea3..ac867c5ff6 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/AnalysisUnwoundFrame.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/AnalysisUnwoundFrame.java @@ -353,7 +353,7 @@ public class AnalysisUnwoundFrame extends AbstractUnwoundFrame { TraceData frame = trace.getCodeManager() .definedData() .create(span, spPlusParams, platform, structure); - frame.setComment(CodeUnit.PRE_COMMENT, getDescription()); + frame.setComment(CommentType.PRE, getDescription()); TraceReferenceManager refs = trace.getReferenceManager(); refs.clearReferencesFrom(span, frame.getRange()); refs.clearReferencesTo(span, frame.getRange()); diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java index 101262ed97..d820e3f8ad 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/ListingUnwoundFrame.java @@ -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. @@ -95,7 +95,7 @@ public class ListingUnwoundFrame extends AbstractUnwoundFrame { */ private static Integer getLevel(TraceData data) { // TODO: Should this go into a property instead? - String comment = data.getComment(CodeUnit.PRE_COMMENT); + String comment = data.getComment(CommentType.PRE); if (comment == null) { return null; } @@ -213,7 +213,7 @@ public class ListingUnwoundFrame extends AbstractUnwoundFrame { @Override public String getDescription() { - return frame.getComment(CodeUnit.PRE_COMMENT); + return frame.getComment(CommentType.PRE); } @Override diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyPlanTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyPlanTest.java index 0154a76193..985b9ab0dd 100644 --- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyPlanTest.java +++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyPlanTest.java @@ -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. @@ -714,8 +714,8 @@ public class DebuggerCopyPlanTest extends AbstractGhidraHeadedDebuggerTest { TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); Listing listing = view.getListing(); - listing.setComment(tb.addr(0x55550123), CodeUnit.EOL_COMMENT, "Test EOL Comment"); - listing.setComment(tb.addr(0x55550321), CodeUnit.PLATE_COMMENT, "Test Plate Comment"); + listing.setComment(tb.addr(0x55550123), CommentType.EOL, "Test EOL Comment"); + listing.setComment(tb.addr(0x55550321), CommentType.PLATE, "Test Plate Comment"); } Address paddr = tb.addr(stSpace, 0x55550000); @@ -735,8 +735,8 @@ public class DebuggerCopyPlanTest extends AbstractGhidraHeadedDebuggerTest { assertEquals(Set.of(tb.addr(stSpace, 0x55550123), tb.addr(stSpace, 0x55550321)), addresses); assertEquals("Test EOL Comment", - listing.getComment(CodeUnit.EOL_COMMENT, tb.addr(stSpace, 0x55550123))); + listing.getComment(CommentType.EOL, tb.addr(stSpace, 0x55550123))); assertEquals("Test Plate Comment", - listing.getComment(CodeUnit.PLATE_COMMENT, tb.addr(stSpace, 0x55550321))); + listing.getComment(CommentType.PLATE, tb.addr(stSpace, 0x55550321))); } } diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/listing/DBTraceCodeUnitTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/listing/DBTraceCodeUnitTest.java index a1d0b82740..3ec509a081 100644 --- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/listing/DBTraceCodeUnitTest.java +++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/listing/DBTraceCodeUnitTest.java @@ -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. @@ -399,28 +399,28 @@ public class DBTraceCodeUnitTest extends AbstractGhidraHeadlessIntegrationTest // pass } - assertNull(i4004.getComment(CodeUnit.EOL_COMMENT)); + assertNull(i4004.getComment(CommentType.EOL)); try (Transaction tx = b.startTransaction()) { - i4004.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); + i4004.setComment(CommentType.EOL, "My EOL Comment"); } - assertEquals("My EOL Comment", i4004.getComment(CodeUnit.EOL_COMMENT)); - assertNull(i4006.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("My EOL Comment", i4004.getComment(CommentType.EOL)); + assertNull(i4006.getComment(CommentType.EOL)); - assertArrayEquals(EMPTY_STRING_ARRAY, i4004.getCommentAsArray(CodeUnit.PRE_COMMENT)); + assertArrayEquals(EMPTY_STRING_ARRAY, i4004.getCommentAsArray(CommentType.PRE)); try (Transaction tx = b.startTransaction()) { i4004.setCommentAsArray(CodeUnit.PRE_COMMENT, new String[] { "My", "Pre", "Comment" }); } - assertEquals("My EOL Comment", i4004.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("My EOL Comment", i4004.getComment(CommentType.EOL)); assertArrayEquals(new String[] { "My", "Pre", "Comment" }, - i4004.getCommentAsArray(CodeUnit.PRE_COMMENT)); - assertArrayEquals(EMPTY_STRING_ARRAY, i4006.getCommentAsArray(CodeUnit.PRE_COMMENT)); - assertEquals("My\nPre\nComment", i4004.getComment(CodeUnit.PRE_COMMENT)); + i4004.getCommentAsArray(CommentType.PRE)); + assertArrayEquals(EMPTY_STRING_ARRAY, i4006.getCommentAsArray(CommentType.PRE)); + assertEquals("My\nPre\nComment", i4004.getComment(CommentType.PRE)); try (Transaction tx = b.startTransaction()) { i4004.setCommentAsArray(CodeUnit.PRE_COMMENT, null); i4006.setCommentAsArray(CodeUnit.PRE_COMMENT, null); // NOP } - assertNull(i4004.getComment(CodeUnit.PRE_COMMENT)); + assertNull(i4004.getComment(CommentType.PRE)); TraceInstruction i4004_10; DBTraceCommentAdapter commentAdapter = b.trace.getCommentAdapter(); @@ -436,25 +436,25 @@ public class DBTraceCodeUnitTest extends AbstractGhidraHeadlessIntegrationTest assertEquals(Lifespan.nowOn(0), c4004.getLifespan()); i4004_10 = b.addInstruction(10, b.addr(0x4004), b.host); - i4004_10.setComment(CodeUnit.PRE_COMMENT, "Get this back in the mix"); - i4004_10.setComment(CodeUnit.EOL_COMMENT, "A different comment"); + i4004_10.setComment(CommentType.PRE, "Get this back in the mix"); + i4004_10.setComment(CommentType.EOL, "A different comment"); } assertEquals(Lifespan.span(0, 9), c4004.getLifespan()); - assertEquals("My EOL Comment", i4004.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("My EOL Comment", i4004.getComment(CommentType.EOL)); try (Transaction tx = b.startTransaction()) { commentAdapter.clearComments(Lifespan.nowOn(0), b.range(0x4000, 0x5000), CodeUnit.EOL_COMMENT); } - assertNull(i4004.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Get this back in the mix", i4004_10.getComment(CodeUnit.PRE_COMMENT)); + assertNull(i4004.getComment(CommentType.EOL)); + assertEquals("Get this back in the mix", i4004_10.getComment(CommentType.PRE)); try (Transaction tx = b.startTransaction()) { commentAdapter.clearComments(Lifespan.nowOn(0), b.range(0x4000, 0x5000), CodeUnit.NO_COMMENT); } - assertNull(i4004.getComment(CodeUnit.EOL_COMMENT)); - assertNull(i4004_10.getComment(CodeUnit.PRE_COMMENT)); + assertNull(i4004.getComment(CommentType.EOL)); + assertNull(i4004_10.getComment(CommentType.PRE)); } @Test diff --git a/Ghidra/Features/Base/ghidra_scripts/AutoRenameSimpleLabels.java b/Ghidra/Features/Base/ghidra_scripts/AutoRenameSimpleLabels.java index 8661c42369..24970531e2 100644 --- a/Ghidra/Features/Base/ghidra_scripts/AutoRenameSimpleLabels.java +++ b/Ghidra/Features/Base/ghidra_scripts/AutoRenameSimpleLabels.java @@ -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. @@ -31,7 +31,7 @@ import ghidra.app.script.GhidraScript; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Instruction; import ghidra.program.model.symbol.*; @@ -147,14 +147,14 @@ public class AutoRenameSimpleLabels extends GhidraScript { // now also propogate the repeatable comment up as well - String comment = currentProgram.getListing().getComment(CodeUnit.REPEATABLE_COMMENT, + String comment = currentProgram.getListing().getComment(CommentType.REPEATABLE, operand_addr); if (comment != null) { - if (currentProgram.getListing().getComment(CodeUnit.REPEATABLE_COMMENT, + if (currentProgram.getListing().getComment(CommentType.REPEATABLE, startAddr) == null) { //println("updating comment for " + operand +" is " + comment); - currentProgram.getListing().setComment(startAddr, - CodeUnit.REPEATABLE_COMMENT, comment); + currentProgram.getListing() + .setComment(startAddr, CommentType.REPEATABLE, comment); } } } diff --git a/Ghidra/Features/Base/ghidra_scripts/DeleteDeadDefaultPlatesScript.java b/Ghidra/Features/Base/ghidra_scripts/DeleteDeadDefaultPlatesScript.java index 0102428e28..bf8a46eccc 100644 --- a/Ghidra/Features/Base/ghidra_scripts/DeleteDeadDefaultPlatesScript.java +++ b/Ghidra/Features/Base/ghidra_scripts/DeleteDeadDefaultPlatesScript.java @@ -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. @@ -19,8 +19,7 @@ import ghidra.app.script.GhidraScript; import ghidra.program.model.address.*; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Listing; +import ghidra.program.model.listing.*; public class DeleteDeadDefaultPlatesScript extends GhidraScript { @@ -36,14 +35,14 @@ public class DeleteDeadDefaultPlatesScript extends GhidraScript { set = currentSelection; } int updateCount=0; - AddressIterator iter = listing.getCommentAddressIterator(CodeUnit.PLATE_COMMENT, set, true); + AddressIterator iter = listing.getCommentAddressIterator(CommentType.PLATE, set, true); while (iter.hasNext()) { Address addr = iter.next(); CodeUnit cu = listing.getCodeUnitAt(addr); if (cu != null) { - String[] comment = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.PLATE); if (comment.length == 1 && comment[0].equals(DEAD_PLATE)) { - cu.setComment(CodeUnit.PLATE_COMMENT, null); + cu.setComment(CommentType.PLATE, null); ++updateCount; } } diff --git a/Ghidra/Features/Base/ghidra_scripts/DeleteEmptyPlateCommentsScript.java b/Ghidra/Features/Base/ghidra_scripts/DeleteEmptyPlateCommentsScript.java index 8e252e5e8b..9906d3f23b 100644 --- a/Ghidra/Features/Base/ghidra_scripts/DeleteEmptyPlateCommentsScript.java +++ b/Ghidra/Features/Base/ghidra_scripts/DeleteEmptyPlateCommentsScript.java @@ -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. @@ -19,8 +19,7 @@ import ghidra.app.script.GhidraScript; import ghidra.program.model.address.*; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Listing; +import ghidra.program.model.listing.*; public class DeleteEmptyPlateCommentsScript extends GhidraScript { @@ -36,14 +35,14 @@ public class DeleteEmptyPlateCommentsScript extends GhidraScript { set = currentSelection; } int updateCount=0; - AddressIterator iter = listing.getCommentAddressIterator(CodeUnit.PLATE_COMMENT, set, true); + AddressIterator iter = listing.getCommentAddressIterator(CommentType.PLATE, set, true); while (iter.hasNext()) { Address addr = iter.next(); CodeUnit cu = listing.getCodeUnitAt(addr); if (cu != null) { - String[] comment = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.PLATE); if (comment.length == 1 && comment[0].equals(EMPTY_PLATE)) { - cu.setComment(CodeUnit.PLATE_COMMENT, null); + cu.setComment(CommentType.PLATE, null); ++updateCount; } } diff --git a/Ghidra/Features/Base/ghidra_scripts/DeleteExitCommentsScript.java b/Ghidra/Features/Base/ghidra_scripts/DeleteExitCommentsScript.java index 473736d3c0..10d61e2a72 100644 --- a/Ghidra/Features/Base/ghidra_scripts/DeleteExitCommentsScript.java +++ b/Ghidra/Features/Base/ghidra_scripts/DeleteExitCommentsScript.java @@ -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. @@ -18,11 +18,8 @@ //@category Update import ghidra.app.script.GhidraScript; -import ghidra.program.model.address.Address; -import ghidra.program.model.address.AddressIterator; -import ghidra.program.model.address.AddressSetView; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Listing; +import ghidra.program.model.address.*; +import ghidra.program.model.listing.*; public class DeleteExitCommentsScript extends GhidraScript { @@ -38,13 +35,13 @@ public class DeleteExitCommentsScript extends GhidraScript { set = currentSelection; } int updateCount=0; - AddressIterator iter = listing.getCommentAddressIterator(CodeUnit.POST_COMMENT, set, true); + AddressIterator iter = listing.getCommentAddressIterator(CommentType.POST, set, true); while (iter.hasNext()) { Address addr = iter.next(); CodeUnit cu = listing.getCodeUnitAt(addr); - String[] comment = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.POST); if (comment.length == 1 && comment[0].endsWith(EXIT_COMMENT)) { - cu.setComment(CodeUnit.POST_COMMENT, null); + cu.setComment(CommentType.POST, null); ++updateCount; } } diff --git a/Ghidra/Features/Base/ghidra_scripts/RegisterTouchesPerFunction.java b/Ghidra/Features/Base/ghidra_scripts/RegisterTouchesPerFunction.java index 713a38987e..7fa677657c 100644 --- a/Ghidra/Features/Base/ghidra_scripts/RegisterTouchesPerFunction.java +++ b/Ghidra/Features/Base/ghidra_scripts/RegisterTouchesPerFunction.java @@ -1,13 +1,12 @@ /* ### * IP: GHIDRA - * REVIEWED: YES * * 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. @@ -20,12 +19,12 @@ //@category Analysis +import java.util.*; + import ghidra.app.script.GhidraScript; import ghidra.program.model.lang.Register; import ghidra.program.model.listing.*; -import java.util.*; - public class RegisterTouchesPerFunction extends GhidraScript { private final static String DIVIDER = "*************************************************************\r\n"; @@ -65,7 +64,7 @@ public class RegisterTouchesPerFunction extends GhidraScript monitor.setMessage("Analyzing registers in " + func.getName()); - String comment = list.getComment(CodeUnit.PLATE_COMMENT, func.getBody().getMinAddress()); + String comment = list.getComment(CommentType.PLATE, func.getBody().getMinAddress()); if (comment != null && comment.indexOf("TOUCHED REGISTER SUMMARY") > -1) return; @@ -163,7 +162,7 @@ public class RegisterTouchesPerFunction extends GhidraScript buffer.append(" "+getString(pushPops, 8)); } - list.setComment(func.getEntryPoint(), CodeUnit.PLATE_COMMENT, buffer.toString()); + list.setComment(func.getEntryPoint(), CommentType.PLATE, buffer.toString()); } private String getString(Collection c, int itemsPerLine) diff --git a/Ghidra/Features/Base/ghidra_scripts/ZapBCTRScript.java b/Ghidra/Features/Base/ghidra_scripts/ZapBCTRScript.java index 280cc01044..2f69d92448 100644 --- a/Ghidra/Features/Base/ghidra_scripts/ZapBCTRScript.java +++ b/Ghidra/Features/Base/ghidra_scripts/ZapBCTRScript.java @@ -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. @@ -38,7 +38,7 @@ import java.util.List; import ghidra.app.script.GhidraScript; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Listing; import ghidra.program.model.mem.Memory; import ghidra.program.model.symbol.*; @@ -99,7 +99,7 @@ public class ZapBCTRScript extends GhidraScript { // insert funcName as EOL comment and // add a mnemonic ref from instAddr to funcAddr - listing.setComment(instAddr, CodeUnit.EOL_COMMENT, funcName); + listing.setComment(instAddr, CommentType.EOL, funcName); listing.getInstructionAt(instAddr).addMnemonicReference(funcAddr, RefType.COMPUTED_CALL, SourceType.USER_DEFINED); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/CodeUnitInfoPasteCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/CodeUnitInfoPasteCmd.java index a75d94fbed..3fffbcafb6 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/CodeUnitInfoPasteCmd.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/CodeUnitInfoPasteCmd.java @@ -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. @@ -325,23 +325,23 @@ public class CodeUnitInfoPasteCmd implements Command { String[] repeatableComment = info.getRepeatableComment(); if (plateComment != null) { - String[] oldComment = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] oldComment = cu.getCommentAsArray(CommentType.PLATE); cu.setCommentAsArray(CodeUnit.PLATE_COMMENT, appendComment(oldComment, plateComment)); } if (preComment != null) { - String[] oldComment = cu.getCommentAsArray(CodeUnit.PRE_COMMENT); + String[] oldComment = cu.getCommentAsArray(CommentType.PRE); cu.setCommentAsArray(CodeUnit.PRE_COMMENT, appendComment(oldComment, preComment)); } if (postComment != null) { - String[] oldComment = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + String[] oldComment = cu.getCommentAsArray(CommentType.POST); cu.setCommentAsArray(CodeUnit.POST_COMMENT, appendComment(oldComment, postComment)); } if (eolComment != null) { - String[] oldComment = cu.getCommentAsArray(CodeUnit.EOL_COMMENT); + String[] oldComment = cu.getCommentAsArray(CommentType.EOL); cu.setCommentAsArray(CodeUnit.EOL_COMMENT, appendComment(oldComment, eolComment)); } if (repeatableComment != null) { - String[] oldComment = cu.getCommentAsArray(CodeUnit.REPEATABLE_COMMENT); + String[] oldComment = cu.getCommentAsArray(CommentType.REPEATABLE); cu.setCommentAsArray(CodeUnit.REPEATABLE_COMMENT, appendComment(oldComment, repeatableComment)); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentCmd.java index 68143a033b..cb9c2eeef7 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentCmd.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentCmd.java @@ -26,7 +26,7 @@ import ghidra.program.model.listing.*; public class SetCommentCmd implements Command { private Address address; - private int commentType; + private CommentType commentType; private String comment; private String cmdName; private String message; @@ -36,8 +36,23 @@ public class SetCommentCmd implements Command { * @param addr address of code unit where comment will be placed * @param commentType valid comment type (see CodeUnit) * @param comment comment for code unit + * @deprecated Use {@link #SetCommentCmd(Address, CommentType, String)} instead */ + @Deprecated public SetCommentCmd(Address addr, int commentType, String comment) { + this.address = addr; + this.commentType = CommentType.values()[commentType]; + this.comment = comment; + cmdName = comment == null ? "Delete Comment" : "Set Comment"; + } + + /** + * Construct command + * @param addr address of code unit where comment will be placed + * @param commentType valid comment type (see CodeUnit) + * @param comment comment for code unit + */ + public SetCommentCmd(Address addr, CommentType commentType, String comment) { this.address = addr; this.commentType = commentType; this.comment = comment; @@ -115,9 +130,29 @@ public class SetCommentCmd implements Command { * @param commentType the type of comment ({@link CodeUnit#PLATE_COMMENT}, * {@link CodeUnit#PRE_COMMENT}, {@link CodeUnit#EOL_COMMENT}, {@link CodeUnit#POST_COMMENT}, * {@link CodeUnit#REPEATABLE_COMMENT}) + * @deprecated Use {@link #createComment(Program, Address, String, CommentType)} instead */ + @Deprecated public static void createComment(Program program, Address addr, String comment, int commentType) { + SetCommentCmd commentCmd = + new SetCommentCmd(addr, CommentType.values()[commentType], comment); + commentCmd.applyTo(program); + } + + /** + * Creates the specified comment of the specified type at address. The current comment of + * this commentType will be cleared. + * + * @param program the program being analyzed + * @param addr the address where data is created + * @param comment the comment about the data + * @param commentType the type of comment ({@link CommentType#PLATE}, + * {@link CodeUnit#PRE_COMMENT}, {@link CodeUnit#EOL_COMMENT}, {@link CodeUnit#POST_COMMENT}, + * {@link CodeUnit#REPEATABLE_COMMENT}) + */ + public static void createComment(Program program, Address addr, String comment, + CommentType commentType) { SetCommentCmd commentCmd = new SetCommentCmd(addr, commentType, comment); commentCmd.applyTo(program); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentsCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentsCmd.java index cdf7035c72..a60666b672 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentsCmd.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/comments/SetCommentsCmd.java @@ -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. @@ -83,31 +83,31 @@ public class SetCommentsCmd implements Command { CodeUnit cu = getCodeUnit(program); if (cu != null) { - if (commentChanged(cu.getComment(CodeUnit.PRE_COMMENT), preComment)) { + if (commentChanged(cu.getComment(CommentType.PRE), preComment)) { String updatedPreComment = CommentUtils.fixupAnnotations(preComment, program); updatedPreComment = CommentUtils.sanitize(updatedPreComment); - cu.setComment(CodeUnit.PRE_COMMENT, updatedPreComment); + cu.setComment(CommentType.PRE, updatedPreComment); } - if (commentChanged(cu.getComment(CodeUnit.POST_COMMENT), postComment)) { + if (commentChanged(cu.getComment(CommentType.POST), postComment)) { String updatedPostComment = CommentUtils.fixupAnnotations(postComment, program); updatedPostComment = CommentUtils.sanitize(updatedPostComment); - cu.setComment(CodeUnit.POST_COMMENT, updatedPostComment); + cu.setComment(CommentType.POST, updatedPostComment); } - if (commentChanged(cu.getComment(CodeUnit.EOL_COMMENT), eolComment)) { + if (commentChanged(cu.getComment(CommentType.EOL), eolComment)) { String updatedEOLComment = CommentUtils.fixupAnnotations(eolComment, program); updatedEOLComment = CommentUtils.sanitize(updatedEOLComment); - cu.setComment(CodeUnit.EOL_COMMENT, updatedEOLComment); + cu.setComment(CommentType.EOL, updatedEOLComment); } - if (commentChanged(cu.getComment(CodeUnit.PLATE_COMMENT), plateComment)) { + if (commentChanged(cu.getComment(CommentType.PLATE), plateComment)) { String updatedPlateComment = CommentUtils.fixupAnnotations(plateComment, program); updatedPlateComment = CommentUtils.sanitize(updatedPlateComment); - cu.setComment(CodeUnit.PLATE_COMMENT, updatedPlateComment); + cu.setComment(CommentType.PLATE, updatedPlateComment); } - if (commentChanged(cu.getComment(CodeUnit.REPEATABLE_COMMENT), repeatableComment)) { + if (commentChanged(cu.getComment(CommentType.REPEATABLE), repeatableComment)) { String updatedRepeatableComment = CommentUtils.fixupAnnotations(repeatableComment, program); updatedRepeatableComment = CommentUtils.sanitize(updatedRepeatableComment); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, updatedRepeatableComment); + cu.setComment(CommentType.REPEATABLE, updatedRepeatableComment); } } return true; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/ElfBinaryAnalysisCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/ElfBinaryAnalysisCommand.java index dddc75dae1..979706047c 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/ElfBinaryAnalysisCommand.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/ElfBinaryAnalysisCommand.java @@ -184,7 +184,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI createFragment(sectionDT.getName(), sectionStart, sectionDT.getLength()); CodeUnit cu = listing.getCodeUnitAt(addr(offset)); - cu.setComment(CodeUnit.PLATE_COMMENT, + cu.setComment(CommentType.PLATE, "#" + i + ") " + name + " at 0x" + Long.toHexString(sections[i].getAddress())); if (sections[i].getType() == ElfSectionHeaderConstants.SHT_NOBITS || @@ -203,7 +203,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI } cu = listing.getCodeUnitAt(dataStart); - cu.setComment(CodeUnit.PRE_COMMENT, sections[i].getNameAsString() + " Size: 0x" + + cu.setComment(CommentType.PRE, sections[i].getNameAsString() + " Size: 0x" + Long.toHexString(sections[i].getSize())); } } @@ -228,7 +228,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI for (int i = 0; i < programHeaders.length; i++) { monitor.checkCancelled(); Data d = array.getComponent(i); - d.setComment(CodeUnit.EOL_COMMENT, programHeaders[i].getComment()); + d.setComment(CommentType.EOL, programHeaders[i].getComment()); Address addr = addr(programHeaders[i].getOffset()); @@ -292,7 +292,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI dynamicType != null ? (dynamicType.name + " - " + dynamicType.description) : ("DT_0x" + StringUtilities.pad(Integer.toHexString(tagType), '0', 8)); - dynamicData.setComment(CodeUnit.EOL_COMMENT, comment); + dynamicData.setComment(CommentType.EOL, comment); Data valueData = dynamicData.getComponent(1); @@ -323,7 +323,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI if (dynamicStringTable != null) { String str = dynamicStringTable.readString(reader, dynamic.getValue()); if (str != null && str.length() != 0) { - data.setComment(CodeUnit.EOL_COMMENT, str); + data.setComment(CommentType.EOL, str); } } } @@ -384,7 +384,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI try { Address currAddr = symbolTableAddr.add(j * symbolTable2.getEntrySize()); - listing.setComment(currAddr, CodeUnit.EOL_COMMENT, + listing.setComment(currAddr, CommentType.EOL, name + " at 0x" + Long.toHexString(symbols[j].getValue())); } catch (Exception e) { @@ -418,7 +418,7 @@ public class ElfBinaryAnalysisCommand extends FlatProgramAPI createData(relocationTableAddress, dataType); } else { - listing.setComment(relocationTableAddress, CodeUnit.PRE_COMMENT, + listing.setComment(relocationTableAddress, CommentType.PRE, "ELF Relocation Table (markup not yet supported)"); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/CliMetadataTokenAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/CliMetadataTokenAnalyzer.java index 82073f41fa..2849a09382 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/CliMetadataTokenAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/CliMetadataTokenAnalyzer.java @@ -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. @@ -194,7 +194,7 @@ public class CliMetadataTokenAnalyzer extends AbstractAnalyzer { int strIndex = (int) strIndexOp.getUnsignedValue(); - inst.setComment(CodeUnit.EOL_COMMENT, + inst.setComment(CommentType.EOL, "\"" + metaStream.getUserStringsStream().getUserString(strIndex) + "\""); } @@ -229,7 +229,7 @@ public class CliMetadataTokenAnalyzer extends AbstractAnalyzer { private void markMetadataRow(Instruction inst, CliAbstractTableRow tableRow, String prependComment, String appendComment, CliStreamMetadata stream) { - inst.setComment(CodeUnit.EOL_COMMENT, String.format("%s%s%s", prependComment, + inst.setComment(CommentType.EOL, String.format("%s%s%s", prependComment, tableRow.getShortRepresentation(stream), appendComment)); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java index f1aad117cf..8dbdc8d971 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/GolangSymbolAnalyzer.java @@ -678,7 +678,7 @@ public class GolangSymbolAnalyzer extends AbstractAnalyzer { func.updateFunction(ccName, duffFunc.getReturn(), Arrays.asList(duffFunc.getParameters()), fut, true, SourceType.ANALYSIS); if (duffComment != null && !duffComment.isBlank()) { - new SetCommentCmd(func.getEntryPoint(), CodeUnit.PLATE_COMMENT, duffComment) + new SetCommentCmd(func.getEntryPoint(), CommentType.PLATE, duffComment) .applyTo(program); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MingwRelocationAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MingwRelocationAnalyzer.java index 2acc71b8a8..d5e723d526 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MingwRelocationAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MingwRelocationAnalyzer.java @@ -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. @@ -410,7 +410,7 @@ class MinGWPseudoRelocationHandler { else { // TODO: Not sure how to preserve relationship to external symbol // which refers to Library - listing.setComment(nextExtAddr, CodeUnit.PLATE_COMMENT, + listing.setComment(nextExtAddr, CommentType.PLATE, "External Location: " + extSym.getName(true)); String name = extLoc.getOriginalImportedName(); boolean demangle = true; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC1_MessageAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC1_MessageAnalyzer.java index 26de6b9590..f53a739628 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC1_MessageAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC1_MessageAnalyzer.java @@ -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. @@ -67,6 +67,7 @@ public class ObjectiveC1_MessageAnalyzer extends AbstractAnalyzer { inspectFunction(program, function, state, monitor); } catch (Exception e) { + // do nothing } } @@ -96,7 +97,7 @@ public class ObjectiveC1_MessageAnalyzer extends AbstractAnalyzer { Instruction instruction = instructionIterator.next(); if (isCallingObjcMsgSend(instruction)) { - String eolComment = instruction.getComment(CodeUnit.EOL_COMMENT); + String eolComment = instruction.getComment(CommentType.EOL); if (eolComment != null) {//if a comment already exists, ignore... continue; @@ -178,11 +179,9 @@ public class ObjectiveC1_MessageAnalyzer extends AbstractAnalyzer { return symbolTable.createNameSpace(parentNamespace, namespaceName, SourceType.ANALYSIS); } - catch (DuplicateNameException e) { + catch (InvalidInputException | DuplicateNameException e) { + return null; } - catch (InvalidInputException e) { - } - return null; } } @@ -224,7 +223,7 @@ public class ObjectiveC1_MessageAnalyzer extends AbstractAnalyzer { pullNameThrough(state, toAddress, null); if (state.isValid()) { - instruction.setComment(CodeUnit.EOL_COMMENT, state.toString()); + instruction.setComment(CommentType.EOL, state.toString()); setReference(fromAddress, state); break; } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_MessageAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_MessageAnalyzer.java index 80daa09044..3b3ad62363 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_MessageAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_MessageAnalyzer.java @@ -83,7 +83,7 @@ public class ObjectiveC2_MessageAnalyzer extends AbstractAnalyzer { Instruction instruction = instructionIterator.next(); if (isCallingObjcMsgSend(instruction)) { - String eolComment = instruction.getComment(CodeUnit.EOL_COMMENT); + String eolComment = instruction.getComment(CommentType.EOL); if (eolComment != null) {//if a comment already exists, ignore... continue; @@ -196,7 +196,7 @@ public class ObjectiveC2_MessageAnalyzer extends AbstractAnalyzer { } if (currentClass != null && currentMethod != null) { - instruction.setComment(CodeUnit.EOL_COMMENT, "[" + currentClass + " " + + instruction.setComment(CommentType.EOL, "[" + currentClass + " " + currentMethod + "]"); break; } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java index dd29eb5b08..7e09717f8c 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/CreateBookmarkDialog.java @@ -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. @@ -185,7 +185,7 @@ public class CreateBookmarkDialog extends DialogComponentProvider { } private String getEolComment(CodeUnit codeUnit) { - String comment = codeUnit.getComment(CodeUnit.EOL_COMMENT); + String comment = codeUnit.getComment(CommentType.EOL); if (comment == null) { return ""; } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.java index fe0a88c96a..77205b313c 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/comments/CommentsDialog.java @@ -35,6 +35,7 @@ import ghidra.app.util.viewer.field.AnnotatedStringHandler; import ghidra.app.util.viewer.field.CommentUtils; import ghidra.framework.plugintool.PluginTool; import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.util.HelpLocation; /** @@ -93,11 +94,11 @@ public class CommentsDialog extends ReusableDialogComponentProvider implements K setTitle("Set Comment(s) at Address " + cu.getMinAddress()); codeUnit = cu; - preComment = cu.getComment(CodeUnit.PRE_COMMENT); - postComment = cu.getComment(CodeUnit.POST_COMMENT); - eolComment = cu.getComment(CodeUnit.EOL_COMMENT); - plateComment = cu.getComment(CodeUnit.PLATE_COMMENT); - repeatableComment = cu.getComment(CodeUnit.REPEATABLE_COMMENT); + preComment = cu.getComment(CommentType.PRE); + postComment = cu.getComment(CommentType.POST); + eolComment = cu.getComment(CommentType.EOL); + plateComment = cu.getComment(CommentType.PLATE); + repeatableComment = cu.getComment(CommentType.REPEATABLE); preComment = (preComment == null) ? "" : preComment; postComment = (postComment == null) ? "" : postComment; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentTableModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentTableModel.java index 9259cf36ca..f4df7503b3 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentTableModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/commentwindow/CommentTableModel.java @@ -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. @@ -94,19 +94,19 @@ class CommentTableModel extends AddressBasedTableModel { continue; } - if (cu.getComment(CodeUnit.PRE_COMMENT) != null) { + if (cu.getComment(CommentType.PRE) != null) { accumulator.add(new CommentRowObject(commentAddr, CodeUnit.PRE_COMMENT)); } - if (cu.getComment(CodeUnit.POST_COMMENT) != null) { + if (cu.getComment(CommentType.POST) != null) { accumulator.add(new CommentRowObject(commentAddr, CodeUnit.POST_COMMENT)); } - if (cu.getComment(CodeUnit.EOL_COMMENT) != null) { + if (cu.getComment(CommentType.EOL) != null) { accumulator.add(new CommentRowObject(commentAddr, CodeUnit.EOL_COMMENT)); } - if (cu.getComment(CodeUnit.PLATE_COMMENT) != null) { + if (cu.getComment(CommentType.PLATE) != null) { accumulator.add(new CommentRowObject(commentAddr, CodeUnit.PLATE_COMMENT)); } - if (cu.getComment(CodeUnit.REPEATABLE_COMMENT) != null) { + if (cu.getComment(CommentType.REPEATABLE) != null) { accumulator.add(new CommentRowObject(commentAddr, CodeUnit.REPEATABLE_COMMENT)); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AddressTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AddressTable.java index bccc8dc18a..c973d96928 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AddressTable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/disassembler/AddressTable.java @@ -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. @@ -36,7 +36,8 @@ import ghidra.program.model.symbol.*; import ghidra.program.model.util.AddressSetPropertyMap; import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.util.Msg; -import ghidra.util.exception.*; +import ghidra.util.exception.DuplicateNameException; +import ghidra.util.exception.InvalidInputException; import ghidra.util.task.TaskMonitor; public class AddressTable { @@ -496,7 +497,7 @@ public class AddressTable { } if (comment != null) { - program.getListing().setComment(topAddress, CodeUnit.EOL_COMMENT, comment); + program.getListing().setComment(topAddress, CommentType.EOL, comment); } if (flagNewCode && newCodeFound) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccAnalysisClass.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccAnalysisClass.java index 52df1b9886..30a69177bf 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccAnalysisClass.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccAnalysisClass.java @@ -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. @@ -19,7 +19,7 @@ import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.app.cmd.data.CreateDataCmd; import ghidra.program.model.address.Address; import ghidra.program.model.data.*; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.util.task.TaskMonitor; @@ -100,12 +100,10 @@ public abstract class GccAnalysisClass { * @param addr the address where data is created * @param dt the type for the data * @param comment the comment about the data - * @param commentType the type of comment ({@link CodeUnit#PLATE_COMMENT}, - * {@link CodeUnit#PRE_COMMENT}, {@link CodeUnit#EOL_COMMENT}, {@link CodeUnit#POST_COMMENT}, - * {@link CodeUnit#REPEATABLE_COMMENT}) + * @param commentType the {@link CommentType type of comment } */ protected static void createAndCommentData(Program program, Address addr, DataType dt, - String comment, int commentType) { + String comment, CommentType commentType) { createData(program, addr, dt); SetCommentCmd.createComment(program, addr, comment, commentType); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccExceptionAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccExceptionAnalyzer.java index cd0e9950a5..67878f8a7b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccExceptionAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/GccExceptionAnalyzer.java @@ -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. @@ -288,11 +288,11 @@ public class GccExceptionAnalyzer extends AbstractAnalyzer { Address csMaxAddr = callSite.getMaxAddress(); String startTryComment = "try { // try from " + csMinAddr + " to " + csMaxAddr + " has its CatchHandler @ " + lpAddr; - String existingComment = program.getListing().getComment(CodeUnit.PRE_COMMENT, csMinAddr); + String existingComment = program.getListing().getComment(CommentType.PRE, csMinAddr); if (existingComment == null || !existingComment.contains(startTryComment)) { String mergedComment = StringUtilities.mergeStrings(existingComment, startTryComment); SetCommentCmd setCommentCmd = - new SetCommentCmd(csMinAddr, CodeUnit.PRE_COMMENT, mergedComment); + new SetCommentCmd(csMinAddr, CommentType.PRE, mergedComment); setCommentCmd.applyTo(program); } } @@ -305,11 +305,11 @@ public class GccExceptionAnalyzer extends AbstractAnalyzer { Address commentAddr = csMaxCodeUnit.getMinAddress(); String endTryComment = "} // end try from " + csMinAddr + " to " + csMaxAddr; String existingComment = - program.getListing().getComment(CodeUnit.POST_COMMENT, commentAddr); + program.getListing().getComment(CommentType.POST, commentAddr); if (existingComment == null || !existingComment.contains(endTryComment)) { String mergedComment = StringUtilities.mergeStrings(existingComment, endTryComment); SetCommentCmd setCommentCmd = - new SetCommentCmd(commentAddr, CodeUnit.POST_COMMENT, mergedComment); + new SetCommentCmd(commentAddr, CommentType.POST, mergedComment); setCommentCmd.applyTo(program); } } @@ -322,11 +322,10 @@ public class GccExceptionAnalyzer extends AbstractAnalyzer { typeInfos.stream().map(a -> getCatchParamInfo(a)).collect(Collectors.joining(", ")); String startCatchComment = "catch(" + typeString + ") { ... } // from try @ " + csAddr + " with catch @ " + lpAddr; - String existingComment = program.getListing().getComment(CodeUnit.PRE_COMMENT, lpAddr); + String existingComment = program.getListing().getComment(CommentType.PRE, lpAddr); if (existingComment == null || !existingComment.contains(startCatchComment)) { String mergedComment = StringUtilities.mergeStrings(existingComment, startCatchComment); - SetCommentCmd setCommentCmd = - new SetCommentCmd(lpAddr, CodeUnit.PRE_COMMENT, mergedComment); + SetCommentCmd setCommentCmd = new SetCommentCmd(lpAddr, CommentType.PRE, mergedComment); setCommentCmd.applyTo(program); } } @@ -346,7 +345,7 @@ public class GccExceptionAnalyzer extends AbstractAnalyzer { // // TODO If we can determine the length of the catch handler we could mark its end too. // Address lpMaxAddr = ?; // String endCatchComment = "} // end catchHandler()"; -// String existingComment = program.getListing().getComment(CodeUnit.POST_COMMENT, lpMaxAddr); +// String existingComment = program.getListing().getComment(CommentType.POST, lpMaxAddr); // if (existingComment == null || !existingComment.contains(endCatchComment)) { // String mergedComment = // StringUtilities.mergeStrings(existingComment, endCatchComment); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/AbstractFrameSection.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/AbstractFrameSection.java index 64f0a5a4fb..6bc554dab1 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/AbstractFrameSection.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/AbstractFrameSection.java @@ -5,9 +5,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. @@ -24,7 +24,7 @@ import ghidra.app.plugin.exceptionhandlers.gcc.RegionDescriptor; import ghidra.app.plugin.exceptionhandlers.gcc.structures.ehFrame.*; import ghidra.program.model.address.Address; import ghidra.program.model.data.ByteDataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.mem.MemoryBlock; @@ -176,8 +176,7 @@ abstract class AbstractFrameSection implements CieSource { private void createPlateComment(Address curAddress, String fdeComment) { - SetCommentCmd commentCmd = - new SetCommentCmd(curAddress, CodeUnit.PLATE_COMMENT, fdeComment); + SetCommentCmd commentCmd = new SetCommentCmd(curAddress, CommentType.PLATE, fdeComment); commentCmd.applyTo(program); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/EhFrameHeaderSection.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/EhFrameHeaderSection.java index 57ba9bf017..04b9a15c30 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/EhFrameHeaderSection.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/sections/EhFrameHeaderSection.java @@ -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. @@ -22,7 +22,7 @@ import ghidra.app.plugin.exceptionhandlers.gcc.structures.ehFrame.*; import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressOutOfBoundsException; import ghidra.program.model.data.DataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.mem.MemoryBlock; @@ -127,7 +127,7 @@ public class EhFrameHeaderSection { dataCmd.applyTo(program); SetCommentCmd commentCmd = - new SetCommentCmd(curAddress, CodeUnit.EOL_COMMENT, "Encoded FDE count"); + new SetCommentCmd(curAddress, CommentType.EOL, "Encoded FDE count"); commentCmd.applyTo(program); curAddress = curAddress.add(ctx.getEncodedLength()); @@ -169,7 +169,7 @@ public class EhFrameHeaderSection { dataCmd.applyTo(program); SetCommentCmd commentCmd = - new SetCommentCmd(curAddress, CodeUnit.EOL_COMMENT, "Encoded eh_frame_ptr"); + new SetCommentCmd(curAddress, CommentType.EOL, "Encoded eh_frame_ptr"); commentCmd.applyTo(program); curAddress = curAddress.add(ctx.getEncodedLength()); @@ -196,7 +196,7 @@ public class EhFrameHeaderSection { fde_table.create(curAddress, fdeTblDecoder, fdeTableCnt); SetCommentCmd commentCmd = - new SetCommentCmd(curAddress, CodeUnit.PLATE_COMMENT, "Frame Description Entry Table"); + new SetCommentCmd(curAddress, CommentType.PLATE, "Frame Description Entry Table"); commentCmd.applyTo(program); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/Cie.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/Cie.java index 5b6edbdd6f..d90e99d074 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/Cie.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/Cie.java @@ -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. @@ -134,7 +134,7 @@ public class Cie extends GccAnalysisClass { * appropriate comment for the new structure. */ String comment = "(CIE) Length"; - createAndCommentData(program, addr, dwordDT, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, dwordDT, comment, CommentType.EOL); program.getMemory().getBytes(addr, enc_length); curSize += DWORD_LEN; @@ -161,7 +161,7 @@ public class Cie extends GccAnalysisClass { * appropriate comment for the new structure. */ String comment = "(CIE) ID"; - createAndCommentData(program, addr, dwordDT, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, dwordDT, comment, CommentType.EOL); program.getMemory().getBytes(addr, enc_cieId); cieId = (int) GccAnalysisUtils.readDWord(program, addr); @@ -184,7 +184,7 @@ public class Cie extends GccAnalysisClass { * appropriate comment for the new structure. */ String comment = "(CIE) Version"; - createAndCommentData(program, addr, new ByteDataType(), comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, new ByteDataType(), comment, CommentType.EOL); version = GccAnalysisUtils.readByte(program, addr); curSize += BYTE_LEN; @@ -208,7 +208,7 @@ public class Cie extends GccAnalysisClass { * and sets an appropriate comment for the new structure. */ String comment = "(CIE) Augmentation String"; - createAndCommentData(program, addr, new StringDataType(), comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, new StringDataType(), comment, CommentType.EOL); Data dataAt = program.getListing().getDataAt(addr); if (dataAt == null) { throw new ExceptionHandlerFrameException( @@ -236,7 +236,7 @@ public class Cie extends GccAnalysisClass { * appropriate comment for the new structure. */ String comment = "(CIE) Pointer Size"; - createAndCommentData(program, addr, new ByteDataType(), comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, new ByteDataType(), comment, CommentType.EOL); ptrSize = GccAnalysisUtils.readByte(program, addr); curSize += BYTE_LEN; @@ -258,7 +258,7 @@ public class Cie extends GccAnalysisClass { * appropriate comment for the new structure. */ String comment = "(CIE) Segment Size"; - createAndCommentData(program, addr, new ByteDataType(), comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, new ByteDataType(), comment, CommentType.EOL); segmentSize = GccAnalysisUtils.readByte(program, addr); curSize += BYTE_LEN; @@ -285,7 +285,7 @@ public class Cie extends GccAnalysisClass { codeAlignFactor = (int) uleb128.asLong(); createAndCommentData(program, addr, UnsignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); curSize += uleb128.getLength(); @@ -312,7 +312,7 @@ public class Cie extends GccAnalysisClass { dataAlignFactor = (int) sleb128.asLong(); createAndCommentData(program, addr, SignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); curSize += sleb128.getLength(); @@ -356,7 +356,7 @@ public class Cie extends GccAnalysisClass { } - createAndCommentData(program, addr, encodedDt, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, encodedDt, comment, CommentType.EOL); curSize += encodedLen; return addr.add(encodedLen); @@ -382,7 +382,7 @@ public class Cie extends GccAnalysisClass { augmentationDataLength = (int) uleb128.asLong(); createAndCommentData(program, addr, UnsignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); curSize += uleb128.getLength(); @@ -430,8 +430,7 @@ public class Cie extends GccAnalysisClass { initialInstructionCount = intLength - curSize; arrayCmd = new CreateArrayCmd(addr, initialInstructionCount, new ByteDataType(), BYTE_LEN); arrayCmd.applyTo(program); - SetCommentCmd.createComment(program, addr, "(CIE) Initial Instructions", - CodeUnit.EOL_COMMENT); + SetCommentCmd.createComment(program, addr, "(CIE) Initial Instructions", CommentType.EOL); initialInstructions = new byte[initialInstructionCount]; int numBytesRead = program.getMemory().getBytes(addr, initialInstructions); @@ -525,8 +524,8 @@ public class Cie extends GccAnalysisClass { } private void markEndOfFrame(Address addr) { - createAndCommentData(program, addr, dwordDT, "End of Frame", CodeUnit.EOL_COMMENT); - SetCommentCmd commentCmd = new SetCommentCmd(addr, CodeUnit.PLATE_COMMENT, "END OF FRAME"); + createAndCommentData(program, addr, dwordDT, "End of Frame", CommentType.EOL); + SetCommentCmd commentCmd = new SetCommentCmd(addr, CommentType.PLATE, "END OF FRAME"); commentCmd.applyTo(program); } @@ -549,7 +548,7 @@ public class Cie extends GccAnalysisClass { if (intLength == 0xffffffff) { hasExtLength = true; String comment = "(CIE) Extended Length"; - createAndCommentData(program, addr, new QWordDataType(), comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, new QWordDataType(), comment, CommentType.EOL); program.getMemory().getBytes(addr, enc_extLength); addr = addr.add(QWORD_LEN); curSize += QWORD_LEN; @@ -620,7 +619,7 @@ public class Cie extends GccAnalysisClass { String lsdaComment = "(CIE Augmentation Data) LSDA Personality Function Pointer Encoding"; createAndCommentData(program, augmentationDataAddr.add(augmentationDataIndex), - new DwarfEncodingModeDataType(), lsdaComment, CodeUnit.EOL_COMMENT); + new DwarfEncodingModeDataType(), lsdaComment, CommentType.EOL); } private void processFdeEncoding(Address augmentationDataAddr, int augmentationDataIndex, @@ -630,7 +629,7 @@ public class Cie extends GccAnalysisClass { createAndCommentData(program, augmentationDataAddr.add(augmentationDataIndex), new DwarfEncodingModeDataType(), "(CIE Augmentation Data) FDE Encoding", - CodeUnit.EOL_COMMENT); + CommentType.EOL); } private DwarfEHDecoder processPersonalityEncoding(Address augmentationDataAddr, @@ -643,7 +642,7 @@ public class Cie extends GccAnalysisClass { String prsnltyComment = "(CIE Augmentation Data) Personality Function Pointer Encoding"; createAndCommentData(program, augmentationDataAddr.add(augmentationDataIndex), - new DwarfEncodingModeDataType(), prsnltyComment, CodeUnit.EOL_COMMENT); + new DwarfEncodingModeDataType(), prsnltyComment, CommentType.EOL); return personalityDecoder; } @@ -660,7 +659,7 @@ public class Cie extends GccAnalysisClass { createAndCommentData(program, augmentationDataAddr.add(augmentationDataIndex), prnsFuncPtrDt, "(CIE Augmentation Data) Personality Function Pointer (" + personalityFuncAddr + ")", - CodeUnit.EOL_COMMENT); + CommentType.EOL); program.getReferenceManager().addMemoryReference( augmentationDataAddr.add(augmentationDataIndex), personalityFuncAddr, RefType.DATA, diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/DwarfCallFrameOpcodeParser.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/DwarfCallFrameOpcodeParser.java index 6479062daf..9a4768a1cc 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/DwarfCallFrameOpcodeParser.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/DwarfCallFrameOpcodeParser.java @@ -5,9 +5,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. @@ -20,7 +20,7 @@ import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.app.plugin.exceptionhandlers.gcc.GccAnalysisUtils; import ghidra.app.util.bin.LEB128Info; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.util.Msg; @@ -393,7 +393,7 @@ public class DwarfCallFrameOpcodeParser { } } - SetCommentCmd.createComment(program, instrAddr, sb.toString(), CodeUnit.EOL_COMMENT); + SetCommentCmd.createComment(program, instrAddr, sb.toString(), CommentType.EOL); Msg.info(this, sb.toString()); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/ExceptionHandlerFrameHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/ExceptionHandlerFrameHeader.java index ac428a861e..0a12ac49a4 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/ExceptionHandlerFrameHeader.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/ExceptionHandlerFrameHeader.java @@ -1,13 +1,12 @@ /* ### * IP: GHIDRA - * REVIEWED: YES * * 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. @@ -22,7 +21,7 @@ import ghidra.app.plugin.exceptionhandlers.gcc.datatype.DwarfEncodingModeDataTyp import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressOutOfBoundsException; import ghidra.program.model.data.*; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.util.task.TaskMonitor; @@ -101,7 +100,8 @@ public class ExceptionHandlerFrameHeader { dataCmd.applyTo(prog); /* Set a comment on the newly created structure */ - SetCommentCmd commentCmd = new SetCommentCmd(addr, CodeUnit.PLATE_COMMENT, "Exception Handler Frame Header"); + SetCommentCmd commentCmd = + new SetCommentCmd(addr, CommentType.PLATE, "Exception Handler Frame Header"); commentCmd.applyTo(prog); // Set the class members accordingly diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/FrameDescriptionEntry.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/FrameDescriptionEntry.java index cbe33418b0..c052cdb64d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/FrameDescriptionEntry.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/ehFrame/FrameDescriptionEntry.java @@ -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. @@ -177,7 +177,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { * and sets an appropriate comment for the new structure. */ String comment = "(FDE) Length"; - createAndCommentData(program, addr, dwordDT, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, dwordDT, comment, CommentType.EOL); intLength = program.getMemory().getInt(addr); return addr.add(DWORD_LEN); @@ -202,7 +202,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { DataType locType = new DWordDataType(); int locTypeSize = locType.getLength(); - createAndCommentData(program, addr, locType, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, locType, comment, CommentType.EOL); intPtr = (int) GccAnalysisUtils.readDWord(program, addr); @@ -266,7 +266,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { DataType encodedDt = cie.getFDEDecoder().getDataType(program); - createAndCommentData(program, addr, encodedDt, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, encodedDt, comment, CommentType.EOL); if (pcBeginAddr.getOffset() != 0x0) { program.getReferenceManager() .addMemoryReference(addr, pcBeginAddr, RefType.DATA, SourceType.ANALYSIS, 0); @@ -324,7 +324,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { } int dtLength = dataType.getLength(); - createAndCommentData(program, addr, dataType, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, dataType, comment, CommentType.EOL); curSize += dtLength; @@ -358,7 +358,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { intAugmentationDataLength = (int) uleb128.asLong(); createAndCommentData(program, addr, UnsignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); curSize += uleb128.getLength(); @@ -377,7 +377,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { * Create a new Augmentation Data field at the specified address * and sets an appropriate comment for the new structure. */ - SetCommentCmd.createComment(program, addr, "(FDE) Augmentation Data", CodeUnit.EOL_COMMENT); + SetCommentCmd.createComment(program, addr, "(FDE) Augmentation Data", CommentType.EOL); this.augmentationData = new byte[intAugmentationDataLength]; program.getMemory().getBytes(addr, augmentationData); @@ -406,7 +406,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { } SetCommentCmd.createComment(program, addr, "(FDE) Call Frame Instructions", - CodeUnit.EOL_COMMENT); + CommentType.EOL); callFrameInstructions = new byte[instructionLength]; program.getMemory().getBytes(addr, callFrameInstructions); @@ -512,8 +512,8 @@ public class FrameDescriptionEntry extends GccAnalysisClass { } private void markEndOfFrame(Address addr) { - createAndCommentData(program, addr, dwordDT, "End of Frame", CodeUnit.EOL_COMMENT); - SetCommentCmd commentCmd = new SetCommentCmd(addr, CodeUnit.PLATE_COMMENT, "END OF FRAME"); + createAndCommentData(program, addr, dwordDT, "End of Frame", CommentType.EOL); + SetCommentCmd commentCmd = new SetCommentCmd(addr, CommentType.PLATE, "END OF FRAME"); commentCmd.applyTo(program); } @@ -526,7 +526,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { if (intLength == -1) { hasExtLength = true; String comment = "(FDE) Extended Length"; - createAndCommentData(program, addr, new QWordDataType(), comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, new QWordDataType(), comment, CommentType.EOL); // prog.getMemory().getBytes(addr, extLength); addr = addr.add(QWORD_LEN); curSize += QWORD_LEN; @@ -631,7 +631,7 @@ public class FrameDescriptionEntry extends GccAnalysisClass { String lsdaComment = "(FDE Augmentation Data) LSDA Data Pointer"; createAndCommentData(program, augmentationDataAddr, lsdaDecoder.getDataType(program), - lsdaComment, CodeUnit.EOL_COMMENT); + lsdaComment, CommentType.EOL); if (augmentationDataAddr.equals(lsdaAddr)) { // decoded a reference that returned here -- a null reference diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionRecord.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionRecord.java index ec5ef5f80b..bd41264077 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionRecord.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionRecord.java @@ -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. @@ -20,7 +20,7 @@ import ghidra.app.plugin.exceptionhandlers.gcc.*; import ghidra.app.util.bin.LEB128Info; import ghidra.program.model.address.Address; import ghidra.program.model.data.SignedLeb128DataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.util.task.TaskMonitor; @@ -83,7 +83,7 @@ public class LSDAActionRecord extends GccAnalysisClass { addr = createNextActionRef(addr); SetCommentCmd commentCmd = - new SetCommentCmd(address, CodeUnit.PLATE_COMMENT, "(LSDA) Action Record"); + new SetCommentCmd(address, CommentType.PLATE, "(LSDA) Action Record"); commentCmd.applyTo(program); nextAddress = addr; @@ -98,7 +98,7 @@ public class LSDAActionRecord extends GccAnalysisClass { typeFilter = (int) sleb128.asLong(); createAndCommentData(program, addr, SignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); size += sleb128.getLength(); @@ -120,7 +120,7 @@ public class LSDAActionRecord extends GccAnalysisClass { } createAndCommentData(program, addr, SignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); size += sleb128.getLength(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionTable.java index 3f9798d2d7..94d368ca61 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionTable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAActionTable.java @@ -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. @@ -20,7 +20,7 @@ import java.util.*; import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.app.plugin.exceptionhandlers.gcc.RegionDescriptor; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.util.task.TaskMonitor; @@ -89,7 +89,7 @@ public class LSDAActionTable { nextAddress = address; SetCommentCmd commentCmd = - new SetCommentCmd(tableAddress, CodeUnit.PLATE_COMMENT, "(LSDA) Action Table"); + new SetCommentCmd(tableAddress, CommentType.PLATE, "(LSDA) Action Table"); commentCmd.applyTo(program); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteRecord.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteRecord.java index 0feb54fd4f..c9e98a6cdf 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteRecord.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteRecord.java @@ -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. @@ -21,7 +21,7 @@ import ghidra.app.util.bin.LEB128Info; import ghidra.program.model.address.*; import ghidra.program.model.data.DataType; import ghidra.program.model.data.UnsignedLeb128DataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.symbol.RefType; @@ -96,7 +96,7 @@ public class LSDACallSiteRecord extends GccAnalysisClass { landingPadAddr = lpStart.add(getLandingPadOffset()); SetCommentCmd commentCmd = - new SetCommentCmd(baseAddr, CodeUnit.PLATE_COMMENT, "(LSDA) Call Site Record"); + new SetCommentCmd(baseAddr, CommentType.PLATE, "(LSDA) Call Site Record"); commentCmd.applyTo(program); if (program.getMemory().contains(callSiteBaseAddr)) { @@ -124,7 +124,7 @@ public class LSDACallSiteRecord extends GccAnalysisClass { DataType encodedDt = decoder.getDataType(program); - createAndCommentData(program, addr, encodedDt, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, encodedDt, comment, CommentType.EOL); return addr.add(encodedLen); } @@ -141,7 +141,7 @@ public class LSDACallSiteRecord extends GccAnalysisClass { DataType encodedDt = decoder.getDataType(program); - createAndCommentData(program, addr, encodedDt, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, encodedDt, comment, CommentType.EOL); return addr.add(encodedLen); } @@ -158,7 +158,7 @@ public class LSDACallSiteRecord extends GccAnalysisClass { DataType encodedDt = decoder.getDataType(program); - createAndCommentData(program, addr, encodedDt, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, encodedDt, comment, CommentType.EOL); return addr.add(encodedLen); } @@ -175,7 +175,7 @@ public class LSDACallSiteRecord extends GccAnalysisClass { } createAndCommentData(program, addr, UnsignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); return addr.add(uleb128.getLength()); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteTable.java index 31f0f7347d..26667ae80d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteTable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDACallSiteTable.java @@ -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. @@ -20,7 +20,7 @@ import java.util.*; import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.app.plugin.exceptionhandlers.gcc.*; import ghidra.program.model.address.*; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.util.Msg; @@ -78,7 +78,7 @@ public class LSDACallSiteTable extends GccAnalysisClass { monitor.setMessage("Creating GCC LSDA Call Site Table "); SetCommentCmd commentCmd = - new SetCommentCmd(baseAddr, CodeUnit.PLATE_COMMENT, "(LSDA) Call Site Table"); + new SetCommentCmd(baseAddr, CommentType.PLATE, "(LSDA) Call Site Table"); commentCmd.applyTo(program); Address limit = baseAddr.add(header.getCallSiteTableLength() - 1); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAHeader.java index 1cc294bbc3..1564d93738 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAHeader.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDAHeader.java @@ -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. @@ -21,7 +21,7 @@ import ghidra.app.plugin.exceptionhandlers.gcc.datatype.DwarfEncodingModeDataTyp import ghidra.app.util.bin.LEB128Info; import ghidra.program.model.address.*; import ghidra.program.model.data.*; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.symbol.SourceType; @@ -84,7 +84,7 @@ public class LSDAHeader extends GccAnalysisClass { String comment = "(LSDA) LPStart Encoding"; createAndCommentData(program, addr, new DwarfEncodingModeDataType(), comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); lpStartEncoding = GccAnalysisUtils.readByte(program, addr); curSize += BYTE_LEN; @@ -122,7 +122,7 @@ public class LSDAHeader extends GccAnalysisClass { DataType encodedDt = decoder.getDataType(program); - createAndCommentData(program, addr, encodedDt, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, encodedDt, comment, CommentType.EOL); curSize += encodedLen; return addr.add(encodedLen); @@ -134,7 +134,7 @@ public class LSDAHeader extends GccAnalysisClass { ttypeEncoding = GccAnalysisUtils.readByte(program, addr); createAndCommentData(program, addr, new DwarfEncodingModeDataType(), comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); curSize += BYTE_LEN; return addr.add(BYTE_LEN); @@ -155,7 +155,7 @@ public class LSDAHeader extends GccAnalysisClass { ttypeOffset = uleb128.asLong() + curSize; createAndCommentData(program, addr, UnsignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); return addr.add(uleb128.getLength()); } @@ -165,7 +165,7 @@ public class LSDAHeader extends GccAnalysisClass { callSiteTableEncoding = GccAnalysisUtils.readByte(program, addr); createAndCommentData(program, addr, new DwarfEncodingModeDataType(), comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); curSize += BYTE_LEN; return addr.add(BYTE_LEN); @@ -179,7 +179,7 @@ public class LSDAHeader extends GccAnalysisClass { callSiteTableLength = (int) uleb128.asLong(); createAndCommentData(program, addr, UnsignedLeb128DataType.dataType, comment, - CodeUnit.EOL_COMMENT); + CommentType.EOL); curSize += uleb128.getLength(); return addr.add(uleb128.getLength()); @@ -243,7 +243,7 @@ public class LSDAHeader extends GccAnalysisClass { } SetCommentCmd commentCmd = - new SetCommentCmd(baseAddr, CodeUnit.PLATE_COMMENT, "(LSDA) Exception Table"); + new SetCommentCmd(baseAddr, CommentType.PLATE, "(LSDA) Exception Table"); commentCmd.applyTo(program); nextAddress = addr; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATable.java index 3604b672e1..254dd286b4 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATable.java @@ -18,7 +18,7 @@ package ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttable; import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.app.plugin.exceptionhandlers.gcc.RegionDescriptor; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.util.task.TaskMonitor; @@ -125,7 +125,8 @@ public class LSDATable { } } - SetCommentCmd commentCmd = new SetCommentCmd(baseAdress, CodeUnit.PLATE_COMMENT, "Language-Specific Data Area"); + SetCommentCmd commentCmd = + new SetCommentCmd(baseAdress, CommentType.PLATE, "Language-Specific Data Area"); commentCmd.applyTo(program); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATypeTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATypeTable.java index ff290a3340..595569f91d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATypeTable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/exceptionhandlers/gcc/structures/gccexcepttable/LSDATypeTable.java @@ -1,13 +1,12 @@ /* ### * IP: GHIDRA - * REVIEWED: YES * * 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. @@ -23,7 +22,7 @@ import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.app.plugin.exceptionhandlers.gcc.*; import ghidra.program.model.address.Address; import ghidra.program.model.data.*; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.symbol.RefType; @@ -92,7 +91,7 @@ public class LSDATypeTable extends GccAnalysisClass { typeInfoAddrs.add(typeRef); - createAndCommentData(program, addr, encodedDt, comment, CodeUnit.EOL_COMMENT); + createAndCommentData(program, addr, encodedDt, comment, CommentType.EOL); if (typeRef.getOffset() != 0) { program.getReferenceManager().addMemoryReference(addr, typeRef, RefType.DATA, @@ -102,15 +101,14 @@ public class LSDATypeTable extends GccAnalysisClass { } catch (MemoryAccessException mae) { SetCommentCmd commentCmd = - new SetCommentCmd(addr, CodeUnit.EOL_COMMENT, "Unable to resolve pointer"); + new SetCommentCmd(addr, CommentType.EOL, "Unable to resolve pointer"); commentCmd.applyTo(program); } addr = addr.subtract(stride); } - SetCommentCmd commentCmd = - new SetCommentCmd(top, CodeUnit.PLATE_COMMENT, "(LSDA) Type Table"); + SetCommentCmd commentCmd = new SetCommentCmd(top, CommentType.PLATE, "(LSDA) Type Table"); commentCmd.applyTo(program); nextAddress = bottom.add(1); @@ -124,7 +122,7 @@ public class LSDATypeTable extends GccAnalysisClass { } createAndCommentData(program, addr, new ArrayDataType(new ByteDataType(), incr, 1), - " -- alignment pad", CodeUnit.EOL_COMMENT); + " -- alignment pad", CommentType.EOL); return addr.add(incr); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/EolComments.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/EolComments.java index 27f3c5f16c..47fda9dc55 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/EolComments.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/EolComments.java @@ -118,7 +118,7 @@ public class EolComments { } Collection comments = - Arrays.asList(codeUnit.getCommentAsArray(CodeUnit.REPEATABLE_COMMENT)); + Arrays.asList(codeUnit.getCommentAsArray(CommentType.REPEATABLE)); addStrings(comments, repeatables); } @@ -582,7 +582,7 @@ public class EolComments { Listing listing = program.getListing(); // prefer listing comments first since there may not be a code unit at this address - String repeatable = listing.getComment(CodeUnit.REPEATABLE_COMMENT, address); + String repeatable = listing.getComment(CommentType.REPEATABLE, address); if (repeatable != null) { return StringUtilities.toLines(repeatable); } @@ -597,7 +597,7 @@ public class EolComments { return f.getRepeatableCommentAsArray(); } - return cu.getCommentAsArray(CodeUnit.REPEATABLE_COMMENT); + return cu.getCommentAsArray(CommentType.REPEATABLE); } /** diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/info/NoteGnuProperty.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/info/NoteGnuProperty.java index a525879c1b..2af0abaa94 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/info/NoteGnuProperty.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/info/NoteGnuProperty.java @@ -187,7 +187,7 @@ public class NoteGnuProperty extends ElfNote { DataType elementDT = getElementDataType(dtm, element); Data elementData = DataUtilities.createData(program, address, elementDT, -1, false, ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA); - listing.setComment(address, CodeUnit.EOL_COMMENT, + listing.setComment(address, CommentType.EOL, element.typeName() + "=" + element.value()); address = elementData.getMaxAddress().next(); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.java index 597dcfcbdf..f2813710e4 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.java @@ -129,15 +129,15 @@ public abstract class DataDirectory implements PeMarkupable { } protected void setPlateComment(Program prog, Address addr, String comment) { - prog.getListing().setComment(addr, CodeUnit.PLATE_COMMENT, comment); + prog.getListing().setComment(addr, CommentType.PLATE, comment); } protected void setEolComment(Program prog, Address addr, String comment) { - prog.getListing().setComment(addr, CodeUnit.EOL_COMMENT, comment); + prog.getListing().setComment(addr, CommentType.EOL, comment); } protected void setPreComment(Program prog, Address addr, String comment) { - prog.getListing().setComment(addr, CodeUnit.PRE_COMMENT, comment); + prog.getListing().setComment(addr, CommentType.PRE, comment); } /** diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/tables/CliTableMethodDef.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/tables/CliTableMethodDef.java index 16fc02f907..68b261b54f 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/tables/CliTableMethodDef.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/tables/CliTableMethodDef.java @@ -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. @@ -522,7 +522,7 @@ public class CliTableMethodDef extends CliAbstractTable { data = listing.createData(startAddr, codeDT); // comment the type of code that should appear here - data.setComment(CodeUnit.PRE_COMMENT, + data.setComment(CommentType.PRE, (methodRow.isManaged() ? ".NET CLR Managed Code" : "Native Code")); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/demangler/DemangledAddressTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/demangler/DemangledAddressTable.java index 1a48517322..6838b9b47b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/demangler/DemangledAddressTable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/demangler/DemangledAddressTable.java @@ -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. @@ -99,7 +99,7 @@ public class DemangledAddressTable extends DemangledObject { Msg.warn(this, "Unable to fully apply external demangled Address Table at " + address + ": " + s.getName(true)); - listing.setComment(address, CodeUnit.EOL_COMMENT, + listing.setComment(address, CommentType.EOL, "WARNING: Unable to apply demangled Address Table"); return true; // don't complain } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/exporter/ProgramTextWriter.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/exporter/ProgramTextWriter.java index 4a3d928bd4..597516c9ba 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/exporter/ProgramTextWriter.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/exporter/ProgramTextWriter.java @@ -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. @@ -156,7 +156,7 @@ class ProgramTextWriter { //// Plate Property //////////////////////////////////////////// boolean cuHasPlate = false; if (options.isShowProperties()) { - String[] plate = currentCodeUnit.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] plate = currentCodeUnit.getCommentAsArray(CommentType.PLATE); cuHasPlate = plate != null && plate.length > 0; if (cuHasPlate) { processPlate(currentCodeUnit, plate); @@ -200,7 +200,7 @@ class ProgramTextWriter { //// Pre-Comment /////////////////////////////////////////////// if (options.isShowComments()) { - String[] pre = currentCodeUnit.getCommentAsArray(CodeUnit.PRE_COMMENT); + String[] pre = currentCodeUnit.getCommentAsArray(CommentType.PRE); if (pre != null && pre.length > 0) { String fill = genFill(options.getAddrWidth() + options.getBytesWidth()); for (String element : pre) { @@ -301,7 +301,7 @@ class ProgramTextWriter { //// Post Comment ////////////////////////////////////////////// if (options.isShowComments()) { - String[] post = currentCodeUnit.getCommentAsArray(CodeUnit.POST_COMMENT); + String[] post = currentCodeUnit.getCommentAsArray(CommentType.POST); if (post != null) { String fill = genFill(options.getAddrWidth() + options.getBytesWidth()); for (String element : post) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractPeDebugLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractPeDebugLoader.java index 676197706e..c3ac90448f 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractPeDebugLoader.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractPeDebugLoader.java @@ -482,7 +482,7 @@ abstract class AbstractPeDebugLoader extends AbstractOrdinalSupportLoader { Address address = program.getImageBase().add(dd.getAddressOfRawData()); try { program.getListing().createData(address, new StringDataType(), actualData.length()); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, "Debug Misc"); + program.getListing().setComment(address, CommentType.PLATE, "Debug Misc"); address = address.add(actualData.length()); program.getListing().createData(address, new DWordDataType()); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java index f1f5bec30c..1254cb0e10 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/ElfProgramBuilder.java @@ -545,7 +545,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { comment = Long.toHexString(symbols[index].getValue()); } - cu.setComment(CodeUnit.EOL_COMMENT, comment); + cu.setComment(CommentType.EOL, comment); // Scalar scalar = (Scalar)data.getValue(); // switch ((int)scalar.getValue()) { @@ -837,7 +837,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { } createData(interpStrAddr, TerminatedStringDataType.dataType); - listing.setComment(interpStrAddr, CodeUnit.EOL_COMMENT, "Initial Elf program interpreter"); + listing.setComment(interpStrAddr, CommentType.EOL, "Initial Elf program interpreter"); } private void processImports(TaskMonitor monitor) throws CancelledException { @@ -1230,7 +1230,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { monitor.incrementProgress(1); Data d = array.getComponent(i); - d.setComment(CodeUnit.EOL_COMMENT, programHeaders[i].getComment()); + d.setComment(CommentType.EOL, programHeaders[i].getComment()); if (programHeaders[i].getType() == ElfProgramHeaderConstants.PT_NULL) { continue; } @@ -1301,7 +1301,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { if (type != null) { comment = comment + " - " + type; } - d.setComment(CodeUnit.EOL_COMMENT, comment); + d.setComment(CommentType.EOL, comment); Address sectionAddr = findLoadAddress(sections[i], 0); if (sectionAddr != null) { @@ -1340,7 +1340,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { listing.createData(relocTableAddr, dataType); } else { - listing.setComment(relocTableAddr, CodeUnit.PRE_COMMENT, + listing.setComment(relocTableAddr, CommentType.PRE, "ELF Relocation Table (markup not yet supported)"); } } @@ -2021,14 +2021,14 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { // Add versioned symbol as comment only Address address = s.getAddress(); - String comment = listing.getComment(CodeUnit.PRE_COMMENT, address); + String comment = listing.getComment(CommentType.PRE, address); if (comment == null || comment.length() == 0) { comment = symName; } else { comment += "\n" + symName; } - listing.setComment(address, CodeUnit.PRE_COMMENT, comment); + listing.setComment(address, CommentType.PRE, comment); setElfSymbolAddress(elfSymbol, address); return true; } @@ -2499,21 +2499,21 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { Address addr = hashTableAddr; Data d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "Hash Table - nbucket"); + d.setComment(CommentType.EOL, "Hash Table - nbucket"); long nbucket = d.getScalar(0).getUnsignedValue(); addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "Hash Table - nchain"); + d.setComment(CommentType.EOL, "Hash Table - nchain"); long nchain = d.getScalar(0).getUnsignedValue(); addr = addr.add(d.getLength()); d = listing.createData(addr, new ArrayDataType(dt, (int) nbucket, dt.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "Hash Table - buckets"); + d.setComment(CommentType.EOL, "Hash Table - buckets"); addr = addr.add(d.getLength()); d = listing.createData(addr, new ArrayDataType(dt, (int) nchain, dt.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "Hash Table - chains"); + d.setComment(CommentType.EOL, "Hash Table - chains"); } catch (Exception e) { log("Failed to properly markup Hash table at " + hashTableAddr + ": " + getMessage(e)); @@ -2542,36 +2542,36 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { Address addr = hashTableAddr; Data d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU Hash Table - nbucket"); + d.setComment(CommentType.EOL, "GNU Hash Table - nbucket"); long nbucket = d.getScalar(0).getUnsignedValue(); addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU Hash Table - symbase"); + d.setComment(CommentType.EOL, "GNU Hash Table - symbase"); long symbolBase = d.getScalar(0).getUnsignedValue(); addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU Hash Table - bloom_size"); + d.setComment(CommentType.EOL, "GNU Hash Table - bloom_size"); long bloomSize = d.getScalar(0).getUnsignedValue(); addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU Hash Table - bloom_shift"); + d.setComment(CommentType.EOL, "GNU Hash Table - bloom_shift"); addr = addr.add(d.getLength()); DataType bloomDataType = elf.is64Bit() ? QWordDataType.dataType : DWordDataType.dataType; d = listing.createData(addr, new ArrayDataType(bloomDataType, (int) bloomSize, bloomDataType.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "GNU Hash Table - bloom"); + d.setComment(CommentType.EOL, "GNU Hash Table - bloom"); addr = addr.add(d.getLength()); d = listing.createData(addr, new ArrayDataType(dt, (int) nbucket, dt.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "GNU Hash Table - buckets"); + d.setComment(CommentType.EOL, "GNU Hash Table - buckets"); addr = addr.add(d.getLength()); - listing.setComment(addr, CodeUnit.EOL_COMMENT, "GNU Hash Table - chain"); + listing.setComment(addr, CommentType.EOL, "GNU Hash Table - chain"); // Rely on dynamic symbol table for number of symbols ElfSymbolTable dynamicSymbolTable = elf.getDynamicSymbolTable(); @@ -2612,30 +2612,30 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { // Elf32_Word ngnusyms; // number of entries in chains (and xlat); dynsymcount=symndx+ngnusyms Address addr = hashTableAddr; Data d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - ngnusyms"); + d.setComment(CommentType.EOL, "GNU XHash Table - ngnusyms"); long ngnusyms = d.getScalar(0).getUnsignedValue(); // Elf32_Word nbuckets; // number of hash table buckets addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - nbuckets"); + d.setComment(CommentType.EOL, "GNU XHash Table - nbuckets"); long nbuckets = d.getScalar(0).getUnsignedValue(); // Elf32_Word symndx; // number of initial .dynsym entires skipped in chains[] (and xlat[]) addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - symndx"); + d.setComment(CommentType.EOL, "GNU XHash Table - symndx"); // Elf32_Word maskwords; // number of ElfW(Addr) words in bitmask addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - maskwords"); + d.setComment(CommentType.EOL, "GNU XHash Table - maskwords"); long maskwords = d.getScalar(0).getUnsignedValue(); // Elf32_Word shift2; // bit shift of hashval for second Bloom filter bit addr = addr.add(d.getLength()); d = listing.createData(addr, dt); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - shift2"); + d.setComment(CommentType.EOL, "GNU XHash Table - shift2"); // ElfW(Addr) bitmask[maskwords]; // 2 bit Bloom filter on hashval addr = addr.add(d.getLength()); @@ -2643,22 +2643,22 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { elf.is64Bit() ? QWordDataType.dataType : DWordDataType.dataType; d = listing.createData(addr, new ArrayDataType(bloomDataType, (int) maskwords, bloomDataType.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - bitmask"); + d.setComment(CommentType.EOL, "GNU XHash Table - bitmask"); // Elf32_Word buckets[nbuckets]; // indices into chains[] addr = addr.add(d.getLength()); d = listing.createData(addr, new ArrayDataType(dt, (int) nbuckets, dt.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - buckets"); + d.setComment(CommentType.EOL, "GNU XHash Table - buckets"); // Elf32_Word chains[ngnusyms]; // consecutive hashvals in a given bucket; last entry in chain has LSB set addr = addr.add(d.getLength()); d = listing.createData(addr, new ArrayDataType(dt, (int) ngnusyms, dt.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - chains"); + d.setComment(CommentType.EOL, "GNU XHash Table - chains"); // Elf32_Word xlat[ngnusyms]; // parallel to chains[]; index into .dynsym addr = addr.add(d.getLength()); d = listing.createData(addr, new ArrayDataType(dt, (int) ngnusyms, dt.getLength())); - d.setComment(CodeUnit.EOL_COMMENT, "GNU XHash Table - xlat"); + d.setComment(CommentType.EOL, "GNU XHash Table - xlat"); } catch (Exception e) { log("Failed to properly markup GNU Hash table at " + hashTableAddr + ": " + @@ -2688,7 +2688,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { } Data structData = array.getComponent(i); if (structData != null) { - structData.setComment(CodeUnit.EOL_COMMENT, name); + structData.setComment(CommentType.EOL, name); } } } @@ -2736,7 +2736,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { String comment = dynamicType != null ? (dynamicType.name + " - " + dynamicType.description) : ("DT_0x" + StringUtilities.pad(Integer.toHexString(tagType), '0', 8)); - dynamicData.setComment(CodeUnit.EOL_COMMENT, comment); + dynamicData.setComment(CommentType.EOL, comment); Data valueData = dynamicData.getComponent(1); @@ -2749,7 +2749,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper { if (dynamicStringTable != null) { String str = dynamicStringTable.readString(elf.getReader(), value); if (str != null && str.length() != 0) { - valueData.setComment(CodeUnit.EOL_COMMENT, str); + valueData.setComment(CommentType.EOL, str); } } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java index e47352ed4e..a2aebc7b0e 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java @@ -233,7 +233,7 @@ public class NeLoader extends AbstractOrdinalSupportLoader { buffer.append("Other Flags: " + Conv.toHexString(ib.getOtherFlags()) + "\n"); buffer.append(ib.getOtherFlagsAsString()); - firstCU.setComment(CodeUnit.PLATE_COMMENT, buffer.toString()); + firstCU.setComment(CommentType.PLATE, buffer.toString()); } private void processSegmentTable(MessageLog log, InformationBlock ib, SegmentTable st, @@ -314,7 +314,7 @@ public class NeLoader extends AbstractOrdinalSupportLoader { buff.append((segments[i].isReadOnly() ? TAB + "Read Only" + "\n" : "")); buff.append((segments[i].is32bit() ? TAB + "Use 32 Bit" + "\n" : "")); CodeUnit cu = program.getListing().getCodeUnitAt(addr); - cu.setComment(CodeUnit.PRE_COMMENT, buff.toString()); + cu.setComment(CommentType.PRE, buff.toString()); } for (Segment segment : segments) { @@ -392,7 +392,7 @@ public class NeLoader extends AbstractOrdinalSupportLoader { buf.append("Usage: " + Conv.toHexString(resource.getUsage()) + "\n"); CodeUnit cu = listing.getCodeUnitAt(addr); if (cu != null) { - cu.setComment(CodeUnit.PRE_COMMENT, buf.toString()); + cu.setComment(CommentType.PRE, buf.toString()); } //if this resource is a string table, diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PlateFieldFactory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PlateFieldFactory.java index 91462a129c..ac22c8e826 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PlateFieldFactory.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PlateFieldFactory.java @@ -180,7 +180,7 @@ public class PlateFieldFactory extends FieldFactory { addBlankLines(elements, numberBlankLines, cu); - String[] comments = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] comments = cu.getCommentAsArray(CommentType.PLATE); return generateFormattedPlateComment(elements, comments, offcutComments, cu.getProgram()); } @@ -210,7 +210,7 @@ public class PlateFieldFactory extends FieldFactory { } private String getCommentText(CodeUnit cu, List offcutComments) { - String[] comments = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] comments = cu.getCommentAsArray(CommentType.PLATE); if (comments == null) { return null; } @@ -503,7 +503,7 @@ public class PlateFieldFactory extends FieldFactory { } CodeUnit cu = (CodeUnit) proxyObject; - String[] comments = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] comments = cu.getCommentAsArray(CommentType.PLATE); RowColLocation dataLocation = ((ListingTextField) listingField).screenToDataLocation(row, col); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PostCommentFieldFactory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PostCommentFieldFactory.java index a198097ceb..d2cd6ab2a1 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PostCommentFieldFactory.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PostCommentFieldFactory.java @@ -139,7 +139,7 @@ public class PostCommentFieldFactory extends FieldFactory { String[] autoComment = getAutoPostComment(cu); List offcutComments = CommentUtils.getOffcutComments(cu, CommentType.POST); - String[] comments = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + String[] comments = cu.getCommentAsArray(CommentType.POST); if (comments != null && comments.length > 0 && (cu instanceof Data)) { return getTextField(comments, autoComment, offcutComments, proxy, x, false); } @@ -291,7 +291,7 @@ public class PostCommentFieldFactory extends FieldFactory { } CodeUnit cu = (CodeUnit) obj; - String[] comment = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.POST); int[] cpath = null; if (cu instanceof Data) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PreCommentFieldFactory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PreCommentFieldFactory.java index 840a3988e3..631a9346fe 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PreCommentFieldFactory.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PreCommentFieldFactory.java @@ -130,7 +130,7 @@ public class PreCommentFieldFactory extends FieldFactory { } } - return cu.getCommentAsArray(CodeUnit.PRE_COMMENT); + return cu.getCommentAsArray(CommentType.PRE); } private String[] getAutoPreComments(CodeUnit cu) { @@ -147,7 +147,7 @@ public class PreCommentFieldFactory extends FieldFactory { return null; } CodeUnit cu = (CodeUnit) obj; - String[] comment = cu.getCommentAsArray(CodeUnit.PRE_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.PRE); int[] cpath = null; if (cu instanceof Data) { cpath = ((Data) cu).getComponentPath(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java b/Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java index c0c6688b8b..a97f9bf462 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/program/flatapi/FlatProgramAPI.java @@ -439,8 +439,14 @@ public class FlatProgramAPI { } /** + * Creates a label at the specified address in the global namespace. + * If makePrimary==true, then the new label is made primary. + * @param address the address to create the symbol + * @param name the name of the symbol + * @param makePrimary true if the symbol should be made primary + * @return the newly created code or function symbol + * @throws Exception if there is any exception * @deprecated use {@link #createLabel(Address, String, boolean)} instead. - * Deprecated in Ghidra 7.4 */ @Deprecated(since = "7.4", forRemoval = true) public final Symbol createSymbol(Address address, String name, boolean makePrimary) @@ -534,7 +540,7 @@ public class FlatProgramAPI { * @return true if the PLATE comment was successfully set */ public final boolean setPlateComment(Address address, String comment) { - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.PLATE_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.PLATE, comment); return cmd.applyTo(currentProgram); } @@ -545,7 +551,7 @@ public class FlatProgramAPI { * @return true if the PRE comment was successfully set */ public final boolean setPreComment(Address address, String comment) { - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.PRE_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.PRE, comment); return cmd.applyTo(currentProgram); } @@ -556,7 +562,7 @@ public class FlatProgramAPI { * @return true if the POST comment was successfully set */ public final boolean setPostComment(Address address, String comment) { - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.POST_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.POST, comment); return cmd.applyTo(currentProgram); } @@ -567,7 +573,7 @@ public class FlatProgramAPI { * @return true if the EOL comment was successfully set */ public final boolean setEOLComment(Address address, String comment) { - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.EOL_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.EOL, comment); return cmd.applyTo(currentProgram); } @@ -578,7 +584,7 @@ public class FlatProgramAPI { * @return true if the repeatable comment was successfully set */ public final boolean setRepeatableComment(Address address, String comment) { - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.REPEATABLE_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.REPEATABLE, comment); return cmd.applyTo(currentProgram); } @@ -593,7 +599,7 @@ public class FlatProgramAPI { * @see GhidraScript#getPlateCommentAsRendered(Address) */ public final String getPlateComment(Address address) { - return currentProgram.getListing().getComment(CodeUnit.PLATE_COMMENT, address); + return currentProgram.getListing().getComment(CommentType.PLATE, address); } /** @@ -607,7 +613,7 @@ public class FlatProgramAPI { * @see GhidraScript#getPreCommentAsRendered(Address) */ public final String getPreComment(Address address) { - return currentProgram.getListing().getComment(CodeUnit.PRE_COMMENT, address); + return currentProgram.getListing().getComment(CommentType.PRE, address); } /** @@ -621,7 +627,7 @@ public class FlatProgramAPI { * @see GhidraScript#getPostCommentAsRendered(Address) */ public final String getPostComment(Address address) { - return currentProgram.getListing().getComment(CodeUnit.POST_COMMENT, address); + return currentProgram.getListing().getComment(CommentType.POST, address); } /** @@ -634,7 +640,7 @@ public class FlatProgramAPI { * @see GhidraScript#getEOLCommentAsRendered(Address) */ public final String getEOLComment(Address address) { - return currentProgram.getListing().getComment(CodeUnit.EOL_COMMENT, address); + return currentProgram.getListing().getComment(CommentType.EOL, address); } /** @@ -647,7 +653,7 @@ public class FlatProgramAPI { * @see GhidraScript#getRepeatableCommentAsRendered(Address) */ public final String getRepeatableComment(Address address) { - return currentProgram.getListing().getComment(CodeUnit.REPEATABLE_COMMENT, address); + return currentProgram.getListing().getComment(CommentType.REPEATABLE, address); } /** @@ -889,13 +895,13 @@ public class FlatProgramAPI { Address addr = null; monitor.setMessage("Searching plate comments..."); - addr = findComment(CodeUnit.PLATE_COMMENT, text); + addr = findComment(CommentType.PLATE, text); if (addr != null) { return addr; } monitor.setMessage("Searching pre comments..."); - addr = findComment(CodeUnit.PRE_COMMENT, text); + addr = findComment(CommentType.PRE, text); if (addr != null) { return addr; } @@ -944,19 +950,19 @@ public class FlatProgramAPI { } monitor.setMessage("Searching eol comments..."); - addr = findComment(CodeUnit.EOL_COMMENT, text); + addr = findComment(CommentType.EOL, text); if (addr != null) { return addr; } monitor.setMessage("Searching repeatable comments..."); - addr = findComment(CodeUnit.REPEATABLE_COMMENT, text); + addr = findComment(CommentType.REPEATABLE, text); if (addr != null) { return addr; } monitor.setMessage("Searching post comments..."); - addr = findComment(CodeUnit.POST_COMMENT, text); + addr = findComment(CommentType.POST, text); if (addr != null) { return addr; } @@ -2634,7 +2640,7 @@ public class FlatProgramAPI { return folder; } - private Address findComment(int type, String text) { + private Address findComment(CommentType type, String text) { Listing listing = currentProgram.getListing(); Memory memory = currentProgram.getMemory(); AddressIterator iter = listing.getCommentAddressIterator(type, memory, true); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java b/Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java index 8b4d231d18..4cfc5bb8dc 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java @@ -133,7 +133,7 @@ public class CodeUnitFormat { stringBuffer.append(getOperandRepresentationString(cu, 0)); } if (includeEOLcomment) { - String eolComment = cu.getComment(CodeUnit.EOL_COMMENT); + String eolComment = cu.getComment(CommentType.EOL); if (eolComment != null) { // fixup annotations eolComment = CommentUtils.getDisplayString(eolComment, cu.getProgram()); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/EOLCommentTableColumn.java b/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/EOLCommentTableColumn.java index 00273d9d1b..86f1c39295 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/EOLCommentTableColumn.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/util/table/field/EOLCommentTableColumn.java @@ -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. @@ -18,7 +18,7 @@ package ghidra.util.table.field; import ghidra.docking.settings.Settings; import ghidra.framework.plugintool.ServiceProvider; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.util.*; @@ -58,6 +58,6 @@ public class EOLCommentTableColumn extends return null; } Address address = location.getAddress(); - return program.getListing().getComment(CodeUnit.EOL_COMMENT, address); + return program.getListing().getComment(CommentType.EOL, address); } } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager1Test.java index 552161c9ae..c4949cb63b 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager1Test.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager1Test.java @@ -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. @@ -21,8 +21,7 @@ import org.junit.Test; import ghidra.program.database.ProgramDB; import ghidra.program.database.ProgramModifierListener; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Listing; +import ghidra.program.model.listing.*; /** * Test the merge of the versioned program's listing. @@ -46,11 +45,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -65,11 +64,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -86,11 +85,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -100,11 +99,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -116,11 +115,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -128,11 +127,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -142,11 +141,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -158,11 +157,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -170,11 +169,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -189,11 +188,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -205,11 +204,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -217,11 +216,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -236,11 +235,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -252,11 +251,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -264,11 +263,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -283,11 +282,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -299,11 +298,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -311,11 +310,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -330,11 +329,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -346,11 +345,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -358,11 +357,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -377,11 +376,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -393,11 +392,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -405,11 +404,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -424,11 +423,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -440,11 +439,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -452,11 +451,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -471,11 +470,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -487,11 +486,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -499,11 +498,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -518,11 +517,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -534,11 +533,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -546,11 +545,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -566,15 +565,15 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); assertEquals("Latest Plate Comment" + "\n" + "My Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.getComment(CommentType.PLATE)); assertEquals("Latest Pre Comment" + "\n" + "My Pre Comment", - cu.getComment(CodeUnit.PRE_COMMENT)); + cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); assertEquals("Latest Post Comment" + "\n" + "My Post Comment", - cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.POST)); } @Test @@ -586,11 +585,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -605,11 +604,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -626,11 +625,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -640,11 +639,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -656,11 +655,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -668,11 +667,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -682,11 +681,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -698,11 +697,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -710,11 +709,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -729,11 +728,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -745,11 +744,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -757,11 +756,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -776,11 +775,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -792,11 +791,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -804,11 +803,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } }); @@ -823,11 +822,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -839,11 +838,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -851,11 +850,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -870,11 +869,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -886,11 +885,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -898,11 +897,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -917,11 +916,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -933,11 +932,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -945,11 +944,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -964,11 +963,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -980,11 +979,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -992,11 +991,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -1011,11 +1010,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -1027,11 +1026,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -1039,11 +1038,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -1058,11 +1057,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -1074,11 +1073,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -1086,11 +1085,11 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -1106,15 +1105,15 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); assertEquals("Latest Plate Comment" + "\n" + "My Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.getComment(CommentType.PLATE)); assertEquals("Latest Pre Comment" + "\n" + "My Pre Comment", - cu.getComment(CodeUnit.PRE_COMMENT)); + cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); assertEquals("Latest Post Comment" + "\n" + "My Post Comment", - cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.POST)); } @Test @@ -1141,27 +1140,27 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); assertEquals("Latest Plate Comment" + "\n" + "My Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.getComment(CommentType.PLATE)); assertEquals("Latest Pre Comment" + "\n" + "My Pre Comment", - cu.getComment(CodeUnit.PRE_COMMENT)); + cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); assertEquals("Latest Post Comment" + "\n" + "My Post Comment", - cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x100230d")); assertEquals("Latest Plate Comment" + "\n" + "My Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.getComment(CommentType.PLATE)); assertEquals("Latest Pre Comment" + "\n" + "My Pre Comment", - cu.getComment(CodeUnit.PRE_COMMENT)); + cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); assertEquals("Latest Post Comment" + "\n" + "My Post Comment", - cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.POST)); } @Test @@ -1188,27 +1187,27 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); assertEquals("Latest Plate Comment" + "\n" + "My Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.getComment(CommentType.PLATE)); assertEquals("Latest Pre Comment" + "\n" + "My Pre Comment", - cu.getComment(CodeUnit.PRE_COMMENT)); + cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); assertEquals("Latest Post Comment" + "\n" + "My Post Comment", - cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x100230d")); assertEquals("Latest Plate Comment" + "\n" + "My Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.getComment(CommentType.PLATE)); assertEquals("Latest Pre Comment" + "\n" + "My Pre Comment", - cu.getComment(CodeUnit.PRE_COMMENT)); + cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); assertEquals("Latest Post Comment" + "\n" + "My Post Comment", - cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.POST)); } @Test @@ -1234,18 +1233,18 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -1271,18 +1270,18 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -1308,21 +1307,21 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } private void setupAddDiffCommentUseForAll() throws Exception { @@ -1333,18 +1332,18 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -1352,18 +1351,18 @@ public class CommentMergeManager1Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager2Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager2Test.java index 3d3cf842bf..9d9fcb703d 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager2Test.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/merge/listing/CommentMergeManager2Test.java @@ -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. @@ -31,10 +31,6 @@ import ghidra.program.model.listing.*; */ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { - /** - * - * @param arg0 - */ public CommentMergeManager2Test() { super(); } @@ -48,15 +44,15 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr(program, "0x1001000")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -66,31 +62,31 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { // EOL Comment @ 100283e cu = listing.getCodeUnitAt(addr(program, "0x100283e")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // Pre Comment @ 1002840 cu = listing.getCodeUnitAt(addr(program, "0x1002840")); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); // Post Comment @ 1002843 cu = listing.getCodeUnitAt(addr(program, "0x1002843")); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); + cu.setComment(CommentType.POST, "Post Comment"); // Plate Comment @ 1002847 cu = listing.getCodeUnitAt(addr(program, "0x1002847")); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); // Repeatable Comment @ 100284a cu = listing.getCodeUnitAt(addr(program, "0x100284a")); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); executeMerge(KEEP_LATEST); @@ -100,35 +96,35 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { // EOL Comment @ 100283e assertEquals("EOL Comment", - listing.getCodeUnitAt(addr("0x100283e")).getComment(CodeUnit.EOL_COMMENT)); + listing.getCodeUnitAt(addr("0x100283e")).getComment(CommentType.EOL)); // Pre Comment @ 1002840 assertEquals("Pre Comment", - listing.getCodeUnitAt(addr("0x1002840")).getComment(CodeUnit.PRE_COMMENT)); + listing.getCodeUnitAt(addr("0x1002840")).getComment(CommentType.PRE)); // Post Comment @ 1002843 assertEquals("Post Comment", - listing.getCodeUnitAt(addr("0x1002843")).getComment(CodeUnit.POST_COMMENT)); + listing.getCodeUnitAt(addr("0x1002843")).getComment(CommentType.POST)); // Plate Comment @ 1002847 assertEquals("Plate Comment", - listing.getCodeUnitAt(addr("0x1002847")).getComment(CodeUnit.PLATE_COMMENT)); + listing.getCodeUnitAt(addr("0x1002847")).getComment(CommentType.PLATE)); // Repeatable Comment @ 100284a assertEquals("Repeatable Comment", - listing.getCodeUnitAt(addr("0x100284a")).getComment(CodeUnit.REPEATABLE_COMMENT)); + listing.getCodeUnitAt(addr("0x100284a")).getComment(CommentType.REPEATABLE)); // Latest has comment assertEquals("EOL Comment", - listing.getCodeUnitAt(addr("0x1001000")).getComment(CodeUnit.EOL_COMMENT)); + listing.getCodeUnitAt(addr("0x1001000")).getComment(CommentType.EOL)); // Conflicts become latest comments @ 10028b1 CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); } @Test @@ -140,15 +136,15 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr(program, "0x1001000")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -158,31 +154,31 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { // EOL Comment @ 100283e cu = listing.getCodeUnitAt(addr(program, "0x100283e")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // Pre Comment @ 1002840 cu = listing.getCodeUnitAt(addr(program, "0x1002840")); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); // Post Comment @ 1002843 cu = listing.getCodeUnitAt(addr(program, "0x1002843")); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); + cu.setComment(CommentType.POST, "Post Comment"); // Plate Comment @ 1002847 cu = listing.getCodeUnitAt(addr(program, "0x1002847")); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); // Repeatable Comment @ 100284a cu = listing.getCodeUnitAt(addr(program, "0x100284a")); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -193,35 +189,35 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { // EOL Comment @ 100283e assertEquals("EOL Comment", - listing.getCodeUnitAt(addr("0x100283e")).getComment(CodeUnit.EOL_COMMENT)); + listing.getCodeUnitAt(addr("0x100283e")).getComment(CommentType.EOL)); // Pre Comment @ 1002840 assertEquals("Pre Comment", - listing.getCodeUnitAt(addr("0x1002840")).getComment(CodeUnit.PRE_COMMENT)); + listing.getCodeUnitAt(addr("0x1002840")).getComment(CommentType.PRE)); // Post Comment @ 1002843 assertEquals("Post Comment", - listing.getCodeUnitAt(addr("0x1002843")).getComment(CodeUnit.POST_COMMENT)); + listing.getCodeUnitAt(addr("0x1002843")).getComment(CommentType.POST)); // Plate Comment @ 1002847 assertEquals("Plate Comment", - listing.getCodeUnitAt(addr("0x1002847")).getComment(CodeUnit.PLATE_COMMENT)); + listing.getCodeUnitAt(addr("0x1002847")).getComment(CommentType.PLATE)); // Repeatable Comment @ 100284a assertEquals("Repeatable Comment", - listing.getCodeUnitAt(addr("0x100284a")).getComment(CodeUnit.REPEATABLE_COMMENT)); + listing.getCodeUnitAt(addr("0x100284a")).getComment(CommentType.REPEATABLE)); // Latest has comment assertEquals("EOL Comment", - listing.getCodeUnitAt(addr("0x1001000")).getComment(CodeUnit.EOL_COMMENT)); + listing.getCodeUnitAt(addr("0x1001000")).getComment(CommentType.EOL)); // Conflicts become my comments @ 10028b1 CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); } @Test @@ -233,15 +229,15 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr(program, "0x1001000")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -251,31 +247,31 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { // EOL Comment @ 100283e cu = listing.getCodeUnitAt(addr(program, "0x100283e")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // Pre Comment @ 1002840 cu = listing.getCodeUnitAt(addr(program, "0x1002840")); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); // Post Comment @ 1002843 cu = listing.getCodeUnitAt(addr(program, "0x1002843")); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); + cu.setComment(CommentType.POST, "Post Comment"); // Plate Comment @ 1002847 cu = listing.getCodeUnitAt(addr(program, "0x1002847")); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); // Repeatable Comment @ 100284a cu = listing.getCodeUnitAt(addr(program, "0x100284a")); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); executeMerge(KEEP_BOTH); @@ -284,42 +280,42 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); // EOL Comment @ 100283e - assertEquals(listing.getCodeUnitAt(addr("0x100283e")).getComment(CodeUnit.EOL_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x100283e")).getComment(CommentType.EOL), "EOL Comment"); // Pre Comment @ 1002840 - assertEquals(listing.getCodeUnitAt(addr("0x1002840")).getComment(CodeUnit.PRE_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1002840")).getComment(CommentType.PRE), "Pre Comment"); // Post Comment @ 1002843 - assertEquals(listing.getCodeUnitAt(addr("0x1002843")).getComment(CodeUnit.POST_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1002843")).getComment(CommentType.POST), "Post Comment"); // Plate Comment @ 1002847 - assertEquals(listing.getCodeUnitAt(addr("0x1002847")).getComment(CodeUnit.PLATE_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1002847")).getComment(CommentType.PLATE), "Plate Comment"); // Repeatable Comment @ 100284a assertEquals( - listing.getCodeUnitAt(addr("0x100284a")).getComment(CodeUnit.REPEATABLE_COMMENT), + listing.getCodeUnitAt(addr("0x100284a")).getComment(CommentType.REPEATABLE), "Repeatable Comment"); // Latest has comment - assertEquals(listing.getCodeUnitAt(addr("0x1001000")).getComment(CodeUnit.EOL_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1001000")).getComment(CommentType.EOL), "EOL Comment"); // Conflicts become combined comments @ 10028b1 CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.EOL)); assertEquals("Latest Pre Comment" + "\n" + "My Pre Comment", - cu.getComment(CodeUnit.PRE_COMMENT)); + cu.getComment(CommentType.PRE)); assertEquals("Latest Post Comment" + "\n" + "My Post Comment", - cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.POST)); assertEquals("Latest Plate Comment" + "\n" + "My Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.getComment(CommentType.PLATE)); assertEquals("Latest Repeatable Comment" + "\n" + "My Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); } @Test @@ -331,15 +327,15 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr(program, "0x1001000")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -349,31 +345,31 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { // EOL Comment @ 100283e cu = listing.getCodeUnitAt(addr(program, "0x100283e")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); // Pre Comment @ 1002840 cu = listing.getCodeUnitAt(addr(program, "0x1002840")); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); // Post Comment @ 1002843 cu = listing.getCodeUnitAt(addr(program, "0x1002843")); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); + cu.setComment(CommentType.POST, "Post Comment"); // Plate Comment @ 1002847 cu = listing.getCodeUnitAt(addr(program, "0x1002847")); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); // Repeatable Comment @ 100284a cu = listing.getCodeUnitAt(addr(program, "0x100284a")); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); // All comments @ 10028b1 cu = listing.getCodeUnitAt(addr(program, "0x10028b1")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -388,38 +384,38 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); // EOL Comment @ 100283e - assertEquals(listing.getCodeUnitAt(addr("0x100283e")).getComment(CodeUnit.EOL_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x100283e")).getComment(CommentType.EOL), "EOL Comment"); // Pre Comment @ 1002840 - assertEquals(listing.getCodeUnitAt(addr("0x1002840")).getComment(CodeUnit.PRE_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1002840")).getComment(CommentType.PRE), "Pre Comment"); // Post Comment @ 1002843 - assertEquals(listing.getCodeUnitAt(addr("0x1002843")).getComment(CodeUnit.POST_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1002843")).getComment(CommentType.POST), "Post Comment"); // Plate Comment @ 1002847 - assertEquals(listing.getCodeUnitAt(addr("0x1002847")).getComment(CodeUnit.PLATE_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1002847")).getComment(CommentType.PLATE), "Plate Comment"); // Repeatable Comment @ 100284a assertEquals( - listing.getCodeUnitAt(addr("0x100284a")).getComment(CodeUnit.REPEATABLE_COMMENT), + listing.getCodeUnitAt(addr("0x100284a")).getComment(CommentType.REPEATABLE), "Repeatable Comment"); // Latest has comment - assertEquals(listing.getCodeUnitAt(addr("0x1001000")).getComment(CodeUnit.EOL_COMMENT), + assertEquals(listing.getCodeUnitAt(addr("0x1001000")).getComment(CommentType.EOL), "EOL Comment"); // Conflicts become latest comments @ 10028b1 CodeUnit cu = listing.getCodeUnitAt(addr("0x10028b1")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); assertEquals("Latest EOL Comment" + "\n" + "My EOL Comment", - cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -428,6 +424,7 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { @Override public void modifyLatest(ProgramDB program) { + // do nothing } @Override @@ -435,11 +432,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } }); @@ -449,11 +446,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); - assertNull(cu.getComment(CodeUnit.PRE_COMMENT)); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); - assertNull(cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); + assertNull(cu.getComment(CommentType.PRE)); + assertNull(cu.getComment(CommentType.EOL)); + assertNull(cu.getComment(CommentType.REPEATABLE)); + assertNull(cu.getComment(CommentType.POST)); } @Test @@ -465,15 +462,16 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } @Override public void modifyPrivate(ProgramDB program) { + // do nothing } }); @@ -483,11 +481,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); - assertNull(cu.getComment(CodeUnit.PRE_COMMENT)); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); - assertNull(cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); + assertNull(cu.getComment(CommentType.PRE)); + assertNull(cu.getComment(CommentType.EOL)); + assertNull(cu.getComment(CommentType.REPEATABLE)); + assertNull(cu.getComment(CommentType.POST)); } @Test @@ -499,11 +497,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } @Override @@ -511,11 +509,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } }); @@ -525,11 +523,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); - assertNull(cu.getComment(CodeUnit.PRE_COMMENT)); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); - assertNull(cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); + assertNull(cu.getComment(CommentType.PRE)); + assertNull(cu.getComment(CommentType.EOL)); + assertNull(cu.getComment(CommentType.REPEATABLE)); + assertNull(cu.getComment(CommentType.POST)); } @Test @@ -541,11 +539,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -553,11 +551,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } }); @@ -572,11 +570,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -588,11 +586,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -600,11 +598,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } }); @@ -619,11 +617,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); - assertNull(cu.getComment(CodeUnit.PRE_COMMENT)); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); - assertNull(cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); + assertNull(cu.getComment(CommentType.PRE)); + assertNull(cu.getComment(CommentType.EOL)); + assertNull(cu.getComment(CommentType.REPEATABLE)); + assertNull(cu.getComment(CommentType.POST)); } @Test @@ -635,11 +633,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } @Override @@ -647,11 +645,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -666,11 +664,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); - assertNull(cu.getComment(CodeUnit.PRE_COMMENT)); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); - assertNull(cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); + assertNull(cu.getComment(CommentType.PRE)); + assertNull(cu.getComment(CommentType.EOL)); + assertNull(cu.getComment(CommentType.REPEATABLE)); + assertNull(cu.getComment(CommentType.POST)); } @Test @@ -682,11 +680,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, null); - cu.setComment(CodeUnit.PRE_COMMENT, null); - cu.setComment(CodeUnit.POST_COMMENT, null); - cu.setComment(CodeUnit.PLATE_COMMENT, null); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, null); + cu.setComment(CommentType.EOL, null); + cu.setComment(CommentType.PRE, null); + cu.setComment(CommentType.POST, null); + cu.setComment(CommentType.PLATE, null); + cu.setComment(CommentType.REPEATABLE, null); } @Override @@ -694,11 +692,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x100230d")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -713,11 +711,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x100230d")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -729,17 +727,17 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x1008606")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x1008607")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); } @Override @@ -747,17 +745,17 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x1008607")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable Comment"); + cu.setComment(CommentType.EOL, "EOL Comment"); + cu.setComment(CommentType.PRE, "Pre Comment"); + cu.setComment(CommentType.POST, "Post Comment"); + cu.setComment(CommentType.PLATE, "Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x1008608")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -767,23 +765,23 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x1008606")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x1008607")); - assertEquals("Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Post Comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x1008608")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -795,23 +793,23 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x1008606")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x1008607")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x1008608")); - cu.setComment(CodeUnit.EOL_COMMENT, "Latest EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "Latest Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "Latest Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Latest Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Latest Repeatable Comment"); + cu.setComment(CommentType.EOL, "Latest EOL Comment"); + cu.setComment(CommentType.PRE, "Latest Pre Comment"); + cu.setComment(CommentType.POST, "Latest Post Comment"); + cu.setComment(CommentType.PLATE, "Latest Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override @@ -819,23 +817,23 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x1008606")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x1008607")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); cu = listing.getCodeUnitAt(addr(program, "0x1008608")); - cu.setComment(CodeUnit.EOL_COMMENT, "My EOL Comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "My Pre Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post Comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "My Repeatable Comment"); + cu.setComment(CommentType.EOL, "My EOL Comment"); + cu.setComment(CommentType.PRE, "My Pre Comment"); + cu.setComment(CommentType.POST, "My Post Comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -864,25 +862,25 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = resultProgram.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("0x1008606")); - assertEquals("Latest Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("Latest Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Latest Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("Latest Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x1008607")); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("My EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("My Repeatable Comment", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("My Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("My EOL Comment", cu.getComment(CommentType.EOL)); + assertEquals("My Repeatable Comment", cu.getComment(CommentType.REPEATABLE)); + assertEquals("My Post Comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr("0x1008608")); assertEquals("Latest Plate Comment\nMy Plate Comment", - cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("Latest Pre Comment\nMy Pre Comment", cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("Latest EOL Comment\nMy EOL Comment", cu.getComment(CodeUnit.EOL_COMMENT)); + cu.getComment(CommentType.PLATE)); + assertEquals("Latest Pre Comment\nMy Pre Comment", cu.getComment(CommentType.PRE)); + assertEquals("Latest EOL Comment\nMy EOL Comment", cu.getComment(CommentType.EOL)); assertEquals("Latest Repeatable Comment\nMy Repeatable Comment", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); - assertEquals("Latest Post Comment\nMy Post Comment", cu.getComment(CodeUnit.POST_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); + assertEquals("Latest Post Comment\nMy Post Comment", cu.getComment(CommentType.POST)); } @Test @@ -894,11 +892,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10065e3")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre"); - cu.setComment(CodeUnit.POST_COMMENT, "Post"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable"); + cu.setComment(CommentType.EOL, "EOL"); + cu.setComment(CommentType.PRE, "Pre"); + cu.setComment(CommentType.POST, "Post"); + cu.setComment(CommentType.PLATE, "Plate"); + cu.setComment(CommentType.REPEATABLE, "Repeatable"); createData(program, "0x10065e8", new DWordDataType()); } @@ -910,11 +908,11 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x10065e9")); - cu.setComment(CodeUnit.EOL_COMMENT, "EOL2"); - cu.setComment(CodeUnit.PRE_COMMENT, "Pre2"); - cu.setComment(CodeUnit.POST_COMMENT, "Post2"); - cu.setComment(CodeUnit.PLATE_COMMENT, "Plate2"); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "Repeatable2"); + cu.setComment(CommentType.EOL, "EOL2"); + cu.setComment(CommentType.PRE, "Pre2"); + cu.setComment(CommentType.POST, "Post2"); + cu.setComment(CommentType.PLATE, "Plate2"); + cu.setComment(CommentType.REPEATABLE, "Repeatable2"); } }); @@ -928,23 +926,23 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { assertEquals(addr("0x10065e2"), cu.getMinAddress()); assertEquals(4, cu.getLength()); assertTrue(((Data) cu).getDataType().isEquivalent(new FloatDataType())); - assertEquals("EOL", listing.getComment(CodeUnit.EOL_COMMENT, addr("0x10065e3"))); - assertEquals("Pre", listing.getComment(CodeUnit.PRE_COMMENT, addr("0x10065e3"))); - assertEquals("Post", listing.getComment(CodeUnit.POST_COMMENT, addr("0x10065e3"))); - assertEquals("Plate", listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x10065e3"))); + assertEquals("EOL", listing.getComment(CommentType.EOL, addr("0x10065e3"))); + assertEquals("Pre", listing.getComment(CommentType.PRE, addr("0x10065e3"))); + assertEquals("Post", listing.getComment(CommentType.POST, addr("0x10065e3"))); + assertEquals("Plate", listing.getComment(CommentType.PLATE, addr("0x10065e3"))); assertEquals("Repeatable", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x10065e3"))); + listing.getComment(CommentType.REPEATABLE, addr("0x10065e3"))); cu = listing.getCodeUnitContaining(addr("0x10065e9")); assertEquals(addr("0x10065e8"), cu.getMinAddress()); assertEquals(4, cu.getLength()); assertTrue(((Data) cu).getDataType().isEquivalent(new DWordDataType())); - assertEquals("EOL2", listing.getComment(CodeUnit.EOL_COMMENT, addr("0x10065e9"))); - assertEquals("Pre2", listing.getComment(CodeUnit.PRE_COMMENT, addr("0x10065e9"))); - assertEquals("Post2", listing.getComment(CodeUnit.POST_COMMENT, addr("0x10065e9"))); - assertEquals("Plate2", listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x10065e9"))); + assertEquals("EOL2", listing.getComment(CommentType.EOL, addr("0x10065e9"))); + assertEquals("Pre2", listing.getComment(CommentType.PRE, addr("0x10065e9"))); + assertEquals("Post2", listing.getComment(CommentType.POST, addr("0x10065e9"))); + assertEquals("Plate2", listing.getComment(CommentType.PLATE, addr("0x10065e9"))); assertEquals("Repeatable2", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x10065e9"))); + listing.getComment(CommentType.REPEATABLE, addr("0x10065e9"))); } @Test @@ -954,15 +952,13 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { @Override public void modifyLatest(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.EOL_COMMENT, - "New EOL Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PRE_COMMENT, - "New Pre Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.POST_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.EOL, "New EOL Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.PRE, "New Pre Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.POST, "New Post Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PLATE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.PLATE, "New Plate Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.REPEATABLE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.REPEATABLE, "New Repeatable Comment"); } @@ -984,14 +980,14 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { assertEquals(addr("0x100203f"), cu.getMinAddress()); assertEquals(2, cu.getLength()); assertTrue(cu instanceof Instruction); - assertEquals("New EOL Comment", listing.getComment(CodeUnit.EOL_COMMENT, addr("0x1002040"))); - assertEquals("New Pre Comment", listing.getComment(CodeUnit.PRE_COMMENT, addr("0x1002040"))); + assertEquals("New EOL Comment", listing.getComment(CommentType.EOL, addr("0x1002040"))); + assertEquals("New Pre Comment", listing.getComment(CommentType.PRE, addr("0x1002040"))); assertEquals("New Post Comment", - listing.getComment(CodeUnit.POST_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.POST, addr("0x1002040"))); assertEquals("New Plate Comment", - listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.PLATE, addr("0x1002040"))); assertEquals("New Repeatable Comment", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.REPEATABLE, addr("0x1002040"))); } @Test @@ -1008,15 +1004,13 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { @Override public void modifyPrivate(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.EOL_COMMENT, - "New EOL Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PRE_COMMENT, - "New Pre Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.POST_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.EOL, "New EOL Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.PRE, "New Pre Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.POST, "New Post Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PLATE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.PLATE, "New Plate Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.REPEATABLE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.REPEATABLE, "New Repeatable Comment"); } }); @@ -1031,14 +1025,14 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { assertEquals(addr("0x100203f"), cu.getMinAddress()); assertEquals(2, cu.getLength()); assertTrue(cu instanceof Instruction); - assertEquals("New EOL Comment", listing.getComment(CodeUnit.EOL_COMMENT, addr("0x1002040"))); - assertEquals("New Pre Comment", listing.getComment(CodeUnit.PRE_COMMENT, addr("0x1002040"))); + assertEquals("New EOL Comment", listing.getComment(CommentType.EOL, addr("0x1002040"))); + assertEquals("New Pre Comment", listing.getComment(CommentType.PRE, addr("0x1002040"))); assertEquals("New Post Comment", - listing.getComment(CodeUnit.POST_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.POST, addr("0x1002040"))); assertEquals("New Plate Comment", - listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.PLATE, addr("0x1002040"))); assertEquals("New Repeatable Comment", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.REPEATABLE, addr("0x1002040"))); } @Test @@ -1048,13 +1042,13 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { @Override public void modifyLatest(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.EOL_COMMENT, null); + listing.setComment(addr(program, "0x1002040"), CommentType.EOL, null); } @Override public void modifyPrivate(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PRE_COMMENT, null); + listing.setComment(addr(program, "0x1002040"), CommentType.PRE, null); disassemble(program, new AddressSet(addr(program, "0x100203e"), addr(program, "0x1002043")), false); @@ -1071,12 +1065,12 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { assertEquals(addr("0x100203f"), cu.getMinAddress()); assertEquals(2, cu.getLength()); assertTrue(cu instanceof Instruction); - assertNull(listing.getComment(CodeUnit.EOL_COMMENT, addr("0x1002040"))); - assertNull(listing.getComment(CodeUnit.PRE_COMMENT, addr("0x1002040"))); - assertEquals("Post in P1.", listing.getComment(CodeUnit.POST_COMMENT, addr("0x1002040"))); - assertEquals("Plate in P1.", listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x1002040"))); + assertNull(listing.getComment(CommentType.EOL, addr("0x1002040"))); + assertNull(listing.getComment(CommentType.PRE, addr("0x1002040"))); + assertEquals("Post in P1.", listing.getComment(CommentType.POST, addr("0x1002040"))); + assertEquals("Plate in P1.", listing.getComment(CommentType.PLATE, addr("0x1002040"))); assertEquals("Repeatable in P1.", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.REPEATABLE, addr("0x1002040"))); } @Test @@ -1086,7 +1080,7 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { @Override public void modifyLatest(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.POST_COMMENT, null); + listing.setComment(addr(program, "0x1002040"), CommentType.POST, null); disassemble(program, new AddressSet(addr(program, "0x100203e"), addr(program, "0x1002043")), false); @@ -1095,7 +1089,7 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { @Override public void modifyPrivate(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PLATE_COMMENT, null); + listing.setComment(addr(program, "0x1002040"), CommentType.PLATE, null); } }); @@ -1109,12 +1103,12 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { assertEquals(addr("0x100203f"), cu.getMinAddress()); assertEquals(2, cu.getLength()); assertTrue(cu instanceof Instruction); - assertEquals("EOL in P1.", listing.getComment(CodeUnit.EOL_COMMENT, addr("0x1002040"))); - assertEquals("Pre in P1.", listing.getComment(CodeUnit.PRE_COMMENT, addr("0x1002040"))); - assertNull(listing.getComment(CodeUnit.POST_COMMENT, addr("0x1002040"))); - assertNull(listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x1002040"))); + assertEquals("EOL in P1.", listing.getComment(CommentType.EOL, addr("0x1002040"))); + assertEquals("Pre in P1.", listing.getComment(CommentType.PRE, addr("0x1002040"))); + assertNull(listing.getComment(CommentType.POST, addr("0x1002040"))); + assertNull(listing.getComment(CommentType.PLATE, addr("0x1002040"))); assertEquals("Repeatable in P1.", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.REPEATABLE, addr("0x1002040"))); } @Test @@ -1124,30 +1118,27 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { @Override public void modifyLatest(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.EOL_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.EOL, "Latest EOL Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PRE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.PRE, "Latest Pre Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.POST_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.POST, "Latest Post Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PLATE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.PLATE, "New Plate Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.REPEATABLE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.REPEATABLE, "New Repeatable Comment"); } @Override public void modifyPrivate(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.EOL_COMMENT, - "My EOL Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PRE_COMMENT, - "My Pre Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.POST_COMMENT, - "My Post Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PLATE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.EOL, "My EOL Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.PRE, "My Pre Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.POST, "My Post Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.PLATE, "New Plate Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.REPEATABLE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.REPEATABLE, "New Repeatable Comment"); disassemble(program, new AddressSet(addr(program, "0x100203e"), addr(program, "0x1002043")), @@ -1168,15 +1159,15 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { assertEquals(addr("0x100203f"), cu.getMinAddress()); assertEquals(2, cu.getLength()); assertTrue(cu instanceof Instruction); - assertEquals("My EOL Comment", listing.getComment(CodeUnit.EOL_COMMENT, addr("0x1002040"))); + assertEquals("My EOL Comment", listing.getComment(CommentType.EOL, addr("0x1002040"))); assertEquals("Latest Pre Comment", - listing.getComment(CodeUnit.PRE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.PRE, addr("0x1002040"))); assertEquals("Latest Post Comment\nMy Post Comment", - listing.getComment(CodeUnit.POST_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.POST, addr("0x1002040"))); assertEquals("New Plate Comment", - listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.PLATE, addr("0x1002040"))); assertEquals("New Repeatable Comment", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.REPEATABLE, addr("0x1002040"))); } @Test @@ -1189,30 +1180,25 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { disassemble(program, new AddressSet(addr(program, "0x100203e"), addr(program, "0x1002043")), false); - listing.setComment(addr(program, "0x1002040"), CodeUnit.EOL_COMMENT, - "New EOL Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PRE_COMMENT, - "New Pre Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.POST_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.EOL, "New EOL Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.PRE, "New Pre Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.POST, "Latest Post Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PLATE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.PLATE, "Latest Plate Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.REPEATABLE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.REPEATABLE, "Latest Repeatable Comment"); } @Override public void modifyPrivate(ProgramDB program) { Listing listing = program.getListing(); - listing.setComment(addr(program, "0x1002040"), CodeUnit.EOL_COMMENT, - "New EOL Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PRE_COMMENT, - "New Pre Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.POST_COMMENT, - "My Post Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.PLATE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.EOL, "New EOL Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.PRE, "New Pre Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.POST, "My Post Comment"); + listing.setComment(addr(program, "0x1002040"), CommentType.PLATE, "My Plate Comment"); - listing.setComment(addr(program, "0x1002040"), CodeUnit.REPEATABLE_COMMENT, + listing.setComment(addr(program, "0x1002040"), CommentType.REPEATABLE, "My Repeatable Comment"); } }); @@ -1230,14 +1216,14 @@ public class CommentMergeManager2Test extends AbstractListingMergeManagerTest { assertEquals(addr("0x100203f"), cu.getMinAddress()); assertEquals(2, cu.getLength()); assertTrue(cu instanceof Instruction); - assertEquals("New EOL Comment", listing.getComment(CodeUnit.EOL_COMMENT, addr("0x1002040"))); - assertEquals("New Pre Comment", listing.getComment(CodeUnit.PRE_COMMENT, addr("0x1002040"))); + assertEquals("New EOL Comment", listing.getComment(CommentType.EOL, addr("0x1002040"))); + assertEquals("New Pre Comment", listing.getComment(CommentType.PRE, addr("0x1002040"))); assertEquals("Latest Post Comment\nMy Post Comment", - listing.getComment(CodeUnit.POST_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.POST, addr("0x1002040"))); assertEquals("Latest Plate Comment", - listing.getComment(CodeUnit.PLATE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.PLATE, addr("0x1002040"))); assertEquals("My Repeatable Comment", - listing.getComment(CodeUnit.REPEATABLE_COMMENT, addr("0x1002040"))); + listing.getComment(CommentType.REPEATABLE, addr("0x1002040"))); } } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/clipboard/CopyPasteCommentsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/clipboard/CopyPasteCommentsTest.java index bfe29d65b0..8ee73a4066 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/clipboard/CopyPasteCommentsTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/clipboard/CopyPasteCommentsTest.java @@ -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. @@ -538,7 +538,7 @@ public class CopyPasteCommentsTest extends AbstractProgramBasedTest { // in Browser(1) add a pre comment at 331 CodeUnit cu = programOne.getListing().getCodeUnitAt(addr(programOne, 0x331)); int transactionID = programOne.startTransaction("test"); - cu.setComment(CodeUnit.PRE_COMMENT, "my pre comment for this test"); + cu.setComment(CommentType.PRE, "my pre comment for this test"); programOne.endTransaction(transactionID, true); waitForSwing(); @@ -572,7 +572,7 @@ public class CopyPasteCommentsTest extends AbstractProgramBasedTest { // verify pre comment at 331 remains unaffected cu = programOne.getListing().getCodeUnitAt(addr(programOne, 0x331)); - assertEquals("my pre comment for this test", cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals("my pre comment for this test", cu.getComment(CommentType.PRE)); // verify browser field @@ -649,18 +649,18 @@ public class CopyPasteCommentsTest extends AbstractProgramBasedTest { // verify comments are copied CodeUnit cu = listing.getCodeUnitAt(addr(programOne, 0x0320)); - assertEquals("My Plate Comment", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("My Post comment", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("My Plate Comment", cu.getComment(CommentType.PLATE)); + assertEquals("My Post comment", cu.getComment(CommentType.POST)); cu = listing.getCodeUnitAt(addr(programOne, 0x326)); - assertEquals("More Plate Comments (1)", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("More Post comments (1)", cu.getComment(CodeUnit.POST_COMMENT)); - assertEquals("More EOL comments (1)", cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("More Plate Comments (1)", cu.getComment(CommentType.PLATE)); + assertEquals("More Post comments (1)", cu.getComment(CommentType.POST)); + assertEquals("More EOL comments (1)", cu.getComment(CommentType.EOL)); cu = listing.getCodeUnitAt(addr(programOne, 0x32a)); - assertEquals("More Plate Comments (2)", cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("More Post comments (2)", cu.getComment(CodeUnit.POST_COMMENT)); - assertEquals("More EOL comments (2)", cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("More Plate Comments (2)", cu.getComment(CommentType.PLATE)); + assertEquals("More Post comments (2)", cu.getComment(CommentType.POST)); + assertEquals("More EOL comments (2)", cu.getComment(CommentType.EOL)); cb.goToField(addr(programOne, 0x0320), PlateFieldFactory.FIELD_NAME, 0, 0); ListingTextField f = (ListingTextField) cb.getCurrentField(); @@ -708,7 +708,7 @@ public class CopyPasteCommentsTest extends AbstractProgramBasedTest { Address addr = addr(programOne, 0x334); for (String element : comments) { CodeUnit cu = listing.getCodeUnitAt(addr); - assertEquals(element, cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals(element, cu.getComment(CommentType.EOL)); assertTrue(cb.goToField(addr, EolCommentFieldFactory.FIELD_NAME, 0, 0)); ListingTextField f = (ListingTextField) cb.getCurrentField(); assertEquals(element, f.getText()); @@ -791,18 +791,18 @@ public class CopyPasteCommentsTest extends AbstractProgramBasedTest { function.setComment("my function comment"); // add some Plate, Pre, and Post comments within this function. CodeUnit cu = listing.getCodeUnitAt(addr(programTwo, 0x0320)); - cu.setComment(CodeUnit.PLATE_COMMENT, "My Plate Comment"); - cu.setComment(CodeUnit.POST_COMMENT, "My Post comment"); + cu.setComment(CommentType.PLATE, "My Plate Comment"); + cu.setComment(CommentType.POST, "My Post comment"); cu = listing.getCodeUnitAt(addr(programTwo, 0x326)); - cu.setComment(CodeUnit.PLATE_COMMENT, "More Plate Comments (1)"); - cu.setComment(CodeUnit.POST_COMMENT, "More Post comments (1)"); - cu.setComment(CodeUnit.EOL_COMMENT, "More EOL comments (1)"); + cu.setComment(CommentType.PLATE, "More Plate Comments (1)"); + cu.setComment(CommentType.POST, "More Post comments (1)"); + cu.setComment(CommentType.EOL, "More EOL comments (1)"); cu = listing.getCodeUnitAt(addr(programTwo, 0x32a)); - cu.setComment(CodeUnit.PLATE_COMMENT, "More Plate Comments (2)"); - cu.setComment(CodeUnit.POST_COMMENT, "More Post comments (2)"); - cu.setComment(CodeUnit.EOL_COMMENT, "More EOL comments (2)"); + cu.setComment(CommentType.PLATE, "More Plate Comments (2)"); + cu.setComment(CommentType.POST, "More Post comments (2)"); + cu.setComment(CommentType.EOL, "More EOL comments (2)"); // Edit the label at 0x32d (RSR05) and make it part of a scope Symbol symbol = getUniqueSymbol(programTwo, "RSR05", null); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java index e812946360..99af5a6bc3 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java @@ -595,7 +595,7 @@ public class CodeBrowserOptionsTest extends AbstractGhidraHeadedIntegrationTest cb.goToField(callAddress, "Bytes", 0, 0); - SetCommentCmd eolCmd = new SetCommentCmd(callAddress, CodeUnit.EOL_COMMENT, + SetCommentCmd eolCmd = new SetCommentCmd(callAddress, CommentType.EOL, "a bb ccc dddd eeeee ffff ggg hhh ii j k ll mmm nnn oooo " + "ppppp qqqq rrrr ssss tttt uuuuu vvvvvv wwwww\n\n\n\n" + "AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM NNN OOO PPP QQQ " + @@ -604,7 +604,7 @@ public class CodeBrowserOptionsTest extends AbstractGhidraHeadedIntegrationTest "4444 55555 666666 7777777 88888888 999999999 0000000000 1 22 333 4444 55555"); tool.execute(eolCmd, program); - SetCommentCmd repeatCmd = new SetCommentCmd(callAddress, CodeUnit.REPEATABLE_COMMENT, + SetCommentCmd repeatCmd = new SetCommentCmd(callAddress, CommentType.REPEATABLE, "Local repeatable line1.\n" + "\n" + "Line3 of repeatable."); tool.execute(repeatCmd, program); @@ -613,7 +613,7 @@ public class CodeBrowserOptionsTest extends AbstractGhidraHeadedIntegrationTest new CreateFunctionCmd(null, callRefAddress, body, SourceType.USER_DEFINED); tool.execute(createFunctionCmd, program); - SetCommentCmd callRepeatCmd = new SetCommentCmd(callRefAddress, CodeUnit.REPEATABLE_COMMENT, + SetCommentCmd callRepeatCmd = new SetCommentCmd(callRefAddress, CommentType.REPEATABLE, "\n" + "Function Repeatable line2"); tool.execute(callRepeatCmd, program); @@ -622,7 +622,7 @@ public class CodeBrowserOptionsTest extends AbstractGhidraHeadedIntegrationTest tool.execute(addRefCmd, program); SetCommentCmd commentRefCmd = new SetCommentCmd(otherRefAddress, - CodeUnit.REPEATABLE_COMMENT, "Mem ref line1.\n" + ""); + CommentType.REPEATABLE, "Mem ref line1.\n" + ""); tool.execute(commentRefCmd, program); // these values are all DEFAULT, by default; set them in case that changes in the future diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/comments/CommentsPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/comments/CommentsPluginTest.java index e068516058..5703975369 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/comments/CommentsPluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/comments/CommentsPluginTest.java @@ -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. @@ -133,7 +133,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { assertEquals(new WordDataType().getName(), subData1.getDataType().getName()); String comment1 = "aaa bbb ccc ddd eee"; setAt(addr, CodeUnit.EOL_COMMENT, comment1, "OK"); - assertEquals(comment1, subData1.getComment(CodeUnit.EOL_COMMENT)); + assertEquals(comment1, subData1.getComment(CommentType.EOL)); browser.goToField(addr(0x10080a2), "+", 0, 0); @@ -147,7 +147,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { assertEquals(new FloatDataType().getName(), subData.getDataType().getName()); String comment = "This is a comment on a structure element."; setAt(addr, CodeUnit.EOL_COMMENT, comment, "OK"); - assertEquals(comment, subData.getComment(CodeUnit.EOL_COMMENT)); + assertEquals(comment, subData.getComment(CommentType.EOL)); browser.goToField(addr(0x010080a2), EolCommentFieldFactory.FIELD_NAME, 0, 0); assertEquals(comment, browser.getCurrentFieldText()); @@ -171,11 +171,11 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { waitForSwing(); comment += "\n\nHI, MOM"; - assertEquals(comment, subData.getComment(CodeUnit.EOL_COMMENT)); + assertEquals(comment, subData.getComment(CommentType.EOL)); performAction(deleteAction, browser.getProvider(), false); waitForSwing(); - assertNull(subData.getComment(CodeUnit.EOL_COMMENT)); + assertNull(subData.getComment(CommentType.EOL)); } @Test @@ -276,11 +276,11 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(0x01006420); CodeUnit cu = program.getListing().getCodeUnitAt(addr); setAt(addr, CodeUnit.PRE_COMMENT, PRE, "OK"); - assertEquals(PRE, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(PRE, cu.getComment(CommentType.PRE)); undo(program); - assertNull(cu.getComment(CodeUnit.PRE_COMMENT)); + assertNull(cu.getComment(CommentType.PRE)); redo(program); - assertEquals(PRE, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(PRE, cu.getComment(CommentType.PRE)); browser.goToField(addr, PreCommentFieldFactory.FIELD_NAME, 0, 0); assertEquals(PRE, browser.getCurrentFieldText()); } @@ -291,11 +291,11 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(0x01006420); CodeUnit cu = program.getListing().getCodeUnitAt(addr); setAt(addr, CodeUnit.POST_COMMENT, POST, "OK"); - assertEquals(POST, cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals(POST, cu.getComment(CommentType.POST)); undo(program); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.POST)); redo(program); - assertEquals(POST, cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals(POST, cu.getComment(CommentType.POST)); browser.goToField(addr, PostCommentFieldFactory.FIELD_NAME, 0, 0); assertEquals(POST, browser.getCurrentFieldText()); } @@ -306,11 +306,11 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(0x01006420); CodeUnit cu = program.getListing().getCodeUnitAt(addr); setAt(addr, CodeUnit.EOL_COMMENT, EOL, "OK"); - assertEquals(EOL, cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals(EOL, cu.getComment(CommentType.EOL)); undo(program); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); + assertNull(cu.getComment(CommentType.EOL)); redo(program); - assertEquals(EOL, cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals(EOL, cu.getComment(CommentType.EOL)); browser.goToField(addr, EolCommentFieldFactory.FIELD_NAME, 0, 0); assertEquals(EOL, browser.getCurrentFieldText()); } @@ -322,11 +322,11 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(0x01006420); CodeUnit cu = program.getListing().getCodeUnitAt(addr); setAt(addr, CodeUnit.PLATE_COMMENT, PLATE, "OK"); - assertEquals(PLATE, cu.getComment(CodeUnit.PLATE_COMMENT)); + assertEquals(PLATE, cu.getComment(CommentType.PLATE)); undo(program); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); redo(program); - assertEquals(PLATE, cu.getComment(CodeUnit.PLATE_COMMENT)); + assertEquals(PLATE, cu.getComment(CommentType.PLATE)); browser.goToField(addr, PlateFieldFactory.FIELD_NAME, 0, 0); //allow for the "*" that get added to the plate assertEquals(65, browser.getCurrentFieldText().indexOf(PLATE)); @@ -338,11 +338,11 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(0x01006420); CodeUnit cu = program.getListing().getCodeUnitAt(addr); setAt(addr, CodeUnit.REPEATABLE_COMMENT, REPEAT, "OK"); - assertEquals(REPEAT, cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals(REPEAT, cu.getComment(CommentType.REPEATABLE)); undo(program); - assertNull(cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertNull(cu.getComment(CommentType.REPEATABLE)); redo(program); - assertEquals(REPEAT, cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals(REPEAT, cu.getComment(CommentType.REPEATABLE)); browser.goToField(addr, EolCommentFieldFactory.FIELD_NAME, 0, 0); assertEquals(REPEAT, browser.getCurrentFieldText()); } @@ -355,7 +355,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { String longComment = "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8\n"; setAt(addr, CodeUnit.REPEATABLE_COMMENT, longComment, "OK"); - assertEquals(longComment, cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals(longComment, cu.getComment(CommentType.REPEATABLE)); // this fails when excepting assertTrue(browser.goToField(addr, EolCommentFieldFactory.FIELD_NAME, 0, 0)); @@ -373,27 +373,27 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { setAt(addr, CodeUnit.PLATE_COMMENT, PLATE, "OK"); setAt(addr, CodeUnit.REPEATABLE_COMMENT, REPEAT, "OK"); - assertEquals(PRE, cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals(POST, cu.getComment(CodeUnit.POST_COMMENT)); - assertEquals(EOL, cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals(PLATE, cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals(REPEAT, cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals(PRE, cu.getComment(CommentType.PRE)); + assertEquals(POST, cu.getComment(CommentType.POST)); + assertEquals(EOL, cu.getComment(CommentType.EOL)); + assertEquals(PLATE, cu.getComment(CommentType.PLATE)); + assertEquals(REPEAT, cu.getComment(CommentType.REPEATABLE)); undo(program, 5); - assertNull(cu.getComment(CodeUnit.PRE_COMMENT)); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); - assertNull(cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertNull(cu.getComment(CommentType.PRE)); + assertNull(cu.getComment(CommentType.POST)); + assertNull(cu.getComment(CommentType.EOL)); + assertNull(cu.getComment(CommentType.PLATE)); + assertNull(cu.getComment(CommentType.REPEATABLE)); redo(program, 5); - assertEquals(PRE, cu.getComment(CodeUnit.PRE_COMMENT)); - assertEquals(POST, cu.getComment(CodeUnit.POST_COMMENT)); - assertEquals(EOL, cu.getComment(CodeUnit.EOL_COMMENT)); - assertEquals(PLATE, cu.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals(REPEAT, cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals(PRE, cu.getComment(CommentType.PRE)); + assertEquals(POST, cu.getComment(CommentType.POST)); + assertEquals(EOL, cu.getComment(CommentType.EOL)); + assertEquals(PLATE, cu.getComment(CommentType.PLATE)); + assertEquals(REPEAT, cu.getComment(CommentType.REPEATABLE)); } @Test @@ -406,7 +406,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { assertNotNull(commentsDialog); pressButtonByText(commentsDialog.getComponent(), "Dismiss", false); waitForSwing(); - assertEquals("Bla bla bla", cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + assertEquals("Bla bla bla", cu.getComment(CommentType.REPEATABLE)); assertTrue(!commentsDialog.isVisible()); } @@ -418,9 +418,9 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { setAt(addr, CodeUnit.PRE_COMMENT, PRE, "OK"); setAt(addr, CodeUnit.PRE_COMMENT, PRE_U, "OK"); undo(program); - assertEquals(PRE, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(PRE, cu.getComment(CommentType.PRE)); redo(program); - assertEquals(PRE_U, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(PRE_U, cu.getComment(CommentType.PRE)); } @Test @@ -439,7 +439,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { pressButton(button, false); waitForSwing(); - assertEquals("Bla bla bla", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Bla bla bla", cu.getComment(CommentType.POST)); assertFalse(commentsDialog.isVisible()); } @@ -460,7 +460,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { pressButton(button, false); waitForSwing(); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.POST)); assertFalse(commentsDialog.isVisible()); } @@ -482,7 +482,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { pressButton(button, false); waitForSwing(); - assertNull(cu.getComment(CodeUnit.POST_COMMENT)); + assertNull(cu.getComment(CommentType.POST)); assertTrue(commentsDialog.isVisible()); close(commentsDialog); @@ -494,13 +494,13 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(0xf0000250); CodeUnit cu = program.getListing().getCodeUnitAt(addr); setAt(addr, CodeUnit.PLATE_COMMENT, PLATE, "OK"); - assertEquals(PLATE, cu.getComment(CodeUnit.PLATE_COMMENT)); + assertEquals(PLATE, cu.getComment(CommentType.PLATE)); removeAt(addr, CodeUnit.PLATE_COMMENT); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); undo(program); - assertEquals(PLATE, cu.getComment(CodeUnit.PLATE_COMMENT)); + assertEquals(PLATE, cu.getComment(CommentType.PLATE)); redo(program); - assertNull(cu.getComment(CodeUnit.PLATE_COMMENT)); + assertNull(cu.getComment(CommentType.PLATE)); } @Test @@ -543,7 +543,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(0x01006000); CodeUnit cu = program.getListing().getCodeUnitAt(addr); setAt(addr, CodeUnit.PRE_COMMENT, comment, "OK"); - assertEquals(comment, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(comment, cu.getComment(CommentType.PRE)); } @Test @@ -586,7 +586,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { String comment = "This is a comment DAT_01008094 with a label in it."; setAt(srcAddr, CodeUnit.PRE_COMMENT, comment, "OK"); - assertEquals(comment, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(comment, cu.getComment(CommentType.PRE)); browser.goToField(srcAddr, PreCommentFieldFactory.FIELD_NAME, 0, 23); click(browser, 2); @@ -603,7 +603,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { String comment = "This is a comment 01008094 with an address in it."; setAt(srcAddr, CodeUnit.PRE_COMMENT, comment, "OK"); - assertEquals(comment, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(comment, cu.getComment(CommentType.PRE)); browser.goToField(srcAddr, PreCommentFieldFactory.FIELD_NAME, 0, 23); click(browser, 2); @@ -678,7 +678,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { String comment = "This is a comment DAT_* with a wildcard in it."; setAt(srcAddr, CodeUnit.PRE_COMMENT, comment, "OK"); - assertEquals(comment, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(comment, cu.getComment(CommentType.PRE)); browser.goToField(srcAddr, PreCommentFieldFactory.FIELD_NAME, 0, 19); click(browser, 2); @@ -727,7 +727,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { // space comment is exactly the same; i.e. make sure that no tab conversion happens String spaceComment = "abcd\tdefg\n\t1\t2\t3\t4"; - assertEquals(spaceComment, cu.getComment(CodeUnit.PLATE_COMMENT)); + assertEquals(spaceComment, cu.getComment(CommentType.PLATE)); } /* @@ -791,7 +791,7 @@ public class CommentsPluginTest extends AbstractGhidraHeadedIntegrationTest { String illegal = "null\0 comment"; String legal = "null comment"; setAt(addr, CodeUnit.PRE_COMMENT, illegal, "OK"); - assertEquals(legal, cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals(legal, cu.getComment(CommentType.PRE)); } private void setAt(Address addr, int commentType, String comment, String nameOfButtonToClick) diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java index e3e785dcb0..4af7ac41f4 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/ClearTest.java @@ -327,18 +327,17 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest { @Test public void testClearNotRemoveComment() throws Exception { - SetCommentCmd cmd = - new SetCommentCmd(addr("0x1003698"), CodeUnit.EOL_COMMENT, "my comment"); + SetCommentCmd cmd = new SetCommentCmd(addr("0x1003698"), CommentType.EOL, "my comment"); applyCmd(program, cmd); CodeUnit cu = program.getListing().getCodeUnitAt(addr("0x1003698")); - assertEquals("my comment", cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("my comment", cu.getComment(CommentType.EOL)); assertTrue(cb.goToField(addr("0x1003698"), "Bytes", 0, 4)); doClearAction(true); cu = program.getListing().getCodeUnitAt(addr("0x1003698")); - assertEquals("my comment", cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("my comment", cu.getComment(CommentType.EOL)); } @@ -567,8 +566,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest { public void testClearComments() throws Exception { assertTrue(cb.goToField(addr("0x10022cc"), "Bytes", 0, 4)); - SetCommentCmd cmd = - new SetCommentCmd(addr("0x10022cc"), CodeUnit.EOL_COMMENT, "my comment"); + SetCommentCmd cmd =new SetCommentCmd(addr("0x10022cc"), CommentType.EOL, "my comment"); applyCmd(program, cmd); performAction(clearWithOptionsAction, cb.getProvider(), false); @@ -580,11 +578,11 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = program.getListing().getCodeUnitAt(addr("0x10022cc")); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); + assertNull(cu.getComment(CommentType.EOL)); undo(program); - assertNotNull(cu.getComment(CodeUnit.EOL_COMMENT)); + assertNotNull(cu.getComment(CommentType.EOL)); redo(program); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); + assertNull(cu.getComment(CommentType.EOL)); } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/progmgr/MultiTabPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/progmgr/MultiTabPluginTest.java index f0e8dcac61..cb054658bd 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/progmgr/MultiTabPluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/progmgr/MultiTabPluginTest.java @@ -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. @@ -41,7 +41,7 @@ import ghidra.framework.model.*; import ghidra.framework.plugintool.PluginTool; import ghidra.program.database.ProgramBuilder; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.symbol.SourceType; import ghidra.program.model.symbol.SymbolTable; @@ -589,7 +589,7 @@ public class MultiTabPluginTest extends AbstractGhidraHeadedIntegrationTest { try { p.getListing() .setComment(p.getAddressFactory().getAddress("01000000"), - CodeUnit.REPEATABLE_COMMENT, "This is a simple comment change."); + CommentType.REPEATABLE, "This is a simple comment change."); } finally { p.endTransaction(transactionID, true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/ListingDisplaySearcherTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/ListingDisplaySearcherTest.java index a08d26cf54..a4f14968f4 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/ListingDisplaySearcherTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/ListingDisplaySearcherTest.java @@ -280,9 +280,9 @@ public class ListingDisplaySearcherTest extends AbstractGhidraHeadedIntegrationT listing.createData(addr(0x01006890), floatDt); Data data = listing.getDataAt(addr(0x0100688c)); - data.setComment(CodeUnit.EOL_COMMENT, "this is a float data type"); + data.setComment(CommentType.EOL, "this is a float data type"); data = listing.getDataAt(addr(0x01006890)); - data.setComment(CodeUnit.EOL_COMMENT, "this is another float data type"); + data.setComment(CommentType.EOL, "this is another float data type"); } finally { @@ -357,9 +357,9 @@ public class ListingDisplaySearcherTest extends AbstractGhidraHeadedIntegrationT listing.createData(addr(0x01006890), floatDt); Data data = listing.getDataAt(addr(0x0100688c)); - data.setComment(CodeUnit.EOL_COMMENT, "this is a float data type"); + data.setComment(CommentType.EOL, "this is a float data type"); data = listing.getDataAt(addr(0x01006890)); - data.setComment(CodeUnit.EOL_COMMENT, "this is another float data type"); + data.setComment(CommentType.EOL, "this is another float data type"); } finally { @@ -445,9 +445,9 @@ public class ListingDisplaySearcherTest extends AbstractGhidraHeadedIntegrationT listing.createData(addr(0x01006890), floatDt); Data data = listing.getDataAt(addr(0x0100688c)); - data.setComment(CodeUnit.EOL_COMMENT, "this is a float data type"); + data.setComment(CommentType.EOL, "this is a float data type"); data = listing.getDataAt(addr(0x01006890)); - data.setComment(CodeUnit.EOL_COMMENT, "this is another float data type"); + data.setComment(CommentType.EOL, "this is another float data type"); } finally { diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java index 396cec4467..6379707375 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java @@ -376,17 +376,17 @@ public class SearchTextPlugin1Test extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = listing.getCodeUnitAt(getAddr(0x0100416f)); int transactionID = program.startTransaction("test"); - cu.setComment(CodeUnit.EOL_COMMENT, "call sscanf"); + cu.setComment(CommentType.EOL, "call sscanf"); cu = listing.getCodeUnitAt(getAddr(0x01004178)); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "make a reference to sscanf"); + cu.setComment(CommentType.REPEATABLE, "make a reference to sscanf"); cu = listing.getCodeUnitAt(getAddr(0x01004192)); - cu.setComment(CodeUnit.PLATE_COMMENT, "another ref to sscanf"); - cu.setComment(CodeUnit.POST_COMMENT, "sscanf in a post comment"); + cu.setComment(CommentType.PLATE, "another ref to sscanf"); + cu.setComment(CommentType.POST, "sscanf in a post comment"); cu = listing.getCodeUnitAt(getAddr(0x0100467b)); - cu.setComment(CodeUnit.PRE_COMMENT, "call sscanf here"); + cu.setComment(CommentType.PRE, "call sscanf here"); program.endTransaction(transactionID, true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin2Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin2Test.java index 158854832f..d3b88ecc7c 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin2Test.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin2Test.java @@ -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. @@ -309,7 +309,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest { int transactionID = program.startTransaction("test"); CodeUnit cu = program.getListing().getCodeUnitAt(addr); try { - cu.setComment(CodeUnit.POST_COMMENT, "********** my entry Exit **********"); + cu.setComment(CommentType.POST, "********** my entry Exit **********"); } finally { program.endTransaction(transactionID, true); @@ -340,7 +340,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest { int transactionID = program.startTransaction("test"); CodeUnit cu = program.getListing().getCodeUnitAt(addr); try { - cu.setComment(CodeUnit.POST_COMMENT, "********** ___sbh_find_block Exit **********"); + cu.setComment(CommentType.POST, "********** ___sbh_find_block Exit **********"); } finally { program.endTransaction(transactionID, true); @@ -369,7 +369,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest { int transactionID = program.startTransaction("test"); CodeUnit cu = program.getListing().getCodeUnitAt(addr); try { - cu.setComment(CodeUnit.POST_COMMENT, "********** ___sbh_find_block Exit **********"); + cu.setComment(CommentType.POST, "********** ___sbh_find_block Exit **********"); } finally { program.endTransaction(transactionID, true); @@ -395,7 +395,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest { int transactionID = program.startTransaction("test"); CodeUnit cu = program.getListing().getCodeUnitAt(addr); try { - cu.setComment(CodeUnit.POST_COMMENT, "Comment test * with an asterisk"); + cu.setComment(CommentType.POST, "Comment test * with an asterisk"); } finally { program.endTransaction(transactionID, true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin3Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin3Test.java index bb595bad97..6ee40156f0 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin3Test.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin3Test.java @@ -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. @@ -179,13 +179,13 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = listing.getCodeUnitAt(getAddr(0x01002c97)); int transactionID = program.startTransaction("test"); - cu.setComment(CodeUnit.PLATE_COMMENT, "find hit for eax"); - cu.setComment(CodeUnit.PRE_COMMENT, "find another hit for eax"); + cu.setComment(CommentType.PLATE, "find hit for eax"); + cu.setComment(CommentType.PRE, "find another hit for eax"); SymbolTable st = program.getSymbolTable(); st.createLabel(cu.getMinAddress(), "My_EAX", SourceType.USER_DEFINED); - cu.setComment(CodeUnit.EOL_COMMENT, "eol comment for eax"); + cu.setComment(CommentType.EOL, "eol comment for eax"); - cu.setComment(CodeUnit.POST_COMMENT, "last comment for eax"); + cu.setComment(CommentType.POST, "last comment for eax"); program.endTransaction(transactionID, true); SearchTextDialog dialog = getDialog(); @@ -340,16 +340,16 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = listing.getCodeUnitAt(getAddr(0x0100416f)); int transactionID = program.startTransaction("test"); - cu.setComment(CodeUnit.EOL_COMMENT, "call sscanf"); + cu.setComment(CommentType.EOL, "call sscanf"); cu = listing.getCodeUnitAt(getAddr(0x01004178)); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "make a reference to sscanf"); + cu.setComment(CommentType.REPEATABLE, "make a reference to sscanf"); cu = listing.getCodeUnitAt(getAddr(0x01004192)); - cu.setComment(CodeUnit.POST_COMMENT, "sscanf in a post comment"); + cu.setComment(CommentType.POST, "sscanf in a post comment"); cu = listing.getCodeUnitAt(getAddr(0x0100467b)); - cu.setComment(CodeUnit.PRE_COMMENT, "call sscanf here"); + cu.setComment(CommentType.PRE, "call sscanf here"); program.endTransaction(transactionID, true); @@ -427,16 +427,16 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = listing.getCodeUnitAt(getAddr(0x0100416f)); int transactionID = program.startTransaction("test"); - cu.setComment(CodeUnit.EOL_COMMENT, "call sscanf"); + cu.setComment(CommentType.EOL, "call sscanf"); cu = listing.getCodeUnitAt(getAddr(0x01004178)); - cu.setComment(CodeUnit.REPEATABLE_COMMENT, "make a reference to sscanf"); + cu.setComment(CommentType.REPEATABLE, "make a reference to sscanf"); cu = listing.getCodeUnitAt(getAddr(0x01004192)); - cu.setComment(CodeUnit.POST_COMMENT, "sscanf in a post comment"); + cu.setComment(CommentType.POST, "sscanf in a post comment"); cu = listing.getCodeUnitAt(getAddr(0x0100467b)); - cu.setComment(CodeUnit.PRE_COMMENT, "call sscanf here"); + cu.setComment(CommentType.PRE, "call sscanf here"); program.endTransaction(transactionID, true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/quicksearch/ProgramDatabaseSearchIteratorTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/quicksearch/ProgramDatabaseSearchIteratorTest.java index 6f6b490730..8fe5394672 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/quicksearch/ProgramDatabaseSearchIteratorTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/quicksearch/ProgramDatabaseSearchIteratorTest.java @@ -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. @@ -382,17 +382,17 @@ public class ProgramDatabaseSearchIteratorTest extends AbstractGhidraHeadedInteg } void addEolComment(long longAddr, String comment) { - SetCommentCmd cmd = new SetCommentCmd(getAddr(longAddr), CodeUnit.EOL_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(getAddr(longAddr), CommentType.EOL, comment); tool.execute(cmd, program); } void addPreComment(long longAddr, String comment) { - SetCommentCmd cmd = new SetCommentCmd(getAddr(longAddr), CodeUnit.PRE_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(getAddr(longAddr), CommentType.PRE, comment); tool.execute(cmd, program); } void addPostComment(long longAddr, String comment) { - SetCommentCmd cmd = new SetCommentCmd(getAddr(longAddr), CodeUnit.POST_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(getAddr(longAddr), CommentType.POST, comment); tool.execute(cmd, program); } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/EolCommentFieldFactoryTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/EolCommentFieldFactoryTest.java index 9a495c0c8a..7fa3798adf 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/EolCommentFieldFactoryTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/EolCommentFieldFactoryTest.java @@ -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. @@ -122,7 +122,7 @@ public class EolCommentFieldFactoryTest extends AbstractGhidraHeadedIntegrationT CodeUnit cu = program.getListing().getCodeUnitAt(function.getEntryPoint()); int transactionID = program.startTransaction("test"); try { - cu.setComment(CodeUnit.EOL_COMMENT, comment); + cu.setComment(CommentType.EOL, comment); } finally { program.endTransaction(transactionID, true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PlateFieldFactoryTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PlateFieldFactoryTest.java index 4eb454e489..334657e03a 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PlateFieldFactoryTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PlateFieldFactoryTest.java @@ -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. @@ -117,7 +117,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { Function function = program.getFunctionManager().getFunctionAt(addr); CodeUnit cu = program.getListing().getCodeUnitAt(function.getEntryPoint()); - tx(program, () -> cu.setComment(CodeUnit.PLATE_COMMENT, null)); + tx(program, () -> cu.setComment(CommentType.PLATE, null)); goToService.goTo(addr); @@ -148,7 +148,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { Function function = program.getFunctionManager().getFunctionAt(addr); CodeUnit cu = program.getListing().getCodeUnitAt(function.getEntryPoint()); - String[] plateComments = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] plateComments = cu.getCommentAsArray(CommentType.PLATE); goToService.goTo(addr); @@ -205,7 +205,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { tx(program, () -> { CreateFunctionCmd cmd = new CreateFunctionCmd(addr); cmd.applyTo(program); - cu.setComment(CodeUnit.PLATE_COMMENT, null); + cu.setComment(CommentType.PLATE, null); }); cb.updateNow(); @@ -326,7 +326,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { } CodeUnit cu = listing.getCodeUnitAt(addr); - String[] plates = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] plates = cu.getCommentAsArray(CommentType.PLATE); assertTrue("Failed to navigate to plate field at address: " + cu.getMinAddress(), cb.goToField(cu.getMinAddress(), PlateFieldFactory.FIELD_NAME, 1, 1)); ListingTextField tf = (ListingTextField) cb.getCurrentField(); @@ -437,7 +437,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = program.getListing().getCodeUnitAt(addr); tx(program, () -> { - cu.setComment(CodeUnit.PLATE_COMMENT, + cu.setComment(CommentType.PLATE, "this is a comment\ngo to the address 0x010028de"); }); assertTrue(cb.goToField(cu.getMinAddress(), PlateFieldFactory.FIELD_NAME, 2, 23)); @@ -461,7 +461,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { program.getSymbolTable() .createLabel(addr, testName.getMethodName(), SourceType.USER_DEFINED); - cu.setComment(CodeUnit.PLATE_COMMENT, + cu.setComment(CommentType.PLATE, "this is a comment\ngo to the address 0x010028de"); }); @@ -478,7 +478,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { public void testNavigationOnLabel() throws Exception { // add a plate comment that has "entry" in it CodeUnit cu = program.getListing().getCodeUnitAt(getAddr(0x0100292b)); - tx(program, () -> cu.setComment(CodeUnit.PLATE_COMMENT, "go to entry")); + tx(program, () -> cu.setComment(CommentType.PLATE, "go to entry")); assertTrue(cb.goToField(cu.getMinAddress(), PlateFieldFactory.FIELD_NAME, 1, 8)); click(cb, 2); @@ -493,7 +493,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = program.getListing().getCodeUnitAt(getAddr(0x01001100)); tx(program, () -> { - cu.setComment(CodeUnit.PLATE_COMMENT, "go to FUN*"); + cu.setComment(CommentType.PLATE, "go to FUN*"); }); assertTrue(cb.goToField(cu.getMinAddress(), PlateFieldFactory.FIELD_NAME, 1, 8)); click(cb, 2); @@ -521,7 +521,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { int transactionID = program.startTransaction("test"); CodeUnit cu = program.getListing().getCodeUnitAt(getAddr(0x0100292b)); try { - cu.setComment(CodeUnit.PLATE_COMMENT, "go to FUN*"); + cu.setComment(CommentType.PLATE, "go to FUN*"); } finally { program.endTransaction(transactionID, true); @@ -591,7 +591,7 @@ public class PlateFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest { private void createPlateComment(CodeUnit cu, String text) { tx(program, () -> { - cu.setComment(CodeUnit.PLATE_COMMENT, text); + cu.setComment(CommentType.PLATE, text); }); cb.updateNow(); } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PostCommentFieldFactoryTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PostCommentFieldFactoryTest.java index 0cf22cb881..2ff8bd5581 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PostCommentFieldFactoryTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PostCommentFieldFactoryTest.java @@ -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. @@ -280,7 +280,7 @@ public class PostCommentFieldFactoryTest extends AbstractGhidraHeadedIntegration int transactionID = program.startTransaction("test"); try { - cu.setComment(CodeUnit.POST_COMMENT, "My post comment"); + cu.setComment(CommentType.POST, "My post comment"); } finally { program.endTransaction(transactionID, true); @@ -1068,7 +1068,7 @@ public class PostCommentFieldFactoryTest extends AbstractGhidraHeadedIntegration CodeUnit cu = program.getListing().getCodeUnitAt(function.getEntryPoint()); int transactionID = program.startTransaction("test"); try { - cu.setComment(CodeUnit.POST_COMMENT, comment); + cu.setComment(CommentType.POST, comment); } finally { program.endTransaction(transactionID, true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PreCommentFieldFactoryTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PreCommentFieldFactoryTest.java index 62c4fc4904..1503faa679 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PreCommentFieldFactoryTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/PreCommentFieldFactoryTest.java @@ -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. @@ -139,7 +139,7 @@ public class PreCommentFieldFactoryTest extends AbstractGhidraHeadedIntegrationT CodeUnit cu = program.getListing().getCodeUnitAt(function.getEntryPoint()); int transactionID = program.startTransaction("test"); try { - cu.setComment(CodeUnit.PRE_COMMENT, comment); + cu.setComment(CommentType.PRE, comment); } finally { program.endTransaction(transactionID, true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/listingpanel/ListingPanelTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/listingpanel/ListingPanelTest.java index 88a62a98ad..a80131e957 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/listingpanel/ListingPanelTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/listingpanel/ListingPanelTest.java @@ -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. @@ -177,7 +177,7 @@ public class ListingPanelTest extends AbstractGhidraHeadedIntegrationTest { Instruction inst = program.getListing().getInstructionAt(addr(0x1004772)); String comment = "This is a very long comment. I want this sentence to wrap to the next line so that I can test wrapping."; - inst.setComment(CodeUnit.EOL_COMMENT, comment); + inst.setComment(CommentType.EOL, comment); program.endTransaction(id, true); cb.updateNow(); Layout l = getLayout(addr(0x1004772)); @@ -209,7 +209,7 @@ public class ListingPanelTest extends AbstractGhidraHeadedIntegrationTest { Instruction inst = program.getListing().getInstructionAt(addr(0x1004772)); String comment = "This is a very long comment. I want this sentence to wrap to the next line so that I can test wrapping."; - inst.setComment(CodeUnit.EOL_COMMENT, comment); + inst.setComment(CommentType.EOL, comment); program.endTransaction(id, true); Options opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS); opt.setBoolean("EOL Comments Field.Enable Word Wrapping", true); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java index 18d76bd14a..c72bbc4eaa 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java @@ -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. @@ -788,8 +788,8 @@ public class CodeUnitIteratorTest extends AbstractGhidraHeadedIntegrationTest { for (int i = 0; i < 20; i++) { CodeUnit cu = listing.getCodeUnitAt(addr(i + 10)); - cu.setComment(CodeUnit.PLATE_COMMENT, "comment for plate " + i); - assertEquals("comment for plate " + i, cu.getComment(CodeUnit.PLATE_COMMENT)); + cu.setComment(CommentType.PLATE, "comment for plate " + i); + assertEquals("comment for plate " + i, cu.getComment(CommentType.PLATE)); } endTransaction(); @@ -802,8 +802,8 @@ public class CodeUnitIteratorTest extends AbstractGhidraHeadedIntegrationTest { CodeUnit cu = iter.next(); expectedAddr = addr(n + 10); assertEquals(expectedAddr, cu.getMinAddress()); - assertNotNull(cu.getComment(CodeUnit.PLATE_COMMENT)); - assertNull(cu.getComment(CodeUnit.EOL_COMMENT)); + assertNotNull(cu.getComment(CommentType.PLATE)); + assertNull(cu.getComment(CommentType.EOL)); ++n; } } @@ -818,14 +818,14 @@ public class CodeUnitIteratorTest extends AbstractGhidraHeadedIntegrationTest { for (int i = 0; i < 20; i++) { CodeUnit cu = listing.getCodeUnitAt(addr(i + 10)); - cu.setComment(CodeUnit.PLATE_COMMENT, "comment for plate " + i); - cu.setComment(CodeUnit.EOL_COMMENT, "comment for eol " + i); + cu.setComment(CommentType.PLATE, "comment for plate " + i); + cu.setComment(CommentType.EOL, "comment for eol " + i); } for (int i = 20; i < 30; i++) { CodeUnit cu = listing.getCodeUnitAt(addr(i + 5000)); - cu.setComment(CodeUnit.PLATE_COMMENT, "comment for plate " + i); - cu.setComment(CodeUnit.EOL_COMMENT, "comment for eol " + i); + cu.setComment(CommentType.PLATE, "comment for plate " + i); + cu.setComment(CommentType.EOL, "comment for eol " + i); } endTransaction(); @@ -855,16 +855,16 @@ public class CodeUnitIteratorTest extends AbstractGhidraHeadedIntegrationTest { false); CodeUnit cu = listing.getCodeUnitAt(addr(90)); - cu.setComment(CodeUnit.PLATE_COMMENT, "comment for plate " + addr(90)); + cu.setComment(CommentType.PLATE, "comment for plate " + addr(90)); cu = listing.getCodeUnitAt(addr(80)); - cu.setComment(CodeUnit.PLATE_COMMENT, "comment for plate " + addr(80)); + cu.setComment(CommentType.PLATE, "comment for plate " + addr(80)); cu = listing.getCodeUnitAt(addr(70)); - cu.setComment(CodeUnit.PLATE_COMMENT, "comment for plate " + addr(70)); + cu.setComment(CommentType.PLATE, "comment for plate " + addr(70)); cu = listing.getCodeUnitAt(addr(10)); - cu.setComment(CodeUnit.PLATE_COMMENT, "comment for plate " + addr(10)); + cu.setComment(CommentType.PLATE, "comment for plate " + addr(10)); endTransaction(); CodeUnitIterator iter = @@ -977,12 +977,12 @@ public class CodeUnitIteratorTest extends AbstractGhidraHeadedIntegrationTest { false); for (int i = 0; i < 20; i++) { CodeUnit cu = listing.getCodeUnitAt(addr(i + 10)); - cu.setComment(CodeUnit.EOL_COMMENT, "This is an eol comment " + i); - assertNotNull(cu.getComment(CodeUnit.EOL_COMMENT)); + cu.setComment(CommentType.EOL, "This is an eol comment " + i); + assertNotNull(cu.getComment(CommentType.EOL)); } for (int i = 100; i < 120; i++) { CodeUnit cu = listing.getCodeUnitAt(addr(i)); - cu.setComment(CodeUnit.PRE_COMMENT, "This is pre comment " + i); + cu.setComment(CommentType.PRE, "This is pre comment " + i); } endTransaction(); AddressSet set = new AddressSet(addr(0), addr(5)); diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/SampleLocationGenerator.java b/Ghidra/Features/Base/src/test/java/ghidra/app/SampleLocationGenerator.java index de54425efa..92ecfc900e 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/SampleLocationGenerator.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/SampleLocationGenerator.java @@ -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. @@ -119,42 +119,42 @@ public class SampleLocationGenerator implements GhidraLocationGenerator { Address a = addr(0x100101c); CodeUnit cu = program.getListing().getCodeUnitAt(a); - String[] comment = cu.getCommentAsArray(CodeUnit.PRE_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.PRE); locs[0] = new CommentFieldLocation(program, a, null, comment, CodeUnit.PRE_COMMENT, 0, 5); a = addr(0x10030e4); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.PRE_COMMENT); + comment = cu.getCommentAsArray(CommentType.PRE); locs[1] = new CommentFieldLocation(program, a, null, comment, CodeUnit.PRE_COMMENT, 0, 5); a = addr(0x100352f); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.EOL_COMMENT); + comment = cu.getCommentAsArray(CommentType.EOL); locs[2] = new CommentFieldLocation(program, a, null, comment, CodeUnit.EOL_COMMENT, 0, 5); a = addr(0x10030e4); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.EOL_COMMENT); + comment = cu.getCommentAsArray(CommentType.EOL); locs[3] = new CommentFieldLocation(program, a, null, comment, CodeUnit.EOL_COMMENT, 1, 5); a = addr(0x10075ff); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + comment = cu.getCommentAsArray(CommentType.POST); locs[4] = new PostCommentFieldLocation(program, a, null, comment, 0, 5); a = addr(0x1003cf3); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + comment = cu.getCommentAsArray(CommentType.POST); locs[5] = new PostCommentFieldLocation(program, a, null, comment, 0, 0); a = addr(0x10030f0); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + comment = cu.getCommentAsArray(CommentType.PLATE); locs[6] = new PlateFieldLocation(program, a, null, 0, 5, comment, -1); a = addr(0x1003efc); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + comment = cu.getCommentAsArray(CommentType.PLATE); locs[7] = new PlateFieldLocation(program, a, null, 0, 3, comment, -1); // TODO add test for repeatable comments. @@ -168,12 +168,12 @@ public class SampleLocationGenerator implements GhidraLocationGenerator { Address a = addr(0x100101c); CodeUnit cu = program.getListing().getCodeUnitAt(a); - String[] comment = cu.getCommentAsArray(CodeUnit.PRE_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.PRE); locs[0] = new CommentFieldLocation(program, a, null, comment, CodeUnit.PRE_COMMENT, 0, 5); a = addr(0x10030e4); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.PRE_COMMENT); + comment = cu.getCommentAsArray(CommentType.PRE); locs[1] = new CommentFieldLocation(program, a, null, comment, CodeUnit.PRE_COMMENT, 0, 5); return locs; } @@ -184,12 +184,12 @@ public class SampleLocationGenerator implements GhidraLocationGenerator { Address a = addr(0x100352f); CodeUnit cu = program.getListing().getCodeUnitAt(a); - String[] comment = cu.getCommentAsArray(CodeUnit.EOL_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.EOL); locs[0] = new CommentFieldLocation(program, a, null, comment, CodeUnit.EOL_COMMENT, 0, 5); a = addr(0x10030e4); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.EOL_COMMENT); + comment = cu.getCommentAsArray(CommentType.EOL); locs[1] = new CommentFieldLocation(program, a, null, comment, CodeUnit.EOL_COMMENT, 1, 5); return locs; } @@ -200,12 +200,12 @@ public class SampleLocationGenerator implements GhidraLocationGenerator { Address a = addr(0x10075ff); CodeUnit cu = program.getListing().getCodeUnitAt(a); - String[] comment = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.POST); locs[0] = new PostCommentFieldLocation(program, a, null, comment, 0, 5); a = addr(0x1003cf3); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.POST_COMMENT); + comment = cu.getCommentAsArray(CommentType.POST); locs[1] = new PostCommentFieldLocation(program, a, null, comment, 0, 0); return locs; } @@ -216,12 +216,12 @@ public class SampleLocationGenerator implements GhidraLocationGenerator { Address a = addr(0x10030f0); CodeUnit cu = program.getListing().getCodeUnitAt(a); - String[] comment = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + String[] comment = cu.getCommentAsArray(CommentType.PLATE); locs[0] = new PlateFieldLocation(program, a, null, 0, 5, comment, -1); a = addr(0x1003efc); cu = program.getListing().getCodeUnitAt(a); - comment = cu.getCommentAsArray(CodeUnit.PLATE_COMMENT); + comment = cu.getCommentAsArray(CommentType.PLATE); locs[1] = new PlateFieldLocation(program, a, null, 0, 3, comment, -1); return locs; } diff --git a/Ghidra/Features/Base/src/test/java/ghidra/program/database/code/CodeManagerTest.java b/Ghidra/Features/Base/src/test/java/ghidra/program/database/code/CodeManagerTest.java index 9fc22790f5..66d27f443a 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/program/database/code/CodeManagerTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/program/database/code/CodeManagerTest.java @@ -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. @@ -174,14 +174,14 @@ public class CodeManagerTest extends AbstractGenericTest { parseStatic(addr(0x2000), addr(0x2003)); CodeUnit cu = listing.getCodeUnitAt(addr(0x2000)); - cu.setComment(CodeUnit.EOL_COMMENT, "eol comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "plate comment"); + cu.setComment(CommentType.EOL, "eol comment"); + cu.setComment(CommentType.PLATE, "plate comment"); cu = listing.getCodeUnitAt(addr(0x2000)); - String comment = cu.getComment(CodeUnit.EOL_COMMENT); + String comment = cu.getComment(CommentType.EOL); assertNotNull(comment); assertEquals("eol comment", comment); - comment = cu.getComment(CodeUnit.PLATE_COMMENT); + comment = cu.getComment(CommentType.PLATE); assertNotNull(comment); assertEquals("plate comment", comment); } @@ -364,30 +364,30 @@ public class CodeManagerTest extends AbstractGenericTest { InstructionIterator iter = listing.getInstructions(true); while (iter.hasNext()) { Instruction inst = iter.next(); - inst.setComment(CodeUnit.PRE_COMMENT, "pre comment"); - inst.setComment(CodeUnit.EOL_COMMENT, "eol comment"); + inst.setComment(CommentType.PRE, "pre comment"); + inst.setComment(CommentType.EOL, "eol comment"); - assertEquals("pre comment", inst.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("eol comment", inst.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("pre comment", inst.getComment(CommentType.PRE)); + assertEquals("eol comment", inst.getComment(CommentType.EOL)); } Instruction inst = listing.getInstructionAt(addr(0x2000)); - assertEquals("pre comment", inst.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("eol comment", inst.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("pre comment", inst.getComment(CommentType.PRE)); + assertEquals("eol comment", inst.getComment(CommentType.EOL)); listing.clearComments(addr(0x2000), addr(0x2100)); inst = listing.getInstructionAfter(addr(0x2000)); - assertNull(inst.getComment(CodeUnit.PRE_COMMENT)); - assertNull(inst.getComment(CodeUnit.EOL_COMMENT)); + assertNull(inst.getComment(CommentType.PRE)); + assertNull(inst.getComment(CommentType.EOL)); inst = listing.getInstructionAt(addr(0x2000)); - assertNull(inst.getComment(CodeUnit.PRE_COMMENT)); - assertNull(inst.getComment(CodeUnit.EOL_COMMENT)); + assertNull(inst.getComment(CommentType.PRE)); + assertNull(inst.getComment(CommentType.EOL)); inst = listing.getInstructionBefore(addr(0x2000)); - assertEquals("pre comment", inst.getComment(CodeUnit.PRE_COMMENT)); - assertEquals("eol comment", inst.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("pre comment", inst.getComment(CommentType.PRE)); + assertEquals("eol comment", inst.getComment(CommentType.EOL)); } @Test @@ -536,7 +536,7 @@ public class CodeManagerTest extends AbstractGenericTest { parseStatic(addr(0x1100), addr(0x1200)); MemoryBlock block = mem.getBlock(addr(0x1000)); CodeUnit cu = listing.getCodeUnitContaining(block.getEnd()); - cu.setComment(CodeUnit.EOL_COMMENT, "eol comment"); + cu.setComment(CommentType.EOL, "eol comment"); Address oldMin = cu.getMinAddress(); Address expectedNewMin = oldMin.addNoWrap(0x8000 - 0x1000); @@ -552,7 +552,7 @@ public class CodeManagerTest extends AbstractGenericTest { cu = listing.getCodeUnitContaining(block.getEnd()); assertEquals(expectedNewMin, cu.getMinAddress()); - assertNotNull(cu.getComment(CodeUnit.EOL_COMMENT)); + assertNotNull(cu.getComment(CommentType.EOL)); assertEquals(12, cu.getIntProperty("Numbers")); c = (SaveableColor) cu.getObjectProperty("FavoriteColor"); @@ -576,32 +576,32 @@ public class CodeManagerTest extends AbstractGenericTest { public void testCompositeDataComments() throws Exception { CodeUnit cu = listing.getCodeUnitAt(addr(0x1741)); - cu.setComment(CodeUnit.EOL_COMMENT, "eol comment"); - cu.setComment(CodeUnit.PLATE_COMMENT, "plate comment"); - cu.setComment(CodeUnit.POST_COMMENT, "post comment"); - cu.setComment(CodeUnit.PRE_COMMENT, "pre comment"); + cu.setComment(CommentType.EOL, "eol comment"); + cu.setComment(CommentType.PLATE, "plate comment"); + cu.setComment(CommentType.POST, "post comment"); + cu.setComment(CommentType.PRE, "pre comment"); Structure struct = new StructureDataType("struct_1", 0); struct.add(DWordDataType.dataType); struct.add(DWordDataType.dataType); Data structData = listing.createData(addr(0x1741), struct, struct.getLength()); - assertEquals("eol comment", structData.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("plate comment", structData.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("post comment", structData.getComment(CodeUnit.POST_COMMENT)); - assertEquals("pre comment", structData.getComment(CodeUnit.PRE_COMMENT)); + assertEquals("eol comment", structData.getComment(CommentType.EOL)); + assertEquals("plate comment", structData.getComment(CommentType.PLATE)); + assertEquals("post comment", structData.getComment(CommentType.POST)); + assertEquals("pre comment", structData.getComment(CommentType.PRE)); Data firstComp = structData.getComponent(0); - assertEquals("eol comment", firstComp.getComment(CodeUnit.EOL_COMMENT)); - assertEquals("plate comment", firstComp.getComment(CodeUnit.PLATE_COMMENT)); - assertEquals("post comment", firstComp.getComment(CodeUnit.POST_COMMENT)); - assertEquals("pre comment", firstComp.getComment(CodeUnit.PRE_COMMENT)); + assertEquals("eol comment", firstComp.getComment(CommentType.EOL)); + assertEquals("plate comment", firstComp.getComment(CommentType.PLATE)); + assertEquals("post comment", firstComp.getComment(CommentType.POST)); + assertEquals("pre comment", firstComp.getComment(CommentType.PRE)); - structData.setComment(CodeUnit.EOL_COMMENT, "EOL"); - assertEquals("EOL", firstComp.getComment(CodeUnit.EOL_COMMENT)); + structData.setComment(CommentType.EOL, "EOL"); + assertEquals("EOL", firstComp.getComment(CommentType.EOL)); - firstComp.setComment(CodeUnit.POST_COMMENT, "POST"); - assertEquals("POST", structData.getComment(CodeUnit.POST_COMMENT)); + firstComp.setComment(CommentType.POST, "POST"); + assertEquals("POST", structData.getComment(CommentType.POST)); } @Test @@ -974,13 +974,13 @@ public class CodeManagerTest extends AbstractGenericTest { // to 1-msec to avoid testing delays. CodeUnit cu = listing.getCodeUnitAt(addr(0x1000)); - cu.setComment(CodeUnit.EOL_COMMENT, "This is comment 1"); + cu.setComment(CommentType.EOL, "This is comment 1"); Thread.sleep(1);// force a new date to get used - cu.setComment(CodeUnit.EOL_COMMENT, "This is a changed comment 2"); + cu.setComment(CommentType.EOL, "This is a changed comment 2"); Thread.sleep(1);// force a new date to get used - cu.setComment(CodeUnit.EOL_COMMENT, "This is a changed comment 3"); + cu.setComment(CommentType.EOL, "This is a changed comment 3"); CodeManager cm = ((ProgramDB) program).getCodeManager(); CommentHistory[] history = cm.getCommentHistory(addr(0x1000), CodeUnit.EOL_COMMENT); diff --git a/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/correlator/DebugUtils.java b/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/correlator/DebugUtils.java index e3df2cb577..7e6c667a59 100755 --- a/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/correlator/DebugUtils.java +++ b/Ghidra/Features/CodeCompare/src/main/java/ghidra/features/codecompare/correlator/DebugUtils.java @@ -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. @@ -60,7 +60,7 @@ class DebugUtils { transactionID = program.startTransaction("Colorize CodeCompare"); Set>> entrySet = map.entrySet(); for (Entry> entry : entrySet) { - entry.getKey().setComment(CodeUnit.EOL_COMMENT, entry.getValue().toString()); + entry.getKey().setComment(CommentType.EOL, entry.getValue().toString()); } } finally { diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java index 1276d3daf7..788af46ce9 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java @@ -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. @@ -548,7 +548,7 @@ public class DecompileCallback { private void encodeHeaderComment(Encoder encoder, Function func) throws IOException { Address addr = func.getEntryPoint(); - String text = listing.getComment(CodeUnit.PLATE_COMMENT, addr); + String text = listing.getComment(CommentType.PLATE, addr); if (text != null) { encoder.openElement(ELEM_COMMENT); encoder.writeString(ATTRIB_TYPE, "header"); diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_DecompilerMessageAnalyzer.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_DecompilerMessageAnalyzer.java index 9cbe37e861..e421af8570 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_DecompilerMessageAnalyzer.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/analysis/ObjectiveC2_DecompilerMessageAnalyzer.java @@ -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. @@ -194,7 +194,7 @@ public class ObjectiveC2_DecompilerMessageAnalyzer extends AbstractAnalyzer { if (instruction == null) { return; } - if (instruction.getComment(CodeUnit.EOL_COMMENT) != null) { + if (instruction.getComment(CommentType.EOL) != null) { return; } @@ -217,7 +217,7 @@ public class ObjectiveC2_DecompilerMessageAnalyzer extends AbstractAnalyzer { builder.append(split[i]); } builder.delete(builder.length() - 2, builder.length() - 1); - instruction.setComment(CodeUnit.EOL_COMMENT, builder.toString()); + instruction.setComment(CommentType.EOL, builder.toString()); } private boolean isObjcCall(Program program, Varnode input, TaskMonitor monitor) { diff --git a/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.java b/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.java index 42978491b4..c249fc1601 100644 --- a/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.java +++ b/Ghidra/Features/Decompiler/src/test.slow/java/ghidra/app/decompiler/component/DecompilerClangTest.java @@ -2450,7 +2450,7 @@ public class DecompilerClangTest extends AbstractDecompilerTest { } private void setComment(String address, CommentType type, String comment) { - applyCmd(program, new SetCommentCmd(addr(address), type.ordinal(), comment)); + applyCmd(program, new SetCommentCmd(addr(address), type, comment)); } private void assertNextTokenIndex(int expectedIndex, int line, int... cols) { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/app/util/opinion/DexLoader.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/app/util/opinion/DexLoader.java index 494ba11ce5..0fd68975a9 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/app/util/opinion/DexLoader.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/app/util/opinion/DexLoader.java @@ -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. @@ -29,7 +29,7 @@ import ghidra.file.formats.android.dex.util.DexUtil; import ghidra.framework.model.DomainObject; import ghidra.program.model.address.Address; import ghidra.program.model.data.PointerDataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryBlock; import ghidra.program.model.symbol.*; @@ -189,7 +189,7 @@ public class DexLoader extends AbstractProgramWrapperLoader { if (program.getMemory().getInt(methodIndexAddress) == -1) { program.getListing() - .setComment(methodIndexAddress, CodeUnit.PLATE_COMMENT, builder.toString()); + .setComment(methodIndexAddress, CommentType.PLATE, builder.toString()); // Add placeholder symbol for external functions String methodName = DexUtil.convertToString(header, item.getNameIndex()); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/analyzers/FileFormatAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/analyzers/FileFormatAnalyzer.java index f1c384d3e1..4b8ade2c64 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/analyzers/FileFormatAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/analyzers/FileFormatAnalyzer.java @@ -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. @@ -31,10 +31,7 @@ import ghidra.program.model.data.StringDataType; import ghidra.program.model.listing.*; import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.util.CodeUnitInsertionException; -import ghidra.util.exception.CancelledException; -import ghidra.util.exception.DuplicateNameException; -import ghidra.util.exception.NotEmptyException; -import ghidra.util.exception.NotFoundException; +import ghidra.util.exception.*; import ghidra.util.task.TaskMonitor; public abstract class FileFormatAnalyzer implements Analyzer { @@ -207,7 +204,7 @@ public abstract class FileFormatAnalyzer implements Analyzer { } protected boolean setPlateComment(Program program, Address address, String comment) { - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.PLATE_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.PLATE, comment); return cmd.applyTo(program); } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java index f7f6e940e1..358d19d19e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java @@ -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. @@ -181,7 +181,7 @@ public abstract class ArtImageSections { program.getMinAddress().getNewAddress(header.getImageBegin() + section.getOffset()); program.getSymbolTable().createLabel(address, name, SourceType.ANALYSIS); program.getListing() - .setComment(address, CodeUnit.PLATE_COMMENT, "Size: " + section.getSize()); + .setComment(address, CommentType.PLATE, "Size: " + section.getSize()); createFragment(program, address, section, name, monitor); } @@ -210,7 +210,7 @@ public abstract class ArtImageSections { String comment = "Declaring Class: 0x" + Integer.toHexString(field.getDeclaringClass()); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); address = address.add(dataType.getLength()); @@ -230,7 +230,7 @@ public abstract class ArtImageSections { ArtField artField = fieldGroup.getFieldList().get(0); String comment = "Declaring Class: 0x" + Integer.toHexString(artField.getDeclaringClass()); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); } address = address.add(dataType.getLength()); @@ -261,7 +261,7 @@ public abstract class ArtImageSections { program.getListing().createData(address, dataType); String comment = "Declaring Class: 0x" + Integer.toHexString(method.getDeclaringClass()); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); address = address.add(dataType.getLength()); @@ -282,7 +282,7 @@ public abstract class ArtImageSections { ArtMethod artMethod = methodGroup.getMethodList().get(0); String comment = "Declaring Class: 0x" + Integer.toHexString(artMethod.getDeclaringClass()); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); } address = address.add(dataType.getLength()); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/dex/analyzer/DexMarkupInstructionsAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/dex/analyzer/DexMarkupInstructionsAnalyzer.java index e15cb8a282..ff8f18c7a8 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/dex/analyzer/DexMarkupInstructionsAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/dex/analyzer/DexMarkupInstructionsAnalyzer.java @@ -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. @@ -255,8 +255,7 @@ public class DexMarkupInstructionsAnalyzer extends FileFormatAnalyzer { String className = stringItem.getStringDataItem().getString(); setEquate(program, instruction.getMinAddress(), operand, className, classTypeIndex); - program.getListing() - .setComment(instruction.getMinAddress(), CodeUnit.EOL_COMMENT, className); + program.getListing().setComment(instruction.getMinAddress(), CommentType.EOL, className); } private void processString(Program program, Instruction instruction, int operand, @@ -300,7 +299,6 @@ public class DexMarkupInstructionsAnalyzer extends FileFormatAnalyzer { String valueName = format(className, fieldName); setEquate(program, instruction.getMinAddress(), operand, fieldName, fieldIndex); - program.getListing() - .setComment(instruction.getMinAddress(), CodeUnit.EOL_COMMENT, valueName); + program.getListing().setComment(instruction.getMinAddress(), CommentType.EOL, valueName); } } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPK_Partition.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPK_Partition.java index 460ccb4ac5..79c4cbd199 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPK_Partition.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPK_Partition.java @@ -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. @@ -20,9 +20,7 @@ import ghidra.app.util.importer.MessageLog; import ghidra.program.flatapi.FlatProgramAPI; import ghidra.program.model.address.Address; import ghidra.program.model.data.DataType; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Data; -import ghidra.program.model.listing.Program; +import ghidra.program.model.listing.*; import ghidra.program.model.symbol.RefType; import ghidra.util.task.TaskMonitor; @@ -112,8 +110,7 @@ public abstract class FBPK_Partition implements StructConverter { } program.getListing() - .setComment(address, CodeUnit.PLATE_COMMENT, - getName() + " - " + getPartitionIndex()); + .setComment(address, CommentType.PLATE, getName() + " - " + getPartitionIndex()); api.createFragment(getName(), address, partitionDataType.getLength()); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPT.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPT.java index 8a847ab841..c1690fc514 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPT.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/fbpk/FBPT.java @@ -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. @@ -41,7 +41,7 @@ public abstract class FBPT implements StructConverter { return; } String comment = "FBPT" + "\n" + "Num of entries: " + getEntries().size(); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); api.createFragment(FBPK_Constants.FBPT, address, fbptDataType.getLength()); address = address.add(fbptDataType.getLength()); @@ -59,7 +59,8 @@ public abstract class FBPT implements StructConverter { log.appendMsg("Unable to apply FBPT Entry data, stopping - " + address); return; } - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, entry.getName() + " - " + i++); + program.getListing() + .setComment(address, CommentType.PLATE, entry.getName() + " - " + i++); api.createFragment(FBPK_Constants.FBPT, address, entryDataType.getLength()); address = address.add(entryDataType.getLength()); } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java index d8d0ee9770..2fe120fc31 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java @@ -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. @@ -25,24 +25,12 @@ import ghidra.file.formats.android.dex.format.DexHeader; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressSetView; -import ghidra.program.model.data.Array; -import ghidra.program.model.data.ArrayDataType; -import ghidra.program.model.data.DWordDataType; -import ghidra.program.model.data.DataType; -import ghidra.program.model.data.Undefined1DataType; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Data; -import ghidra.program.model.listing.Program; +import ghidra.program.model.data.*; +import ghidra.program.model.listing.*; import ghidra.program.model.mem.Memory; import ghidra.program.model.mem.MemoryBlock; import ghidra.program.model.scalar.Scalar; -import ghidra.program.model.symbol.Equate; -import ghidra.program.model.symbol.EquateTable; -import ghidra.program.model.symbol.RefType; -import ghidra.program.model.symbol.ReferenceManager; -import ghidra.program.model.symbol.SourceType; -import ghidra.program.model.symbol.Symbol; -import ghidra.program.model.symbol.SymbolTable; +import ghidra.program.model.symbol.*; import ghidra.util.exception.CancelledException; import ghidra.util.task.TaskMonitor; @@ -199,7 +187,7 @@ public class OatHeaderAnalyzer extends FileFormatAnalyzer { Data data = createData(program, address, dataType); Scalar scalar = data.getScalar(0); Address toAddr = destinationBlock.getStart().add(scalar.getUnsignedValue()); - program.getListing().setComment(address, CodeUnit.EOL_COMMENT, "->" + toAddr); + program.getListing().setComment(address, CommentType.EOL, "->" + toAddr); } catch (Exception e) { log.appendException(e); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_S_T.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_S_T.java index 98c58a2a65..fac19bfe64 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_S_T.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_S_T.java @@ -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. @@ -120,7 +120,7 @@ public class OatDexFile_S_T extends OatDexFile { Address dataAddress = address.add(_offset); - program.getListing().setComment(dataAddress, CodeUnit.PLATE_COMMENT, getDexFileLocation()); + program.getListing().setComment(dataAddress, CommentType.PLATE, getDexFileLocation()); program.getListing().clearCodeUnits(dataAddress, dataAddress, false, monitor); Data data = program.getListing().createData(dataAddress, toDataType()); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java index d68bb1c03c..b9113e1271 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java @@ -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. @@ -15,9 +15,7 @@ */ package ghidra.file.formats.android.vdex; -import ghidra.app.util.bin.BinaryReader; -import ghidra.app.util.bin.ByteProvider; -import ghidra.app.util.bin.MemoryByteProvider; +import ghidra.app.util.bin.*; import ghidra.app.util.importer.MessageLog; import ghidra.file.analyzers.FileFormatAnalyzer; import ghidra.file.formats.android.dex.format.DexHeader; @@ -25,11 +23,8 @@ import ghidra.file.formats.android.oat.OatUtilities; import ghidra.file.formats.android.vdex.sections.DexSectionHeader_002; import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressSetView; -import ghidra.program.model.data.ArrayDataType; -import ghidra.program.model.data.ByteDataType; -import ghidra.program.model.data.DWordDataType; -import ghidra.program.model.data.DataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.data.*; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.util.task.TaskMonitor; @@ -90,8 +85,7 @@ public class VdexHeaderAnalyzer extends FileFormatAnalyzer { monitor.checkCancelled(); program.getListing() - .setComment(address, CodeUnit.PLATE_COMMENT, - "quicken info table entry"); + .setComment(address, CommentType.PLATE, "quicken info table entry"); createData(program, address, new DWordDataType()); address = address.add(4); @@ -130,7 +124,7 @@ public class VdexHeaderAnalyzer extends FileFormatAnalyzer { if (sectionHeader != null) { int dexSharedDataSize = sectionHeader.getDexSharedDataSize(); String comment = "dex_shared_data_size_ : 0x" + Integer.toHexString(dexSharedDataSize); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); DataType array = new ArrayDataType(BYTE, dexSharedDataSize, BYTE.getLength()); createData(program, address, array); address = address.add(dexSharedDataSize); @@ -146,7 +140,7 @@ public class VdexHeaderAnalyzer extends FileFormatAnalyzer { String comment = "verifier_deps_size_ : 0x" + Integer.toHexString(vdexHeader.getVerifierDepsSize()); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); int remainderSize = vdexHeader.getVerifierDepsSize(); @@ -183,7 +177,7 @@ public class VdexHeaderAnalyzer extends FileFormatAnalyzer { } String comment = "quickening_info_size_ : 0x" + Integer.toHexString(quickeningInfoSize); - program.getListing().setComment(address, CodeUnit.PLATE_COMMENT, comment); + program.getListing().setComment(address, CommentType.PLATE, comment); address = address.add(quickeningInfoSize); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/cramfs/CramFsAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/cramfs/CramFsAnalyzer.java index d02c502924..de1ca70638 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/cramfs/CramFsAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/cramfs/CramFsAnalyzer.java @@ -25,7 +25,7 @@ import ghidra.program.model.address.AddressSetView; import ghidra.program.model.data.DataType; import ghidra.program.model.lang.Language; import ghidra.program.model.lang.Processor; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; import ghidra.util.exception.CancelledException; @@ -76,8 +76,7 @@ public class CramFsAnalyzer extends AbstractAnalyzer { DataType dataType = cramFsSuper.toDataType(); program.getListing().createData(minAddress, dataType); program.getListing() - .setComment(minAddress, CodeUnit.PLATE_COMMENT, - cramFsSuper.getRoot().toString()); + .setComment(minAddress, CommentType.PLATE, cramFsSuper.getRoot().toString()); int offset = cramFsSuper.getRoot().getOffsetAdjusted(); for (int i = 0; i < cramFsSuper.getFsid().getFiles() - 1; i++) { @@ -90,7 +89,7 @@ public class CramFsAnalyzer extends AbstractAnalyzer { if (newInode.isFile()) { Address inodeDataAddress = minAddress.add(newInode.getOffsetAdjusted()); program.getListing() - .setComment(inodeDataAddress, CodeUnit.PLATE_COMMENT, + .setComment(inodeDataAddress, CommentType.PLATE, newInode.getName() + " Data/Bytes\n"); } @@ -98,7 +97,7 @@ public class CramFsAnalyzer extends AbstractAnalyzer { program.getListing().createData(inodeAddress, inodeDataType); program.getListing() - .setComment(inodeAddress, CodeUnit.PLATE_COMMENT, + .setComment(inodeAddress, CommentType.PLATE, newInode.getName() + "\n" + newInode.toString()); offset += inodeDataType.getLength(); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/Ext4Analyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/Ext4Analyzer.java index b3f488c290..f0672aad42 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/Ext4Analyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/Ext4Analyzer.java @@ -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. @@ -23,7 +23,7 @@ import ghidra.file.analyzers.FileFormatAnalyzer; import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressSetView; import ghidra.program.model.data.DataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; @@ -154,7 +154,9 @@ public class Ext4Analyzer extends FileFormatAnalyzer { Ext4Inode inode = new Ext4Inode(reader); DataType dataType = inode.toDataType(); createData(program, address, dataType); - program.getListing().setComment(address, CodeUnit.EOL_COMMENT, "0x" + (Integer.toHexString(inodesPerGroup * i + j ))); + program.getListing() + .setComment(address, CommentType.EOL, + "0x" + (Integer.toHexString(inodesPerGroup * i + j))); address = address.add(superBlock.getS_inode_size()); reader.setPointerIndex(address.getOffset()); monitor.incrementProgress(1); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/NewExt4Analyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/NewExt4Analyzer.java index 813524a0c0..4fa4c90bfa 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/NewExt4Analyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ext4/NewExt4Analyzer.java @@ -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. @@ -15,9 +15,8 @@ */ package ghidra.file.formats.ext4; -import java.util.List; - import java.io.IOException; +import java.util.List; import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.app.plugin.core.analysis.AutoAnalysisManager; @@ -203,7 +202,7 @@ public class NewExt4Analyzer extends FileFormatAnalyzer { @Override protected boolean setPlateComment( Program program, Address address, String comment ) { - SetCommentCmd cmd = new SetCommentCmd( address, CodeUnit.PLATE_COMMENT, comment ); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.PLATE, comment); if ( program.getMemory( ).contains( address ) ) { return cmd.applyTo( program ); } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/CFStringAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/CFStringAnalyzer.java index 3b6faaab72..a0ba231e59 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/CFStringAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/CFStringAnalyzer.java @@ -103,8 +103,9 @@ public class CFStringAnalyzer extends AbstractAnalyzer { String comment = makeComment(cFString); - program.getListing().setComment(currentAddress, CodeUnit.REPEATABLE_COMMENT, - "\"" + comment + "\",00"); + program.getListing() + .setComment(currentAddress, CommentType.REPEATABLE, + "\"" + comment + "\",00"); if (program.getSymbolTable().getGlobalSymbol(symbolString, currentAddress) != null) { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/TestAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/TestAnalyzer.java index 9c3af35ae4..8de29979ca 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/TestAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/macosx/analyzers/TestAnalyzer.java @@ -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. @@ -64,7 +64,8 @@ public class TestAnalyzer extends AbstractAnalyzer { //don't need to check this.. } - program.getListing().setComment(currentAddress, CodeUnit.PLATE_COMMENT, + program.getListing() + .setComment(currentAddress, CommentType.PLATE, "Address = " + currentAddress.toString()); currentAddress = currentAddress.add(data.getLength()); diff --git a/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java index 2214781c7c..87fe3939f2 100644 --- a/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java +++ b/Ghidra/Features/GnuDemangler/src/test/java/ghidra/app/util/demangler/gnu/GnuDemanglerTest.java @@ -28,7 +28,7 @@ import ghidra.program.database.ProgramDB; import ghidra.program.model.address.Address; import ghidra.program.model.data.DataType; import ghidra.program.model.data.TerminatedStringDataType; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Data; import ghidra.program.model.symbol.*; import ghidra.test.ToyProgramBuilder; @@ -226,7 +226,7 @@ public class GnuDemanglerTest extends AbstractGenericTest { assertEquals("AP_HAL::HAL::Callbacks", s.getParentNamespace().getName(true)); assertEquals("typeinfo for AP_HAL::HAL::Callbacks", - program.getListing().getComment(CodeUnit.PLATE_COMMENT, addr("01001000"))); + program.getListing().getComment(CommentType.PLATE, addr("01001000"))); Data d = program.getListing().getDefinedDataAt(addr("01001000")); assertNotNull(d); @@ -259,7 +259,7 @@ public class GnuDemanglerTest extends AbstractGenericTest { assertEquals("AP_HAL::HAL::Callbacks", s.getParentNamespace().getName(true)); assertEquals("typeinfo name for AP_HAL::HAL::Callbacks", - program.getListing().getComment(CodeUnit.PLATE_COMMENT, addr("01001000"))); + program.getListing().getComment(CommentType.PLATE, addr("01001000"))); Data d = program.getListing().getDefinedDataAt(addr("01001000")); assertNotNull(d); diff --git a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java index 6408326574..f6a92889e2 100644 --- a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java +++ b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java @@ -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. @@ -114,7 +114,7 @@ public class CreateTypeDescriptorBackgroundCmd Data nameData = DataUtilities.createData(program, arrayAddr, charArray, charArray.getLength(), getClearDataMode()); - nameData.setComment(CodeUnit.EOL_COMMENT, "TypeDescriptor.name"); + nameData.setComment(CommentType.EOL, "TypeDescriptor.name"); return true; } diff --git a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/EHDataTypeUtilities.java b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/EHDataTypeUtilities.java index f14a8d2e1c..c894305904 100644 --- a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/EHDataTypeUtilities.java +++ b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/EHDataTypeUtilities.java @@ -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. @@ -233,7 +233,7 @@ public class EHDataTypeUtilities { String dataTypeName, String suffix, Address address, DataApplyOptions applyOptions) { Listing listing = program.getListing(); - String existingComment = listing.getComment(CodeUnit.PLATE_COMMENT, address); + String existingComment = listing.getComment(CommentType.PLATE, address); if (!applyOptions.shouldCreateComments()) { return existingComment; } @@ -245,7 +245,7 @@ public class EHDataTypeUtilities { String appliedSuffix = (suffix != null) ? (suffix) : ""; String appliedExisting = (existingComment != null) ? (existingComment + "\n") : ""; String appliedComment = appliedExisting + appliedPrefix + dataTypeName + appliedSuffix; - listing.setComment(address, CodeUnit.PLATE_COMMENT, appliedComment); + listing.setComment(address, CommentType.PLATE, appliedComment); return appliedComment; } return existingComment; diff --git a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/rtti/CreateVfTableBackgroundCmd.java b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/rtti/CreateVfTableBackgroundCmd.java index 1e85d5b0dd..562ddef7fb 100644 --- a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/rtti/CreateVfTableBackgroundCmd.java +++ b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/rtti/CreateVfTableBackgroundCmd.java @@ -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. @@ -120,7 +120,7 @@ public class CreateVfTableBackgroundCmd extends AbstractCreateDataBackgroundCmd< String prefixString = ((demangledTypeDescriptor != null) ? (demangledTypeDescriptor + Namespace.DELIMITER) : ""); - data.setComment(CodeUnit.EOL_COMMENT, + data.setComment(CommentType.EOL, "terminator for " + prefixString + VF_TABLE_LABEL); return true; } diff --git a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PropagateExternalParametersAnalyzer.java b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PropagateExternalParametersAnalyzer.java index 918de8c5eb..7163f1ecf2 100644 --- a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PropagateExternalParametersAnalyzer.java +++ b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PropagateExternalParametersAnalyzer.java @@ -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. @@ -209,7 +209,7 @@ public class PropagateExternalParametersAnalyzer extends AbstractAnalyzer { Parameter param = params[index]; DataType dt = param.getDataType(); String name = param.getName(); - SetCommentCmd cmd = new SetCommentCmd(cu.getAddress(), CodeUnit.EOL_COMMENT, + SetCommentCmd cmd = new SetCommentCmd(cu.getAddress(), CommentType.EOL, dt.getDisplayName() + " " + name + " for " + externalFunctionName); cmd.applyTo(currentProgram); @@ -310,17 +310,16 @@ public class PropagateExternalParametersAnalyzer extends AbstractAnalyzer { private void createComment(Address dataAddress, String newComment, PushedParamInfo info) { Listing listing = currentProgram.getListing(); - String plateComment = listing.getComment(CodeUnit.PLATE_COMMENT, dataAddress); + String plateComment = listing.getComment(CommentType.PLATE, dataAddress); if (plateComment == null) { // add a comment - SetCommentCmd cmd = new SetCommentCmd(dataAddress, CodeUnit.PLATE_COMMENT, newComment); + SetCommentCmd cmd = new SetCommentCmd(dataAddress, CommentType.PLATE, newComment); cmd.applyTo(currentProgram); } else if (!plateComment.contains(info.getCalledFunctionName())) { // update the existing comment String updatedComment = plateComment + "\n" + newComment; - SetCommentCmd cmd = - new SetCommentCmd(dataAddress, CodeUnit.PLATE_COMMENT, updatedComment); + SetCommentCmd cmd = new SetCommentCmd(dataAddress, CommentType.PLATE, updatedComment); cmd.applyTo(currentProgram); } } diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/ApplySymbols.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/ApplySymbols.java index bdc80b4d05..a7243003ee 100644 --- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/ApplySymbols.java +++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/ApplySymbols.java @@ -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. @@ -93,7 +93,7 @@ class ApplySymbols { if (!"NONAME".equals(name)) { preComment += " (" + name + ")"; } - PdbUtil.appendComment(program, address, preComment, CodeUnit.PRE_COMMENT); + PdbUtil.appendComment(program, address, preComment, CommentType.PRE); continue; } @@ -108,7 +108,7 @@ class ApplySymbols { if (length == 0) { // avoid creating symbol which may correspond to inline function code PdbUtil.appendComment(program, address, "Symbol Ref: {@symbol " + name + "}", - CodeUnit.PRE_COMMENT); + CommentType.PRE); continue; } diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbUtil.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbUtil.java index 364ec85fd6..189b144213 100644 --- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbUtil.java +++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbUtil.java @@ -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. @@ -21,7 +21,7 @@ import ghidra.app.util.PseudoInstruction; import ghidra.program.model.address.Address; import ghidra.program.model.data.Composite; import ghidra.program.model.data.Structure; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; import ghidra.program.model.listing.Program; import ghidra.util.Conv; @@ -52,10 +52,10 @@ final class PdbUtil { * @param program program * @param address listing address * @param text comment text - * @param commentType comment type ({@link CodeUnit} + * @param commentType comment type */ final static void appendComment(Program program, Address address, String text, - int commentType) { + CommentType commentType) { String comment = program.getListing().getComment(commentType, address); if (comment != null) { diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/BlockCommentsManager.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/BlockCommentsManager.java index a217341fc2..dad5bf1f20 100644 --- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/BlockCommentsManager.java +++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/BlockCommentsManager.java @@ -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. @@ -20,8 +20,7 @@ import java.util.Map; import ghidra.app.cmd.comments.SetCommentCmd; import ghidra.program.model.address.Address; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Program; +import ghidra.program.model.listing.*; import ghidra.util.Msg; /** @@ -118,7 +117,7 @@ public class BlockCommentsManager { private void finalizeBlockComments(Program program, long addressDelta) { for (Map.Entry entry : blockPreComments.entrySet()) { appendBlockComment(program, entry.getKey().add(addressDelta), entry.getValue(), - CodeUnit.PRE_COMMENT); + CommentType.PRE); } for (Map.Entry entry : blockPostComments.entrySet()) { CodeUnit codeUnit = program.getListing() @@ -129,14 +128,13 @@ public class BlockCommentsManager { } else { Address endCodeUnitAddress = codeUnit.getAddress(); - appendBlockComment(program, endCodeUnitAddress, entry.getValue(), - CodeUnit.POST_COMMENT); + appendBlockComment(program, endCodeUnitAddress, entry.getValue(), CommentType.POST); } } } private void appendBlockComment(Program program, Address address, String text, - int commentType) { + CommentType commentType) { String comment = program.getListing().getComment(commentType, address); comment = (comment == null) ? text : comment + "\n" + text; SetCommentCmd.createComment(program, address, comment, commentType); diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.java index 4d0105f003..0fe546c3b4 100644 --- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.java +++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/DefaultPdbApplicator.java @@ -1065,7 +1065,6 @@ public class DefaultPdbApplicator implements PdbApplicator { * Stores whether the structure referenced by the record number has been filled in such that * it can be used as a base class * @param recordNumber record number of type record - * @param dataType the data type to store */ void markFilledInForBase(RecordNumber recordNumber) { RecordNumber mappedNumber = getMappedRecordNumber(recordNumber); @@ -2366,7 +2365,7 @@ public class DefaultPdbApplicator implements PdbApplicator { if (StringUtils.isBlank(comment)) { return false; } - String plate = program.getListing().getComment(CodeUnit.PLATE_COMMENT, address); + String plate = program.getListing().getComment(CommentType.PLATE, address); if (plate == null) { plate = ""; } @@ -2377,7 +2376,7 @@ public class DefaultPdbApplicator implements PdbApplicator { comment += '\n'; } plate = comment + plate; // putting new comment at top of existing plate - SetCommentCmd.createComment(program, address, plate, CodeUnit.PLATE_COMMENT); + SetCommentCmd.createComment(program, address, plate, CommentType.PLATE); return true; } diff --git a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyMergeTest.java b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyMergeTest.java index 7d00337006..ca257033c4 100644 --- a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyMergeTest.java +++ b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyMergeTest.java @@ -52,7 +52,7 @@ public class DiffApplyMergeTest extends DiffApplyTestAdapter { assertEquals(origDiffs.subtract(as), diffPlugin.getDiffHighlightSelection()); Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("100415a")); - assertEquals("This is my function for testing diff", cu.getComment(CodeUnit.PLATE_COMMENT)); + assertEquals("This is my function for testing diff", cu.getComment(CommentType.PLATE)); } @Test @@ -68,7 +68,7 @@ public class DiffApplyMergeTest extends DiffApplyTestAdapter { assertEquals(origDiffs, diffPlugin.getDiffHighlightSelection()); Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("1002395")); - assertEquals("Pre: Program1\nPre: Program2", cu.getComment(CodeUnit.PRE_COMMENT)); + assertEquals("Pre: Program1\nPre: Program2", cu.getComment(CommentType.PRE)); } @Test @@ -84,7 +84,7 @@ public class DiffApplyMergeTest extends DiffApplyTestAdapter { assertEquals(origDiffs, diffPlugin.getDiffHighlightSelection()); Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("100238f")); - assertEquals("EOL: Program1\nEOL: Program2", cu.getComment(CodeUnit.EOL_COMMENT)); + assertEquals("EOL: Program1\nEOL: Program2", cu.getComment(CommentType.EOL)); } @Test @@ -101,7 +101,7 @@ public class DiffApplyMergeTest extends DiffApplyTestAdapter { Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("1002336")); assertEquals("ONE: Repeatable comment.\nTWO: Repeatable comment.", - cu.getComment(CodeUnit.REPEATABLE_COMMENT)); + cu.getComment(CommentType.REPEATABLE)); } @Test @@ -117,7 +117,7 @@ public class DiffApplyMergeTest extends DiffApplyTestAdapter { assertEquals(origDiffs, diffPlugin.getDiffHighlightSelection()); Listing listing = program.getListing(); CodeUnit cu = listing.getCodeUnitAt(addr("100239d")); - assertEquals("Post: Program1\nPost: Program2", cu.getComment(CodeUnit.POST_COMMENT)); + assertEquals("Post: Program1\nPost: Program2", cu.getComment(CommentType.POST)); } /** diff --git a/Ghidra/Features/Sarif/src/main/java/sarif/SarifController.java b/Ghidra/Features/Sarif/src/main/java/sarif/SarifController.java index 7b81443a4e..0f7cfaf826 100644 --- a/Ghidra/Features/Sarif/src/main/java/sarif/SarifController.java +++ b/Ghidra/Features/Sarif/src/main/java/sarif/SarifController.java @@ -166,7 +166,7 @@ public class SarifController implements ObjectSelectedListener commentMarkupClass, int commentType, + Class commentMarkupClass, CommentType commentType, String vtOptionName) throws Exception { useMatch("0x00411ab0", "0x00411a90"); @@ -230,7 +230,7 @@ public class ForceApplyOfExcludedMarkupTest extends AbstractFunctionSignatureMar //---------------------------- - protected void checkComments(final int commentType, final Address sourceAddr, + protected void checkComments(final CommentType commentType, final Address sourceAddr, final String expectedSourceComment, final Address destinationAddr, final String expectedDestinationComment) { @@ -283,7 +283,7 @@ public class ForceApplyOfExcludedMarkupTest extends AbstractFunctionSignatureMar return null; } - protected void checkCommentStatus(VTMatch match, int commentType, + protected void checkCommentStatus(VTMatch match, CommentType commentType, VTMarkupItemStatus expectedStatus) { VTMarkupItem markupItem = getCommentMarkup(match, commentType); if (expectedStatus == null && markupItem == null) { @@ -293,33 +293,33 @@ public class ForceApplyOfExcludedMarkupTest extends AbstractFunctionSignatureMar checkMarkupStatus(markupItem, expectedStatus); } - protected VTMarkupItem getCommentMarkup(VTMatch match, int commentType) { + protected VTMarkupItem getCommentMarkup(VTMatch match, CommentType commentType) { MatchInfo matchInfo = controller.getMatchInfo(match); Collection appliableMarkupItems = matchInfo.getAppliableMarkupItems(TaskMonitor.DUMMY); for (VTMarkupItem vtMarkupItem : appliableMarkupItems) { switch (commentType) { - case CodeUnit.PLATE_COMMENT: + case CommentType.PLATE: if (vtMarkupItem.getMarkupType() instanceof PlateCommentMarkupType) { return vtMarkupItem; } continue; - case CodeUnit.PRE_COMMENT: + case CommentType.PRE: if (vtMarkupItem.getMarkupType() instanceof PreCommentMarkupType) { return vtMarkupItem; } continue; - case CodeUnit.EOL_COMMENT: + case CommentType.EOL: if (vtMarkupItem.getMarkupType() instanceof EolCommentMarkupType) { return vtMarkupItem; } continue; - case CodeUnit.REPEATABLE_COMMENT: + case CommentType.REPEATABLE: if (vtMarkupItem.getMarkupType() instanceof RepeatableCommentMarkupType) { return vtMarkupItem; } continue; - case CodeUnit.POST_COMMENT: + case CommentType.POST: if (vtMarkupItem.getMarkupType() instanceof PostCommentMarkupType) { return vtMarkupItem; } @@ -336,7 +336,8 @@ public class ForceApplyOfExcludedMarkupTest extends AbstractFunctionSignatureMar waitOnPossibleBackgroundProcessing(); } - protected void setComment(Program program, Address address, int commentType, String comment) { + protected void setComment(Program program, Address address, CommentType commentType, + String comment) { int transaction = -1; try { transaction = program.startTransaction("Test - Set Comment: " + address.toString(true)); diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/core/data/ProgramProviderContext.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/core/data/ProgramProviderContext.java index dae8d2a690..cb65a0062a 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/core/data/ProgramProviderContext.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/core/data/ProgramProviderContext.java @@ -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. @@ -64,7 +64,7 @@ public class ProgramProviderContext implements DataTypeProviderContext { if (symbol != null && !symbol.isDynamic()) { label = symbol.getName(); } - String comment = data.getComment(CodeUnit.EOL_COMMENT); + String comment = data.getComment(CommentType.EOL); return new DataTypeComponentImpl(dt, null, length, 0, offset, label, comment); } diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/oldfunction/OldFunctionDataDB.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/oldfunction/OldFunctionDataDB.java index befaa3e3a0..6104959ca7 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/oldfunction/OldFunctionDataDB.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/oldfunction/OldFunctionDataDB.java @@ -84,7 +84,7 @@ class OldFunctionDataDB { public synchronized String getComment() { CodeUnit cu = program.getCodeManager().getCodeUnitContaining(entryPoint); - return cu.getComment(CodeUnit.PLATE_COMMENT); + return cu.getComment(CommentType.PLATE); } /** diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/CommentTypeUtils.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/CommentTypeUtils.java index eaba1dbc17..c45214a63b 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/CommentTypeUtils.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/CommentTypeUtils.java @@ -16,6 +16,7 @@ package ghidra.program.util; import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; public class CommentTypeUtils { @@ -39,19 +40,19 @@ public class CommentTypeUtils { return CodeUnit.REPEATABLE_COMMENT; } else if (cu != null) { - if (cu.getComment(CodeUnit.PRE_COMMENT) != null) { + if (cu.getComment(CommentType.PRE) != null) { return CodeUnit.PRE_COMMENT; } - if (cu.getComment(CodeUnit.POST_COMMENT) != null) { + if (cu.getComment(CommentType.POST) != null) { return CodeUnit.POST_COMMENT; } - if (cu.getComment(CodeUnit.EOL_COMMENT) != null) { + if (cu.getComment(CommentType.EOL) != null) { return CodeUnit.EOL_COMMENT; } - if (cu.getComment(CodeUnit.PLATE_COMMENT) != null) { + if (cu.getComment(CommentType.PLATE) != null) { return CodeUnit.PLATE_COMMENT; } - if (cu.getComment(CodeUnit.REPEATABLE_COMMENT) != null) { + if (cu.getComment(CommentType.REPEATABLE) != null) { return CodeUnit.REPEATABLE_COMMENT; } } diff --git a/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/AbstractJavaAnalyzer.java b/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/AbstractJavaAnalyzer.java index ec52601543..1906b61fe4 100644 --- a/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/AbstractJavaAnalyzer.java +++ b/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/AbstractJavaAnalyzer.java @@ -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. @@ -207,7 +207,7 @@ public abstract class AbstractJavaAnalyzer implements Analyzer { } protected boolean setPlateComment(Program program, Address address, String comment) { - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.PLATE_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.PLATE, comment); return cmd.applyTo(program); } diff --git a/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java b/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java index 8bdb79e4ba..b2eda483c0 100644 --- a/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java +++ b/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java @@ -468,7 +468,7 @@ public class JavaAnalyzer extends AbstractJavaAnalyzer implements AnalysisWorker sb.append("\n"); } } - program.getListing().setComment(addr, CodeUnit.PLATE_COMMENT, sb.toString()); + program.getListing().setComment(addr, CommentType.PLATE, sb.toString()); } private void appendMethodHandleInfo(StringBuffer sb, @@ -661,7 +661,7 @@ public class JavaAnalyzer extends AbstractJavaAnalyzer implements AnalysisWorker if (address.getAddressSpace() != program.getAddressFactory().getDefaultAddressSpace()) { return false; } - SetCommentCmd cmd = new SetCommentCmd(address, CodeUnit.EOL_COMMENT, comment); + SetCommentCmd cmd = new SetCommentCmd(address, CommentType.EOL, comment); return cmd.applyTo(program); } @@ -770,7 +770,7 @@ public class JavaAnalyzer extends AbstractJavaAnalyzer implements AnalysisWorker Listing listing = function.getProgram().getListing(); Address entryPoint = function.getEntryPoint(); - listing.setComment(entryPoint, CodeUnit.PLATE_COMMENT, sb.toString()); + listing.setComment(entryPoint, CommentType.PLATE, sb.toString()); } private boolean hasConstantPoolReference(String mnemonic) { diff --git a/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/extend/PowerPC64_ElfExtension.java b/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/extend/PowerPC64_ElfExtension.java index 52d64343eb..309c831db1 100644 --- a/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/extend/PowerPC64_ElfExtension.java +++ b/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/extend/PowerPC64_ElfExtension.java @@ -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. @@ -511,7 +511,7 @@ public class PowerPC64_ElfExtension extends ElfExtension { address + "}"; elfLoadHelper.getProgram() .getListing() - .setComment(localFunctionAddr, CodeUnit.PRE_COMMENT, cmt); + .setComment(localFunctionAddr, CommentType.PRE, cmt); } catch (Exception e) { elfLoadHelper.log("Failed to generate local function symbol " + localName + " at " + diff --git a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CodeBrowserPluginScreenShots.java b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CodeBrowserPluginScreenShots.java index 2db30b6a52..863ac1bd1f 100644 --- a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CodeBrowserPluginScreenShots.java +++ b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CodeBrowserPluginScreenShots.java @@ -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. @@ -41,7 +41,7 @@ import ghidra.app.util.viewer.field.*; import ghidra.app.util.viewer.listingpanel.ListingPanel; import ghidra.app.util.viewer.listingpanel.OverviewProvider; import ghidra.program.model.data.*; -import ghidra.program.model.listing.CodeUnit; +import ghidra.program.model.listing.CommentType; public class CodeBrowserPluginScreenShots extends GhidraScreenShotGenerator { @@ -253,7 +253,7 @@ public class CodeBrowserPluginScreenShots extends GhidraScreenShotGenerator { setToolSize(1000, 800); positionListingTop(0x040364c); - createComment(0x403653, CodeUnit.PRE_COMMENT, "PUSH some stuff"); + createComment(0x403653, CommentType.PRE, "PUSH some stuff"); positionCursor(0x0403653, MnemonicFieldFactory.FIELD_NAME); middleClickCursor(); @@ -366,7 +366,7 @@ public class CodeBrowserPluginScreenShots extends GhidraScreenShotGenerator { waitForBusyTool(tool); } - private void createComment(long address, int commentType, String comment) { + private void createComment(long address, CommentType commentType, String comment) { goToListing(address); SetCommentCmd cmd = new SetCommentCmd(addr(address), commentType, comment); tool.execute(cmd, program); diff --git a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CommentWindowPluginScreenShots.java b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CommentWindowPluginScreenShots.java index 6fb630d421..a5104b354b 100644 --- a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CommentWindowPluginScreenShots.java +++ b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/CommentWindowPluginScreenShots.java @@ -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. @@ -68,11 +68,11 @@ public class CommentWindowPluginScreenShots extends GhidraScreenShotGenerator { int id = prog.startTransaction("Test"); Listing listing = prog.getListing(); - listing.setComment(addr(0x00401006), CodeUnit.EOL_COMMENT, "My EOL comment"); - listing.setComment(addr(0x0040101b), CodeUnit.PRE_COMMENT, "My Pre comment"); - listing.setComment(addr(0x0040101c), CodeUnit.POST_COMMENT, "My Post comment"); - listing.setComment(addr(0x00401020), CodeUnit.PLATE_COMMENT, "My Plate comment"); - listing.setComment(addr(0x0040100d), CodeUnit.REPEATABLE_COMMENT, "My Repeatable comment"); + listing.setComment(addr(0x00401006), CommentType.EOL, "My EOL comment"); + listing.setComment(addr(0x0040101b), CommentType.PRE, "My Pre comment"); + listing.setComment(addr(0x0040101c), CommentType.POST, "My Post comment"); + listing.setComment(addr(0x00401020), CommentType.PLATE, "My Plate comment"); + listing.setComment(addr(0x0040100d), CommentType.REPEATABLE, "My Repeatable comment"); prog.endTransaction(id, true); prog.flushEvents(); waitForSwing(); diff --git a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionComparisonScreenShots.java b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionComparisonScreenShots.java index 664f1f1c13..ff0d11b103 100644 --- a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionComparisonScreenShots.java +++ b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/FunctionComparisonScreenShots.java @@ -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,8 @@ import ghidra.app.cmd.disassemble.DisassembleCommand; import ghidra.app.util.viewer.listingpanel.ListingPanel; import ghidra.features.base.codecompare.listing.ListingCodeComparisonPanel; import ghidra.features.base.codecompare.panel.FunctionComparisonPanel; -import ghidra.features.codecompare.plugin.*; +import ghidra.features.codecompare.plugin.FunctionComparisonPlugin; +import ghidra.features.codecompare.plugin.FunctionComparisonProvider; import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressSet; import ghidra.program.model.listing.*; @@ -85,7 +86,7 @@ public class FunctionComparisonScreenShots extends GhidraScreenShotGenerator { Function f1 = getFunction(sourceProgram, addr(0x004118f0)); f1.setName("FunctionA", SourceType.USER_DEFINED); - sourceListing.setComment(addr(0x004118f0), CodeUnit.PLATE_COMMENT, null); + sourceListing.setComment(addr(0x004118f0), CommentType.PLATE, null); sourceListing.clearCodeUnits(addr(0x004119b1), addr(0x004119b4), false); sourceMemory.setByte(addr(0x004119b2), (byte) 0x55); sourceMemory.setByte(addr(0x004119b4), (byte) 0x52); @@ -93,7 +94,7 @@ public class FunctionComparisonScreenShots extends GhidraScreenShotGenerator { Function f2 = getFunction(destinationProgram, addr(0x004118c0)); f2.setName("FunctionB", SourceType.USER_DEFINED); - destListing.setComment(addr(0x004118c0), CodeUnit.PLATE_COMMENT, null); + destListing.setComment(addr(0x004118c0), CommentType.PLATE, null); plugin.createComparison(f1, f2); FunctionComparisonProvider provider = diff --git a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/RepositoryScreenShots.java b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/RepositoryScreenShots.java index 50cd614ce6..ec5593f76b 100644 --- a/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/RepositoryScreenShots.java +++ b/Ghidra/Test/IntegrationTest/src/screen/java/help/screenshot/RepositoryScreenShots.java @@ -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. @@ -1721,7 +1721,7 @@ public class RepositoryScreenShots extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x0040156c")); - cu.setComment(CodeUnit.PRE_COMMENT, "Before the code unit."); + cu.setComment(CommentType.PRE, "Before the code unit."); } @Override @@ -1729,7 +1729,7 @@ public class RepositoryScreenShots extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x0040156c")); - cu.setComment(CodeUnit.PRE_COMMENT, null); + cu.setComment(CommentType.PRE, null); } @Override @@ -1737,7 +1737,7 @@ public class RepositoryScreenShots extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x0040156c")); - cu.setComment(CodeUnit.PRE_COMMENT, "This is a changed pre-comment."); + cu.setComment(CommentType.PRE, "This is a changed pre-comment."); } }); @@ -1765,7 +1765,7 @@ public class RepositoryScreenShots extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x0040156c")); - cu.setComment(CodeUnit.PRE_COMMENT, "This is a simple comment for example."); + cu.setComment(CommentType.PRE, "This is a simple comment for example."); } @Override @@ -1773,7 +1773,7 @@ public class RepositoryScreenShots extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x0040156c")); - cu.setComment(CodeUnit.PRE_COMMENT, "This is a simple comment for example.\n" + + cu.setComment(CommentType.PRE, "This is a simple comment for example.\n" + "I added some more to this comment to make it multiple lines."); } @@ -1782,7 +1782,7 @@ public class RepositoryScreenShots extends AbstractListingMergeManagerTest { Listing listing = program.getListing(); CodeUnit cu; cu = listing.getCodeUnitAt(addr(program, "0x0040156c")); - cu.setComment(CodeUnit.PRE_COMMENT, + cu.setComment(CommentType.PRE, "Changed this to a multiple line comment.\n" + "It was necessary for demonstration purposes."); } diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/VersionControlAction2Test.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/VersionControlAction2Test.java index 110ae7c3c0..1dfc91d8b6 100644 --- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/VersionControlAction2Test.java +++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/VersionControlAction2Test.java @@ -38,8 +38,7 @@ import ghidra.framework.model.DomainFile; import ghidra.framework.model.DomainFolder; import ghidra.program.database.ProgramDB; import ghidra.program.model.address.AddressSpace; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Program; +import ghidra.program.model.listing.*; import ghidra.program.model.symbol.SourceType; import ghidra.program.model.symbol.SymbolTable; import ghidra.util.task.TaskMonitor; @@ -446,7 +445,7 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest Program p = (Program) df.getDomainObject(this, true, false, TaskMonitor.DUMMY); editProgram(p, program -> { CodeUnit cu = program.getListing().getCodeUnitAt(program.getMinAddress()); - cu.setComment(CodeUnit.PLATE_COMMENT, "my Plate Comment"); + cu.setComment(CommentType.PLATE, "my Plate Comment"); }); p.release(this);