From dbe670bf85edd9c38608ade2817cac0ac4143d10 Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Fri, 6 May 2022 15:08:09 -0400 Subject: [PATCH] GP-1881: Implement editable Repr column for Registers and Watches providers. --- .../DebuggerObjectsPlugin.html | 6 +- .../DebuggerRegistersPlugin.html | 3 +- .../DebuggerWatchesPlugin.html | 8 +- .../register/DebuggerRegistersProvider.java | 44 ++++++++-- .../core/debug/gui/register/RegisterRow.java | 8 +- .../gui/watch/DebuggerWatchesProvider.java | 6 +- .../plugin/core/debug/gui/watch/WatchRow.java | 41 ++++++++- .../DebuggerRegistersProviderTest.java | 48 ++++++++++ .../watch/DebuggerWatchesProviderTest.java | 87 ++++++++++++++++++- .../trace/model/time/schedule/PatchStep.java | 48 +++++++++- .../model/time/schedule/TraceSchedule.java | 24 +++++ .../ghidra/trace/util/TraceRegisterUtils.java | 19 ++++ 12 files changed, 314 insertions(+), 28 deletions(-) diff --git a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.html b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.html index df1f77ae1c..e03a7277b2 100644 --- a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.html +++ b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.html @@ -325,9 +325,9 @@
By default, events are passed to the Objects Viewer even while the target is running. - The resulting changes in the GUI may be distracting for some. To disable updates to the - Objects Viewer, toggle "Updates While Running" off.
+By default, events are passed to the Objects Viewer even while the target is running. The + resulting changes in the GUI may be distracting for some. To disable updates to the Objects + Viewer, toggle "Updates While Running" off.
+ * Note that when length is greater than 8, this will generate constants which are too large for
+ * the Java implementation of Sleigh. Use {@link #generateSleigh(Language, Address, byte[])}
+ * instead to write the variable in chunks.
+ *
+ * @param language the target language
+ * @param address the (start) address of the variable
+ * @param data the bytes to write to the variable
+ * @param length the length of the variable
+ * @return the Sleigh code
+ */
+ public static String generateSleighLine(Language language, Address address, byte[] data,
int length) {
BigInteger value = Utils.bytesToBigInteger(data, length, language.isBigEndian(), false);
if (address.isMemoryAddress()) {
@@ -67,8 +81,34 @@ public class PatchStep implements Step {
return String.format("%s=0x%s", register, value.toString(16));
}
- public static String generateSleigh(Language language, Address address, byte[] data) {
- return generateSleigh(language, address, data, data.length);
+ /**
+ * Generate a single line of Sleigh
+ *
+ * @see #generateSleighLine(Language, Address, byte[], int)
+ */
+ public static String generateSleighLine(Language language, Address address, byte[] data) {
+ return generateSleighLine(language, address, data, data.length);
+ }
+
+ /**
+ * Generate multiple lines of Sleigh, all to set a single variable
+ *
+ * @param language the target language
+ * @param address the (start) address of the variable
+ * @param data the bytes to write to the variable
+ * @return the lines of Sleigh code
+ */
+ public static List