mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-31 08:53:40 +08:00
GP-0: Fixing deprecated comment API warnings
This commit is contained in:
+5
-5
@@ -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);
|
||||
|
||||
+7
-7
@@ -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();
|
||||
|
||||
+6
-5
@@ -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 =
|
||||
|
||||
+8
-8
@@ -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.");
|
||||
}
|
||||
|
||||
+2
-3
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user