From 9979a6f9ecb6cc2e7c030411c9308c1db97ee568 Mon Sep 17 00:00:00 2001 From: emteere <47253321+emteere@users.noreply.github.com> Date: Thu, 17 Jul 2025 15:49:39 -0400 Subject: [PATCH] GP-5752 Fixed missing characters at the end of operands, for example closing parenthesis added in the base sleigh instruction constructor. --- .../trace/util/InstructionAdapterFromPrototype.java | 6 +++--- .../sleigh/SleighInstructionPrototype.java | 6 +++--- .../java/ghidra/app/util/PseudoInstruction.java | 6 +++--- .../ghidra/program/database/code/InstructionDB.java | 13 +------------ .../program/model/lang/InstructionPrototype.java | 7 +++---- .../ghidra/program/model/lang/InvalidPrototype.java | 6 +++--- 6 files changed, 16 insertions(+), 28 deletions(-) diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/InstructionAdapterFromPrototype.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/InstructionAdapterFromPrototype.java index 6a6f02ccb4..638a0b883d 100644 --- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/InstructionAdapterFromPrototype.java +++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/InstructionAdapterFromPrototype.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -145,7 +145,7 @@ public interface InstructionAdapterFromPrototype extends TraceInstruction { @Override default String getSeparator(int opIndex) { - return getPrototype().getSeparator(opIndex, getInstructionContext()); + return getPrototype().getSeparator(opIndex); } @Override diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/SleighInstructionPrototype.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/SleighInstructionPrototype.java index 5f95251a4e..1870351fec 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/SleighInstructionPrototype.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/sleigh/SleighInstructionPrototype.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -708,7 +708,7 @@ public class SleighInstructionPrototype implements InstructionPrototype { } @Override - public String getSeparator(int opIndex, InstructionContext context) { + public String getSeparator(int opIndex) { if (opIndex < 0 || opIndex > opresolve.length) { return null; } diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/PseudoInstruction.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/PseudoInstruction.java index 424a083659..92c8dc4868 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/PseudoInstruction.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/PseudoInstruction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -550,7 +550,7 @@ public class PseudoInstruction extends PseudoCodeUnit implements Instruction, In @Override public String getSeparator(int opIndex) { - return instrProto.getSeparator(opIndex, this); + return instrProto.getSeparator(opIndex); } @Override diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/InstructionDB.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/InstructionDB.java index 9bec2ce37c..739678f250 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/InstructionDB.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/InstructionDB.java @@ -349,18 +349,7 @@ public class InstructionDB extends CodeUnitDB implements Instruction, Instructio @Override public String getSeparator(int opIndex) { - - if (opIndex < 0 || opIndex >= getNumOperands()) { - return null; - } - - lock.acquire(); - try { - return proto.getSeparator(opIndex, this); - } - finally { - lock.release(); - } + return proto.getSeparator(opIndex); } @Override diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InstructionPrototype.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InstructionPrototype.java index 72c64fd101..ef9444bb79 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InstructionPrototype.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InstructionPrototype.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -194,10 +194,9 @@ public interface InstructionPrototype { * The separator string for numOperands+1 are the characters after the last operand. * * @param opIndex valid values are 0 thru numOperands+1 - * @param context the instruction context * @return separator string, or null if there is no string */ - public String getSeparator(int opIndex, InstructionContext context); + public String getSeparator(int opIndex); /** * Get a List of Objects that can be used to render an operands representation. diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InvalidPrototype.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InvalidPrototype.java index 0f0e86a98d..d7a12bfdfb 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InvalidPrototype.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/InvalidPrototype.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -176,7 +176,7 @@ public class InvalidPrototype implements InstructionPrototype, ParserContext { } @Override - public String getSeparator(int opIndex, InstructionContext context) { + public String getSeparator(int opIndex) { return null; }