Skip to content

Commit

Permalink
Ghidra: Match additional operand types when building commented expres…
Browse files Browse the repository at this point in the history
…sions

PiperOrigin-RevId: 662074933
Change-Id: I1f46a6cb86b04e25c8e16bbd85904513b8307dfe
  • Loading branch information
mike-hunhoff authored and copybara-github committed Aug 12, 2024
1 parent 7dfbaf4 commit 7a1534a
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.security.zynamics.BinExport.BinExport2;
import com.google.security.zynamics.BinExport.BinExport2.Builder;
import ghidra.app.nav.NavigationUtils;
import ghidra.program.database.symbol.EquateDB;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.block.BasicBlockModel;
Expand All @@ -39,6 +40,7 @@
import ghidra.program.model.listing.LabelString;
import ghidra.program.model.listing.Library;
import ghidra.program.model.listing.Listing;
import ghidra.program.model.listing.OperandRepresentationList;
import ghidra.program.model.listing.Parameter;
import ghidra.program.model.listing.Program;
import ghidra.program.model.listing.VariableOffset;
Expand Down Expand Up @@ -203,6 +205,10 @@ private Optional<Integer> addCommentedExpression(
BinExport2.Comment.Type commentType;
if (markupToken instanceof VariableOffset) {
commentType = BinExport2.Comment.Type.LOCAL_REFERENCE;
} else if (markupToken instanceof OperandRepresentationList) {
commentType = BinExport2.Comment.Type.DEFAULT;
} else if (markupToken instanceof EquateDB) {
commentType = BinExport2.Comment.Type.DEFAULT;
} else if (markupToken instanceof LabelString) {
var labelType = ((LabelString) markupToken).getLabelType();
if (labelType == LabelString.CODE_LABEL) {
Expand Down

0 comments on commit 7a1534a

Please sign in to comment.