mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 19:48:18 +08:00
GP-0: Fixing deprecated comment API warnings
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
@@ -353,7 +353,7 @@ public class AnalysisUnwoundFrame<T> extends AbstractUnwoundFrame<T> {
|
||||
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());
|
||||
|
||||
+4
-4
@@ -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<WatchValue> {
|
||||
*/
|
||||
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<WatchValue> {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return frame.getComment(CodeUnit.PRE_COMMENT);
|
||||
return frame.getComment(CommentType.PRE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-6
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
+19
-19
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String> c, int itemsPerLine)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+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.
|
||||
@@ -325,23 +325,23 @@ public class CodeUnitInfoPasteCmd implements Command<Program> {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import ghidra.program.model.listing.*;
|
||||
public class SetCommentCmd implements Command<Program> {
|
||||
|
||||
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<Program> {
|
||||
* @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<Program> {
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -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<Program> {
|
||||
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;
|
||||
|
||||
+7
-7
@@ -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)");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
+7
-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.
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
+3
-3
@@ -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 "";
|
||||
}
|
||||
|
||||
+6
-5
@@ -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;
|
||||
|
||||
+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.
|
||||
@@ -94,19 +94,19 @@ class CommentTableModel extends AddressBasedTableModel<CommentRowObject> {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -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) {
|
||||
|
||||
+5
-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.
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+9
-10
@@ -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);
|
||||
|
||||
+4
-5
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+20
-21
@@ -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,
|
||||
|
||||
+4
-4
@@ -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());
|
||||
}
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
+13
-13
@@ -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
|
||||
|
||||
+6
-6
@@ -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();
|
||||
|
||||
|
||||
+4
-4
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+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.
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -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);
|
||||
|
||||
+10
-10
@@ -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;
|
||||
|
||||
+3
-2
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
+7
-9
@@ -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);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class EolComments {
|
||||
}
|
||||
|
||||
Collection<String> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
+3
-3
@@ -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<String> 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);
|
||||
|
||||
|
||||
+2
-2
@@ -139,7 +139,7 @@ public class PostCommentFieldFactory extends FieldFactory {
|
||||
String[] autoComment = getAutoPostComment(cu);
|
||||
List<String> 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) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user