Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6808: Removed Sytem.err/.out usage or added comment where needed

ghidravision64287a6e1460
diff --git a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiEventHandler.java b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiEventHandler.java
index 2efc29bfcc..e40b20144e 100644
--- a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiEventHandler.java
+++ b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiEventHandler.java
@@ -163,7 +163,7 @@ public class JdiEventHandler implements Runnable {
}
private DebugStatus processUnknown(Event event) {
- System.err.println("Unknown event: " + event);
+ Msg.debug(this, "Unknown event: " + event);
return null;
}
diff --git a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java
index 9569d39e55..65b980f06e 100644
--- a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java
+++ b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiCommands.java
@@ -272,15 +272,15 @@ public class JdiCommands {
public void ghidraTraceInfo() {
if (state.client == null) {
- Msg.error(this, "Not connected to Ghidra");
+ Msg.debug(this, "Not connected to Ghidra");
return;
}
- Msg.info(this, "Connected to " + state.client.getDescription());
+ Msg.debug(this, "Connected to " + state.client.getDescription());
if (state.trace == null) {
Msg.error(this, "No trace");
}
else {
- Msg.info(this, "Trace active");
+ Msg.debug(this, "Trace active");
}
}
@@ -288,8 +288,8 @@ public class JdiCommands {
JdiArch arch = connector.getArch();
LanguageID language = arch.computeGhidraLanguage();
CompilerSpecID compiler = arch.computeGhidraCompiler(language);
- Msg.info(this, "Selected Ghidra language: " + language);
- Msg.info(this, "Selected Ghidra compiler: " + compiler);
+ Msg.debug(this, "Selected Ghidra language: " + language);
+ Msg.debug(this, "Selected Ghidra compiler: " + compiler);
}
public void ghidraTraceTxStart(String description) {
@@ -304,7 +304,7 @@ public class JdiCommands {
public void ghidraTraceTxAbort() {
RmiTransaction tx = state.requireTx();
- Msg.info(this, "Aborting trace transaction!");
+ Msg.debug(this, "Aborting trace transaction!");
tx.abort();
state.resetTx();
}
@@ -377,7 +377,7 @@ public class JdiCommands {
try (RmiTransaction tx = state.trace.startTx("ghidraTraceInsertObj", false)) {
Lifespan span = state.trace.proxyObjectPath(path)
.insert(state.trace.getSnap(), Resolution.CR_ADJUST);
- System.out.println("Inserted object: lifespan=" + span);
+ Msg.debug(this, "Inserted object: lifespan=" + span);
}
}
@@ -385,7 +385,7 @@ public class JdiCommands {
state.requireTx();
try (RmiTransaction tx = state.trace.startTx("ghidraTraceRemoveObj", false)) {
Lifespan span = state.trace.proxyObjectPath(path).remove(state.trace.getSnap(), false);
- System.out.println("Removed object: lifespan=" + span);
+ Msg.debug(this, "Removed object: lifespan=" + span);
}
}
@@ -534,7 +534,7 @@ public class JdiCommands {
}
}
catch (VMDisconnectedException discExc) {
- Msg.info(this, "Activate failed - VM disconnected");
+ Msg.debug(this, "Activate failed - VM disconnected");
}
}
state.trace.activate(path);
@@ -781,7 +781,7 @@ public class JdiCommands {
insertObject(mrpath);
}
catch (UnsupportedOperationException e) {
- //Msg.info(this, e.getMessage());
+ //Msg.error(this, e.getMessage());
}
if (reftype instanceof ArrayType at) {
@@ -1191,7 +1191,7 @@ public class JdiCommands {
}
}
catch (UnsupportedOperationException e) {
- // Msg.info(this, e.getMessage());
+ // Msg.error(this, e.getMessage());
}
retainKeys(ppath, keys);
}
@@ -1419,7 +1419,7 @@ public class JdiCommands {
}
}
catch (Exception e) {
- Msg.info(this, e.getMessage());
+ Msg.error(this, e.getMessage());
}
retainKeys(path, keys);
}
@@ -2187,7 +2187,7 @@ public class JdiCommands {
int options) {
try {
Value val = ct.invokeMethod(thread, method, args, options);
- System.err.println(val);
+ Msg.debug(this, val);
}
catch (Exception e) {
throw new RuntimeException(e.getMessage());
@@ -2198,7 +2198,7 @@ public class JdiCommands {
List<Value> args, int options) {
try {
Value val = ref.invokeMethod(thread, method, args, options);
- System.out.println(val);
+ Msg.debug(this, val);
}
catch (Exception e) {
throw new RuntimeException(e.getMessage());
diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiReplyHandlerThread.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiReplyHandlerThread.java
index c6d9af0f68..2c6e1593c6 100644
--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiReplyHandlerThread.java
+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiReplyHandlerThread.java
@@ -56,7 +56,7 @@ public class RmiReplyHandlerThread extends Thread {
RequestResult result = client.pollRequest();
if (result == null) {
- System.err.println("REPLY without request: " + msg);
+ Msg.warn(this, "REPLY without request: " + msg);
continue;
}
RootMessage request = result.request;
diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/AbstractDBTraceMemoryManagerMemoryTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/AbstractDBTraceMemoryManagerMemoryTest.java
index 9500ce804f..4369cd3a6b 100644
--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/AbstractDBTraceMemoryManagerMemoryTest.java
+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/AbstractDBTraceMemoryManagerMemoryTest.java
@@ -15,6 +15,9 @@
*/
package ghidra.trace.database.memory;
+import static org.junit.Assert.*;
+import static org.junit.Assume.*;
+
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.file.Files;
@@ -22,6 +25,9 @@ import java.nio.file.Path;
import java.util.*;
import java.util.Map.Entry;
+import org.junit.Ignore;
+import org.junit.Test;
+
import db.DBHandle;
import db.Transaction;
import ghidra.framework.data.OpenMode;
@@ -34,14 +40,10 @@ import ghidra.trace.model.memory.*;
import ghidra.trace.model.memory.TraceMemoryOperations.StatePredicate;
import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.thread.TraceThreadManager;
+import ghidra.util.Msg;
import ghidra.util.SystemUtilities;
import ghidra.util.task.ConsoleTaskMonitor;
import ghidra.util.task.TaskMonitor;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-import static org.junit.Assume.assumeFalse;
public abstract class AbstractDBTraceMemoryManagerMemoryTest
extends AbstractDBTraceMemoryManagerTest {
@@ -738,11 +740,11 @@ public abstract class AbstractDBTraceMemoryManagerMemoryTest
}
protected void dumpStates() {
- System.err.println("STATES");
+ Msg.debug(this, "STATES");
for (DBTraceMemorySpace space : memory.getActiveSpaces()) {
for (Entry<TraceAddressSnapRange, TraceMemoryState> entry : space.stateMapSpace
.entries()) {
- System.err.println(" " + entry);
+ Msg.debug(this, " " + entry);
}
}
}
@@ -1139,7 +1141,7 @@ public abstract class AbstractDBTraceMemoryManagerMemoryTest
}
long current = System.currentTimeMillis();
double ticksPerSecond = 1000.0 * TICKS / (current - start);
- System.err.println("%f/s".formatted(ticksPerSecond));
+ Msg.debug(this, "%f/s".formatted(ticksPerSecond));
}
}
}
diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.java
index 7d33a83c76..605eb20870 100644
--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.java
+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.java
@@ -16,7 +16,7 @@
package ghidra.trace.database.target;
import static org.junit.Assert.*;
-import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.*;
import java.io.File;
import java.math.BigInteger;
@@ -42,6 +42,7 @@ import ghidra.trace.model.target.schema.SchemaContext;
import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;
import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.thread.TraceThreadManager;
+import ghidra.util.Msg;
import ghidra.util.SystemUtilities;
import ghidra.util.database.DBAnnotatedObject;
import ghidra.util.database.DBCachedObjectStore;
@@ -938,9 +939,9 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationT
}
protected <T extends DBAnnotatedObject> void dumpStore(DBCachedObjectStore<T> store) {
- /*System.err.println("Contents of " + store);
+ /*Msg.info(this, "Contents of " + store);
for (T t : store.asMap().values()) {
- System.err.println(
+ Msg.info(this,
" " + t.getClass().getSimpleName() + "(key=" + t.getKey() + ",obj=" + t + ")");
}*/
}
@@ -1191,7 +1192,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationT
}
long current = System.currentTimeMillis();
double ticksPerSecond = 1000.0 * TICKS / (current - start);
- System.err.println("%f/s".formatted(ticksPerSecond));
+ Msg.info(this, "%f/s".formatted(ticksPerSecond));
}
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/JShellRun.java b/Ghidra/Features/Base/src/main/java/ghidra/JShellRun.java
index c8ccbf5afb..5a13119ae8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/JShellRun.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/JShellRun.java
@@ -26,6 +26,7 @@ public class JShellRun implements GhidraLaunchable {
@Override
public void launch(GhidraApplicationLayout layout, String[] args) throws Exception {
if (Stream.of(args).anyMatch(a -> a.startsWith("--execution"))) {
+ // Do not use logging as this is a launchable
System.err.println("Ignoring --execution option. Overridden to local");
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringModel.java
index 40b16d9bb6..257a2815a8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringModel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/StringModel.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.
@@ -18,6 +18,8 @@ package ghidra.app.plugin.core.string;
import java.io.*;
import java.util.*;
+import ghidra.util.Msg;
+
public class StringModel {
private int[][][] asciiTrigramStorage;
@@ -76,7 +78,8 @@ public class StringModel {
textReps[i] = asciiNumToDescription.get(i)[0];
}
else {
- System.err.println("ERROR: Could not find character mapping for ASCII code " +
+ Msg.error(StringModel.class,
+ "ERROR: Could not find character mapping for ASCII code " +
i);
}
}
@@ -200,11 +203,11 @@ public class StringModel {
}
}
catch (UnsupportedEncodingException e) {
- System.err.println("Error creating String Model file: " + e.toString());
+ Msg.error(this, "Error creating String Model file: " + e.toString());
System.exit(0);
}
catch (FileNotFoundException e) {
- System.err.println("Error creating String Model file: " + e.toString());
+ Msg.error(this, "Error creating String Model file: " + e.toString());
System.exit(0);
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/ThreadedTerminal.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/ThreadedTerminal.java
index 497639fa7d..dda4a4810b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/ThreadedTerminal.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/ThreadedTerminal.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.
@@ -64,6 +64,7 @@ public class ThreadedTerminal extends DefaultTerminal {
static void printBuffer(String prefix, ByteBuffer bb) {
byte[] bytes = new byte[bb.remaining()];
bb.get(bb.position(), bytes);
+ // Do not use logging because of threaded buffer use
System.err.print(prefix);
try {
String str = new String(bytes, "US-ASCII");
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/vt/VtParser.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/vt/VtParser.java
index 45784575f2..8b806f7db2 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/vt/VtParser.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/vt/VtParser.java
@@ -142,6 +142,7 @@ public class VtParser {
protected void debugChar(char c) {
if (!Character.isISOControl(c)) {
+ // Logging may not have been initialized yet, use System
System.err.println("\\x%02x (%c)".formatted(c & 0xff, c));
}
else {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/ObfuscatedInputStream.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/ObfuscatedInputStream.java
index 76d75ac436..2592bad8be 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/ObfuscatedInputStream.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/ObfuscatedInputStream.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.
@@ -72,6 +72,7 @@ public class ObfuscatedInputStream extends InputStream {
*/
public static void main(String[] args) throws IOException {
if (args.length != 2 || (args.length > 1 && args[0].equals("--help"))) {
+ // Do not use logging here
System.err.println("De-Obfuscator Usage:");
System.err.println("\t" + ObfuscatedInputStream.class.getName() +
" obfuscated_input_filename_path plain_dest_output_filename_path");
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/cparser/CPP/DefineTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/cparser/CPP/DefineTable.java
index c84c90e05d..f29723a240 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/cparser/CPP/DefineTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/cparser/CPP/DefineTable.java
@@ -310,9 +310,6 @@ public class DefineTable {
pos++;
}
}
- if (replaceCount >= ARBITRARY_MAX_REPLACEMENTS) {
- System.err.println(" replace " + image + " hit limit");
- }
return buf.toString();
}
@@ -383,7 +380,7 @@ public class DefineTable {
if (argv == null && sublist.contains(currKey)) {
if (!initialList) {
// stop recursion of replacement
- System.err.println("DONT Replace " + currKey + " in: " + buf);
+ Msg.warn(this, "DONT Replace " + currKey + " in: " + buf);
}
return -1;
}
@@ -779,7 +776,7 @@ public class DefineTable {
public String expandDefine(String defName) {
// don't worry about macros
if (isArg(defName)) {
- //System.err.println(defName + " = " + getValue(defName));
+ //Msg.info(this, defName + " = " + getValue(defName));
return null;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/AnalyzeHeadless.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/AnalyzeHeadless.java
index 39f08eb854..62a583a3e5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/AnalyzeHeadless.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/AnalyzeHeadless.java
@@ -136,6 +136,7 @@ public class AnalyzeHeadless implements GhidraLaunchable {
ghidraURL = new URI(args[0]).toURL();
}
catch (MalformedURLException e) {
+ // NOTE: Logging has not been initialized, use System instead
System.err.println("Invalid Ghidra URL: " + args[0]);
usage();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/GhidraScriptRunner.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/GhidraScriptRunner.java
index 3defbd8195..840be4e2e9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/GhidraScriptRunner.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/GhidraScriptRunner.java
@@ -91,7 +91,7 @@ public class GhidraScriptRunner implements GhidraLaunchable {
}
private static void usage() {
- System.out.println("usage: GhidraScriptRunner <scriptName>.java");
+ Msg.info(GhidraScriptRunner.class, "usage: GhidraScriptRunner <scriptName>.java");
}
private GhidraScript getGhidraScript(String scriptName) throws Exception {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessErrorLogger.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessErrorLogger.java
index 7114556595..7c51ac67c1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessErrorLogger.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessErrorLogger.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.
@@ -50,6 +50,7 @@ class HeadlessErrorLogger implements ErrorLogger {
logWriter = w;
}
catch (IOException e) {
+ // This class is using its own error logging, do not use Msg here
System.err.println("Failed to open log file " + logFile + ": " + e.getMessage());
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/UpdateServerAllowList.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/UpdateServerAllowList.java
index 742b60546e..8f8f1295a8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/UpdateServerAllowList.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/UpdateServerAllowList.java
@@ -102,6 +102,7 @@ public class UpdateServerAllowList implements GhidraLaunchable {
UrlAllowListManager.getAccessMap();
List<ServerSpecification> servers = new ArrayList<>(accessMap.keySet());
if (servers.isEmpty()) {
+ // Do not use logging here as this is a launchable
System.out.println("Server Allow List is empty.");
}
else {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/test/TestEnv.java b/Ghidra/Features/Base/src/main/java/ghidra/test/TestEnv.java
index acf7f336b1..38a5a96638 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/test/TestEnv.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/test/TestEnv.java
@@ -1123,7 +1123,7 @@ public class TestEnv {
if (program.isClosed()) {
continue;
}
- System.err.println("->" + projectName + " " + program.getName());
+ Msg.error(TestEnv.class, "->" + projectName + " " + program.getName());
printProgramConsumers(program);
}
@@ -1249,9 +1249,9 @@ public class TestEnv {
protected void printProgramConsumers(Program program) {
List<?> consumerList = (List<?>) AbstractGenericTest.getInstanceField("consumers", program);
- System.err.println("\tConsumers for: " + program.getName());
+ Msg.error(this, "\tConsumers for: " + program.getName());
for (Object name : consumerList) {
- System.err.println("\t->" + name);
+ Msg.error(this, "\t->" + name);
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/GhidraJarBuilder.java b/Ghidra/Features/Base/src/main/java/ghidra/util/GhidraJarBuilder.java
index 6da03e18cd..28497e01bd 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/util/GhidraJarBuilder.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/util/GhidraJarBuilder.java
@@ -921,6 +921,7 @@ public class GhidraJarBuilder implements GhidraLaunchable {
private static void usage(String[] args) {
for (int i = 0; i < args.length; i++) {
+ // Do not use logging as this is a launchable
System.err.println("arg " + i + ": " + args[i]);
}
String invocationName = System.getProperty(INVOCATION_NAME_PROPERTY);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java
index 3bb6293f32..f80ac330a6 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java
@@ -52,6 +52,7 @@ import ghidra.program.model.symbol.RefType;
import ghidra.program.model.symbol.SourceType;
import ghidra.program.util.*;
import ghidra.test.AbstractProgramBasedTest;
+import ghidra.util.Msg;
public class CodeBrowserScreenMovementTest extends AbstractProgramBasedTest {
@@ -533,12 +534,12 @@ public class CodeBrowserScreenMovementTest extends AbstractProgramBasedTest {
cursorRight(fp);
if (!codeBrowser.getCurrentFieldText().equals(cb2.getCurrentFieldText())) {
- System.err.println("text not equal at cursor move: " + i);
+ Msg.error(this, "text not equal at cursor move: " + i);
}
assertEquals(codeBrowser.getCurrentFieldText(), cb2.getCurrentFieldText());
if (!codeBrowser.getCurrentFieldLoction().equals(cb2.getCurrentFieldLoction())) {
- System.err.println("location not equal at cursor move: " + i);
+ Msg.error(this, "location not equal at cursor move: " + i);
}
assertEquals(codeBrowser.getCurrentFieldLoction(), cb2.getCurrentFieldLoction());
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/CreateArchive1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/CreateArchive1Test.java
index a6e048a4de..7df16aaa19 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/CreateArchive1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/CreateArchive1Test.java
@@ -206,15 +206,15 @@ public class CreateArchive1Test extends AbstractCreateArchiveTest {
// debug
if (archiveNode == null) {
List<GTreeNode> children = archiveRootNode.getChildren();
- System.err.println("did not find new node - children: ");
+ Msg.debug(this, "did not find new node - children: ");
for (GTreeNode treeNode : children) {
- System.err.println("\tchild: " + treeNode.getName());
+ Msg.debug(this, "\tchild: " + treeNode.getName());
}
sleep(5000);
children = archiveRootNode.getChildren();
- System.err.println("did not find new node - children: ");
+ Msg.debug(this, "did not find new node - children: ");
for (GTreeNode treeNode : children) {
- System.err.println("\tchild: " + treeNode.getName());
+ Msg.debug(this, "\tchild: " + treeNode.getName());
}
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPluginTest.java
index 0b8bebffd5..a77bfadc48 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/datamgr/DataTypeManagerPluginTest.java
@@ -1669,7 +1669,7 @@ public class DataTypeManagerPluginTest extends AbstractGhidraHeadedIntegrationTe
}
}
catch (FileNotFoundException e) {
- Msg.error(this, "Unable to delete test dir?: " + e);
+ Msg.error(this, "Unable to delete test dir?: " + e.getMessage(), e);
}
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java
index c264487d2f..dfbc4fafda 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java
@@ -680,7 +680,7 @@ public abstract class AbstractGhidraScriptMgrPluginTest
String fileText = readFileContents(file);
if (!expectedContents.trim().equals(fileText.trim())) {
- System.err.println(
+ Msg.error(this,
"Contents of file on disk do not match that of the editor after performing " +
"a save operation: " + file);
printChars(expectedContents, fileText);
@@ -698,7 +698,7 @@ public abstract class AbstractGhidraScriptMgrPluginTest
String fileText = readFileContents(file);
if (!expectedContents.trim().equals(fileText.trim())) {
- System.err.println("Contents of file on disk have been unexpectedly changed: " + file);
+ Msg.error(this, "Contents of file on disk have been unexpectedly changed: " + file);
printChars(expectedContents, fileText);
Assert.fail("Contents of file on disk have been unexpectedly changed: " + file);
}
@@ -800,7 +800,7 @@ public abstract class AbstractGhidraScriptMgrPluginTest
if (!expectedText.equals(box[0])) {
// // let's examine these strings a bit closer, as something in the error reporting
// // is not quite right
-// System.err.println("length of strings: " + expectedText.length() + " and " +
+// Msg.error(this, "length of strings: " + expectedText.length() + " and " +
// box[0].length());
//
// int start = 0;
@@ -808,19 +808,19 @@ public abstract class AbstractGhidraScriptMgrPluginTest
// for (StringDiff diff : diffs) {
// boolean isInsert = diff.insertData != null;
// if (isInsert) {
-// System.err.println("\n\n>>>\t\tdiff context:\t\t<<<\n" +
+// Msg.error(this, "\n\n>>>\t\tdiff context:\t\t<<<\n" +
// box[0].substring(start, diff.pos1 - diff.insertData.length()));
-// System.err.println("\n\n>>>>\tinserted value:\t\t<<<\n" + diff.insertData);
+// Msg.error(this, "\n\n>>>>\tinserted value:\t\t<<<\n" + diff.insertData);
// }
// else {
-// System.err.println("\n\n>>>\t\tdiff context:\t\t<<<\n" +
+// Msg.error(this, "\n\n>>>\t\tdiff context:\t\t<<<\n" +
// box[0].substring(start, diff.pos1));
-// System.err.println("\n\n>>>>\tdeleted value:\t\t<<<\n" +
+// Msg.error(this, "\n\n>>>>\tdeleted value:\t\t<<<\n" +
// expectedText.substring(diff.pos1, diff.pos2));
// }
// }
//
- System.err.println("The editor's text does not contain the expected text");
+ Msg.error(this, "The editor's text does not contain the expected text");
printChars(expectedText, box[0]);
Assert.fail("The editor's text does not contain the expected text");
}
@@ -830,16 +830,16 @@ public abstract class AbstractGhidraScriptMgrPluginTest
protected void printChars(String expected, String found) {
// maybe there is a whitespace issue...print each char code
- System.err.println("chars for expected string: ");
+ Msg.error(this, "chars for expected string: ");
for (int i = 0; i < expected.length(); i++) {
char c = expected.charAt(i);
- System.err.println(c + " and value: " + ((int) c));
+ Msg.error(this, c + " and value: " + ((int) c));
}
- System.err.println("chars for found string: ");
+ Msg.error(this, "chars for found string: ");
for (int i = 0; i < found.length(); i++) {
char c = found.charAt(i);
- System.err.println(c + " and value: " + ((int) c));
+ Msg.error(this, c + " and value: " + ((int) c));
}
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java
index ff8a790c76..699b16abce 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin1Test.java
@@ -56,6 +56,7 @@ import ghidra.program.model.symbol.SourceType;
import ghidra.program.util.*;
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
import ghidra.test.TestEnv;
+import ghidra.util.Msg;
import ghidra.util.table.AddressBasedTableModel;
import ghidra.util.table.PreviewTableCellData;
import ghidra.util.table.field.*;
@@ -1009,7 +1010,7 @@ public class SearchTextPlugin1Test extends AbstractGhidraHeadedIntegrationTest {
int rowCount = model.getRowCount();
rowCount = Math.min(rowCount, 20);
for (int i = 0; i < rowCount; i++) {
- System.err.println("preview for row " + i + ": " + getPreviewString(model, i));
+ Msg.debug(this, "preview for row " + i + ": " + getPreviewString(model, i));
}
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/datatype/DataTypeSelectionDialogTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/datatype/DataTypeSelectionDialogTest.java
index e9a23e7e2f..fd54c2a3f8 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/datatype/DataTypeSelectionDialogTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/datatype/DataTypeSelectionDialogTest.java
@@ -161,7 +161,7 @@ public class DataTypeSelectionDialogTest extends AbstractGhidraHeadedIntegration
@After
public void tearDown() throws Exception {
- System.err.println("tearDown() - " + testName.getMethodName() + "\n");
+ Msg.debug(this, "tearDown() - " + testName.getMethodName() + "\n");
for (PersistentDataTypeArchive archive : archivesToClose) {
closeArchive(archive);
@@ -540,7 +540,7 @@ public class DataTypeSelectionDialogTest extends AbstractGhidraHeadedIntegration
File imageFile = new File(temp, name + ".img.png");
try {
ImageUtils.writeFile((RenderedImage) image, imageFile);
- Msg.info(this, "Captured screenshot to " + imageFile.getCanonicalPath());
+ Msg.debug(this, "Captured screenshot to " + imageFile.getCanonicalPath());
}
catch (Exception e) {
Msg.error(this, "Unable to write debug image");
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/FieldUtilsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/FieldUtilsTest.java
index f8a5e715b7..161293620c 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/FieldUtilsTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/FieldUtilsTest.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.
@@ -15,7 +15,7 @@
*/
package ghidra.app.util.viewer.field;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
@@ -108,9 +108,9 @@ public class FieldUtilsTest extends AbstractGhidraHeadedIntegrationTest {
// used for debug while developing tests
// private void printAttributedStrings( FieldElement[] attributedStrings ) {
-// System.err.println( "AttributedStrings: ");
+// Msg.info(this, "AttributedStrings: ");
// for (int i = 0; i < attributedStrings.length; i++) {
-// System.err.println( ":: " + attributedStrings[i].getText() );
+// Msg.info(this, ":: " + attributedStrings[i].getText() );
// }
// }
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/DefaultProjectDataTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/DefaultProjectDataTest.java
index 9be87dcce7..a0be34fa3b 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/DefaultProjectDataTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/DefaultProjectDataTest.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.
@@ -36,6 +36,7 @@ import ghidra.program.database.ProgramDB;
import ghidra.program.model.lang.Language;
import ghidra.program.model.listing.Program;
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
+import ghidra.util.Msg;
import ghidra.util.task.TaskMonitor;
public class DefaultProjectDataTest extends AbstractGhidraHeadedIntegrationTest {
@@ -133,7 +134,7 @@ public class DefaultProjectDataTest extends AbstractGhidraHeadedIntegrationTest
}
}
if (!file.delete()) {
- System.err.println("Failed to delete file: " + file);
+ Msg.error(this, "Failed to delete file: " + file);
}
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/GhidraFolderTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/GhidraFolderTest.java
index 8c7b80b799..0e82c94fb3 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/GhidraFolderTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/data/GhidraFolderTest.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.
@@ -218,19 +218,12 @@ public class GhidraFolderTest extends AbstractGhidraHeadedIntegrationTest {
@Test
public void testCopyTo() throws Exception {
- System.err.println("folders.length: " + root.getFolders().length);
GhidraFolder aFolder = root.getFolder("a");
GhidraFolder bFolder = root.getFolder("b");
aFolder.copyTo(bFolder, null);
GhidraFolder[] folders = root.getFolders();
- if (folders.length != 3) {
- System.err.println("Folders of " + root.getName());
- for (GhidraFolder folder : folders) {
- System.err.println("\t" + folder);
- }
- }
assertEquals(3, folders.length);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/options/ToolPluginOptionsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/options/ToolPluginOptionsTest.java
index 8e2da468fb..d17237fa0b 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/options/ToolPluginOptionsTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/options/ToolPluginOptionsTest.java
@@ -120,10 +120,10 @@ public class ToolPluginOptionsTest extends AbstractGhidraHeadedIntegrationTest {
List<String> diffs = getDiffs(initialValues, latestValues);
if (diffs.size() != 0) {
- System.err.println(
+ Msg.info(this,
"Options values are not restored back to the original settings - diffs");
for (String diff : diffs) {
- System.err.println("\tdiff: " + diff);
+ Msg.info(this, "\tdiff: " + diff);
}
Assert.fail("Options values not restored (see error output)");
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingUtilsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingUtilsTest.java
index 111b17ba7d..69cefa5d96 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingUtilsTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/plugintool/dialog/KeyBindingUtilsTest.java
@@ -689,7 +689,7 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
// short-circuit if there are any data that don't match
if (!match) {
- System.err.println("Found non-matching option: propertyName " + propertyName +
+ Msg.error(this, "Found non-matching option: propertyName " + propertyName +
", value 1 = " + value + ", value 2 = " + value2);
Assert.fail(message);
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/AbstractToolSavingTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/AbstractToolSavingTest.java
index e2a0fd670d..6ffbf184ed 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/AbstractToolSavingTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/AbstractToolSavingTest.java
@@ -284,21 +284,21 @@ public abstract class AbstractToolSavingTest extends AbstractGhidraHeadedIntegra
protected void dumpToolFile(String name) throws IOException {
File file = ToolUtils.getToolFile(name);
List<String> lines = FileUtilities.getLines(file);
- System.err.println("Tool contents '" + name + "': ");
+ Msg.debug(this, "Tool contents '" + name + "': ");
for (String line : lines) {
- System.err.println(line);
+ Msg.debug(this, line);
}
}
protected void printToolXmlContainting(String name, String text) throws IOException {
File file = ToolUtils.getToolFile(name);
List<String> lines = FileUtilities.getLines(file);
- System.err.println("Tool '" + file + "'\n\t- lines containing '" + text + "': ");
+ Msg.debug(this, "Tool '" + file + "'\n\t- lines containing '" + text + "': ");
Pattern p = Pattern.compile(".*" + Pattern.quote(text) + ".*");
for (String line : lines) {
Matcher m = p.matcher(line);
if (m.matches()) {
- System.err.println(line);
+ Msg.debug(this, line);
}
}
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ExtensionManagerIntegrationTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ExtensionManagerIntegrationTest.java
index 6071ad942c..0e1a18ba29 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ExtensionManagerIntegrationTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ExtensionManagerIntegrationTest.java
@@ -233,7 +233,7 @@ public class ExtensionManagerIntegrationTest extends AbstractGhidraHeadedIntegra
// 1. Get the system Java compiler
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (compiler == null) {
- System.err.println("JDK not found. Make sure you are running a JDK, not a JRE.");
+ Msg.error(this, "JDK not found. Make sure you are running a JDK, not a JRE.");
fail();
return null;
}
@@ -292,12 +292,12 @@ public class ExtensionManagerIntegrationTest extends AbstractGhidraHeadedIntegra
// 7. Process the diagnostics
if (success) {
- System.out.println("Compilation successful.");
+ Msg.info(this, "Compilation successful.");
}
else {
- System.out.println("Compilation failed.");
+ Msg.error(this, "Compilation failed.");
for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
- System.out.println(diagnostic.getKind() + ": " + diagnostic.getMessage(null) +
+ Msg.error(this, diagnostic.getKind() + ": " + diagnostic.getMessage(null) +
" (Line: " + diagnostic.getLineNumber() + ")");
}
}
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ToolSaving1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ToolSaving1Test.java
index 0a8bb82bd1..5955e1d2d2 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ToolSaving1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/framework/project/tool/ToolSaving1Test.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.
@@ -111,7 +111,7 @@ public class ToolSaving1Test extends AbstractToolSavingTest {
tool = launchTool(DEFAULT_TEST_TOOL_NAME);
Point restoredToolPosition = getToolPosition(tool);
if (!position.equals(restoredToolPosition)) {
- System.err.println("About to fail test. Did the correct x,y values get saved?: ");
+ Msg.error(this, "About to fail test. Did the correct x,y values get saved?: ");
printToolXmlContainting(DEFAULT_TEST_TOOL_NAME, "X_POS");
// dumpToolFile(DEFAULT_TEST_TOOL_NAME);
}
diff --git a/Ghidra/Features/Base/src/test/java/ghidra/JunitTestScan.java b/Ghidra/Features/Base/src/test/java/ghidra/JunitTestScan.java
index c6956c91f5..ae4416bb50 100644
--- a/Ghidra/Features/Base/src/test/java/ghidra/JunitTestScan.java
+++ b/Ghidra/Features/Base/src/test/java/ghidra/JunitTestScan.java
@@ -49,6 +49,7 @@ public class JunitTestScan {
public static void main(String[] args) {
if (args.length != 1) {
+ // NOTE: logging has not been initialized, use System instead
System.err.println("Incorrect usage!");
System.exit(-1);
}
diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/util/cparser/PreProcessorTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/util/cparser/PreProcessorTest.java
index 053176ec67..4958207cc8 100644
--- a/Ghidra/Features/Base/src/test/java/ghidra/app/util/cparser/PreProcessorTest.java
+++ b/Ghidra/Features/Base/src/test/java/ghidra/app/util/cparser/PreProcessorTest.java
@@ -28,6 +28,7 @@ import ghidra.app.util.cparser.CPP.PreProcessor;
import ghidra.program.database.data.TransientDataTypeManager;
import ghidra.program.model.data.*;
import ghidra.program.model.data.Enum;
+import ghidra.util.Msg;
public class PreProcessorTest extends AbstractGenericTest {
private static String resourceName = "PreProcessorTest.h";
@@ -64,7 +65,7 @@ public class PreProcessorTest extends AbstractGenericTest {
}
catch (ParseException e) {
// TODO Auto-generated catch block
- e.printStackTrace();
+ Msg.error(this, e, e);
}
parser.setOutputStream(baos);
@@ -86,13 +87,13 @@ public class PreProcessorTest extends AbstractGenericTest {
parser.parse(url.getFile());
}
catch (ParseException e) {
- e.printStackTrace();
+ Msg.error(this, e, e);
}
System.out.println(parser.getParseMessages());
// Uncomment to print out parse results
- //System.err.println(baos.toString());
+ //Msg.info(this, baos.toString());
dtMgr = new TransientDataTypeManager("parsed");
parser.getDefinitions().populateDefineEquates(null, dtMgr);
diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java
index 1e449b9578..05b564ca12 100644
--- a/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java
+++ b/Ghidra/Features/Base/src/test/java/ghidra/app/util/html/HTMLDataTypeRepresentationTest.java
@@ -33,7 +33,7 @@ import generic.theme.GThemeDefaults.Colors;
import ghidra.app.util.ToolTipUtils;
import ghidra.program.model.data.*;
import ghidra.program.model.data.Composite;
-import ghidra.util.exception.DuplicateNameException;
+import ghidra.util.Msg;
public class HTMLDataTypeRepresentationTest extends AbstractGenericTest {
@@ -1461,7 +1461,7 @@ public class HTMLDataTypeRepresentationTest extends AbstractGenericTest {
JPanel rightPanel = new JPanel(new BorderLayout());
String rightHtml = right.getHTMLString();
- System.err.println("Right HTML: " + rightHtml);
+ Msg.info(HTMLDataTypeRepresentation.class, "Right HTML: " + rightHtml);
StringBuffer buffy1 = new StringBuffer(rightHtml);
JLabel rightLabel = new GDHtmlLabel();
rightLabel.setOpaque(true);
@@ -1471,7 +1471,7 @@ public class HTMLDataTypeRepresentationTest extends AbstractGenericTest {
JPanel leftPanel = new JPanel(new BorderLayout());
String leftHtml = left.getHTMLString();
- System.err.println("Left HTML: " + leftHtml);
+ Msg.info(HTMLDataTypeRepresentation.class, "Left HTML: " + leftHtml);
StringBuffer buffy2 = new StringBuffer(leftHtml);
JLabel leftLabel = new GDHtmlLabel();
leftLabel.setOpaque(true);
diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/decode/JitPassageDecoderTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/decode/JitPassageDecoderTest.java
index e3cf50ccd6..4172c9c605 100644
--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/decode/JitPassageDecoderTest.java
+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/decode/JitPassageDecoderTest.java
@@ -15,7 +15,7 @@
*/
package ghidra.pcode.emu.jit.decode;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.*;
import java.util.Map.Entry;
@@ -30,6 +30,7 @@ import ghidra.pcode.emu.jit.op.JitOp;
import ghidra.pcode.exec.PcodeUseropLibrary;
import ghidra.pcode.utils.Utils;
import ghidra.program.model.pcode.PcodeOp;
+import ghidra.util.Msg;
public class JitPassageDecoderTest extends AbstractJitTest {
void dumpFolded(JitAnalysisContext context) {
@@ -37,7 +38,7 @@ public class JitPassageDecoderTest extends AbstractJitTest {
for (Entry<Operand, byte[]> ent : context.getPassage().allFoldedOperands().entrySet()) {
byte[] v = ent.getValue();
Operand k = ent.getKey();
- System.err.println("%s %s=0x%s".formatted(k.op().getSeqnum(), k,
+ Msg.debug(this, "%s %s=0x%s".formatted(k.op().getSeqnum(), k,
Utils.bytesToBigInteger(v, v.length, language.isBigEndian(), false).toString(16)));
}
}