mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GP-3329 - Search Highlights - Major update and refactor of the way Listing highlights work. Highlights are now more closely coupled with the fields that will paint them.
This commit is contained in:
parent
a21c2c4347
commit
84650030d0
130 changed files with 1096 additions and 919 deletions
|
@ -19,10 +19,8 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.listing.*;
|
||||
|
||||
/**
|
||||
* The <CODE>BytesFieldLocation</CODE> class provides specific information
|
||||
* about the BYTES field within a program location.
|
||||
* Provides specific information about the bytes field within a program location.
|
||||
*/
|
||||
|
||||
public class BytesFieldLocation extends CodeUnitLocation {
|
||||
|
||||
/**
|
||||
|
@ -42,10 +40,9 @@ public class BytesFieldLocation extends CodeUnitLocation {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new BytesFieldLocation for the given address.
|
||||
* The address will be adjusted to the beginning of the code unit containing
|
||||
* that address(if it exists). The original address can be retrieved using
|
||||
* the "getByteAddress()" method.
|
||||
* Creates a new BytesFieldLocation for the given address. The address will be adjusted to the
|
||||
* beginning of the code unit containing that address(if it exists). The original address can
|
||||
* be retrieved using the "getByteAddress()" method.
|
||||
* @param program the program that this location is related.
|
||||
* @param addr the address of the byte for this location.
|
||||
*/
|
||||
|
@ -56,7 +53,7 @@ public class BytesFieldLocation extends CodeUnitLocation {
|
|||
private static int[] getComponentPath(Program program, Address addr) {
|
||||
CodeUnit cu = program.getListing().getCodeUnitContaining(addr);
|
||||
|
||||
// if the codeunit is a data, try and dig down to the lowest subdata containing the address
|
||||
// if the code unit is a data, get the lowest sub-data containing the address
|
||||
if (cu instanceof Data) {
|
||||
Data data = (Data) cu;
|
||||
Data subData = data.getPrimitiveAt((int) addr.subtract(data.getAddress()));
|
||||
|
@ -73,8 +70,9 @@ public class BytesFieldLocation extends CodeUnitLocation {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the index of byte that represents the current program location.
|
||||
* Sources that do not get this specific should simply return 0.
|
||||
* Returns the index of byte that represents the current program location. Sources that do not
|
||||
* get this specific should simply return 0.
|
||||
* @return the index
|
||||
*/
|
||||
public int getByteIndex() {
|
||||
return (int) getByteAddress().subtract(getAddress());
|
||||
|
@ -92,9 +90,10 @@ public class BytesFieldLocation extends CodeUnitLocation {
|
|||
|
||||
/**
|
||||
* Returns the character position within the byte specified by getByteIndex(). Normally,
|
||||
* this is 1,2, or 3 corresponding to before the byte, between the nibbles of the byte or
|
||||
* this is 1, 2, or 3 corresponding to before the byte, between the nibbles of the byte or
|
||||
* past the byte. Sometimes, extra delimiters may exist allowing the position to be
|
||||
* greater than 3.
|
||||
* @return the column
|
||||
*/
|
||||
public int getColumnInByte() {
|
||||
return getCharOffset();
|
||||
|
|
|
@ -83,15 +83,16 @@ public class CommentFieldLocation extends CodeUnitLocation {
|
|||
|
||||
/**
|
||||
* Returns the array of strings that make up the comment.
|
||||
* @return the comment
|
||||
*/
|
||||
public String[] getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the comment type. The type is either CodeUnit.EOL_COMMENT,
|
||||
* CodeUnit.POST_COMMENT, CodeUnit.PLATE_COMMENT, CodeUnit.PRE_COMMENT,
|
||||
* or CodeUnit.REPEATABLE_COMMENT.
|
||||
* Returns the comment type. The type is either CodeUnit.EOL_COMMENT, CodeUnit.POST_COMMENT,
|
||||
* CodeUnit.PLATE_COMMENT, CodeUnit.PRE_COMMENT, or CodeUnit.REPEATABLE_COMMENT.
|
||||
* @return the comment type
|
||||
*/
|
||||
public int getCommentType() {
|
||||
return type;
|
||||
|
@ -149,5 +150,4 @@ public class CommentFieldLocation extends CodeUnitLocation {
|
|||
comment = obj.getStrings("_COMMENT", new String[0]);
|
||||
type = obj.getInt("_TYPE", 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -460,15 +460,6 @@ public class ProgramLocation implements Comparable<ProgramLocation> {
|
|||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character offset in the display item at the (row,col).
|
||||
*
|
||||
* @return the character offset in the display item at the (row,col).
|
||||
*/
|
||||
public int getCharOffset() {
|
||||
return charOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the column index of the display piece represented by this location. For most
|
||||
* locations, there is only one display item per row, in which case this value will be 0.
|
||||
|
@ -478,4 +469,12 @@ public class ProgramLocation implements Comparable<ProgramLocation> {
|
|||
return col;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the character offset in the display item at the (row,col).
|
||||
*
|
||||
* @return the character offset in the display item at the (row,col).
|
||||
*/
|
||||
public int getCharOffset() {
|
||||
return charOffset;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue