From c6e33b89b48993cd81798219d6bce6626e63477a Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Tue, 9 Jun 2026 13:45:19 +0000 Subject: [PATCH] GP-6721: Improve the Dynamic GoTo dialog --- .../app/services/DebuggerListingService.java | 18 + .../DebuggerListingPlugin.html | 36 +- .../images/DebuggerGoToDialog.png | Bin 5978 -> 10778 bytes .../debug/gui/action/DebuggerGoToDialog.java | 85 +- .../debug/gui/action/DebuggerGoToTrait.java | 92 +- .../gui/action/WatchLocationTrackingSpec.java | 2 +- .../AbstractDebuggerSleighInputDialog.java | 11 +- .../gui/listing/DebuggerListingPlugin.java | 24 + .../gui/listing/DebuggerListingProvider.java | 10 +- .../memory/DebuggerMemoryBytesProvider.java | 13 +- .../gui/time/DebuggerTimeSelectionDialog.java | 7 + .../core/debug/gui/watch/DefaultWatchRow.java | 2 +- .../ghidra/pcode/exec/DebuggerPcodeUtils.java | 181 ++- .../DebuggerListingPluginScreenShots.java | 5 +- .../java/ghidra/pcode/struct/DefaultVar.java | 11 +- .../pcode/exec/SleighProgramCompiler.java | 14 +- .../java/ghidra/pcode/exec/SleighUtils.java | 117 +- .../ghidra/pcode/exec/SleighUtilsTest.java | 19 +- .../Framework/SoftwareModeling/build.gradle | 16 +- .../SoftwareModeling/certification.manifest | 2 + .../antlr/ghidra/sleigh/grammar/BaseLexer.g | 11 +- .../ghidra/sleigh/grammar/DisplayParser.g | 2 +- .../ghidra/sleigh/grammar/SemanticLexerHex.g | 30 + .../sleigh/grammar/SemanticLexerIdHex.g | 30 + .../ghidra/sleigh/grammar/SemanticParser.g | 13 +- .../ghidra/sleigh/grammar/SleighCompiler.g | 1196 ++++++++++------- .../antlr/ghidra/sleigh/grammar/SleighEcho.g | 2 +- .../ghidra/sleigh/grammar/SleighParser.g | 2 +- .../pcodeCPort/sleighbase/SleighBase.java | 11 +- .../pcodeCPort/slgh_compile/PcodeCompile.java | 50 +- .../slgh_compile/SleighCompile.java | 27 +- .../program/model/lang/PcodeParser.java | 25 +- .../grammar/AbstractSleighCompiler.java | 178 +++ .../sleigh/grammar/RadixBigInteger.java | 12 + .../ghidra/sleigh/grammar/SleighLexer.java | 8 +- .../listing/DebuggerListingProviderTest.java | 1 + .../pcode/exec/TraceRmiPcodeExecTest.java | 177 +++ 37 files changed, 1760 insertions(+), 680 deletions(-) create mode 100644 Ghidra/Framework/SoftwareModeling/src/main/antlr/ghidra/sleigh/grammar/SemanticLexerHex.g create mode 100644 Ghidra/Framework/SoftwareModeling/src/main/antlr/ghidra/sleigh/grammar/SemanticLexerIdHex.g create mode 100644 Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/sleigh/grammar/AbstractSleighCompiler.java diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java index d4e90cbecb..9d5fd6ed16 100644 --- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java +++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerListingService.java @@ -20,6 +20,7 @@ import ghidra.debug.api.action.AutoReadMemorySpec; import ghidra.debug.api.action.LocationTrackingSpec; import ghidra.debug.api.listing.MultiBlendedListingBackgroundColorModel; import ghidra.framework.plugintool.ServiceInfo; +import ghidra.pcode.exec.SleighUtils.LitIdMode; import ghidra.program.model.address.Address; import ghidra.program.util.ProgramSelection; @@ -94,6 +95,23 @@ public interface DebuggerListingService extends CodeViewerService { */ boolean goTo(Address address, boolean centerOnScreen); + /** + * Set the mode of the Go-to dialog's Sleigh expressions + *

+ * This applies to all Go-to dialogs among the dynamic providers, including listings and memory + * (hex byte) views. + * + * @param mode the new mode + */ + void setGoToSleighMode(LitIdMode mode); + + /** + * Get the mode of the Go-to dialog's Sleigh expressions + * + * @return the current mode + */ + LitIdMode getGoToSleighMode(); + /** * Obtain a coloring background model suitable for the given listing * diff --git a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html index be738abb7d..842597dcd8 100644 --- a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html +++ b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html @@ -154,25 +154,53 @@ point in time. If the current trace is live and at the present, the target may be queried to retrieve any machine state required to evaluate the expression. The expression may be in terms of labels, registers, and constants. Labels may come from the current trace or a program mapped - into the trace. Ambiguities are resolved arbitrarily.

+ into the trace. Ambiguities are resolved arbitrarily. Relative expressions are permitted by + starting with a plus (+) or minus (-). Additionally, a dot + (.) refers to the current address.

+

The radio buttons at the bottom indicate the default radix of integer literals:

+ + +

Note that a Go-To action can fail for many reasons, e.g., syntax errors, computation failures. One possible reason is that the address is not part of a memory region known to the debugger. This failure can be overcome by enabling Force Full View.

-

Some examples:

+

Some examples (in Hex mode):