Ghidra is a software reverse engineering (SRE) framework
GP-6808:Continued clean up of System.out/.err usage.
ghidravision52fd511adf3f
diff --git a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.java b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.javaindex 6a77d876f9..72285900eb 100644--- a/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.java+++ b/Ghidra/Debug/AnnotationValidator/src/main/java/ghidra/util/database/annotproc/DBAnnotatedObjectProcessor.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.@@ -48,7 +48,6 @@ public class DBAnnotatedObjectProcessor extends AbstractProcessor {*/@Overridepublic synchronized void init(ProcessingEnvironment env) {- //System.err.println("HERE4");super.init(env);ctx = new ValidationContext(env);}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewPanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewPanel.javaindex 16a66d7446..1b30609d49 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewPanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memview/MemviewPanel.java@@ -233,10 +233,6 @@ public class MemviewPanel extends JPanel implements MouseListener, MouseMotionLiprovider.refresh();}- if (e.getButton() == MouseEvent.BUTTON2) {- System.err.println("BUTTON2");- }-if (e.getButton() == MouseEvent.BUTTON3) {ctrlPressed = true;enableDrag = true;diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/SymStateSpace.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/SymStateSpace.javaindex 58b00a584b..056aa5b372 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/SymStateSpace.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/stack/SymStateSpace.java@@ -307,10 +307,10 @@ public class SymStateSpace {for (SymEntry ent : map.values()) {Register register = ent.getRegister(language);if (register != null) {- System.err.println(prefix + register + " = " + ent.sym);+ Msg.info(this, prefix + register + " = " + ent.sym);continue;}- System.err.println(prefix + ent);+ Msg.info(this, prefix + ent);}}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/taint/AngrTaintState.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/taint/AngrTaintState.javaindex cd3d9d744f..ce165b43ad 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/taint/AngrTaintState.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/taint/AngrTaintState.java@@ -219,7 +219,7 @@ public class AngrTaintState extends AbstractTaintState {taintAddressSet.add(address);}else {- System.err.println(line);+ Msg.error(this, line);}}bufferedReader.close();diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/stack/StackUnwinderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/stack/StackUnwinderTest.javaindex 5981cbab9d..da3318c56d 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/stack/StackUnwinderTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/stack/StackUnwinderTest.java@@ -101,7 +101,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerTest {byte[] ins = res.getInstruction().getVals();// HACK to avoid 16-bit CALL.... TODO: Why does this happen?if (ins.length >= 2 && ins[0] == (byte) 0x66 && ins[1] == (byte) 0xe8) {- System.err.println(+ Msg.error(StackUnwinderTest.class,"Filtered 16-bit call " + NumericUtilities.convertBytesToString(ins));continue;}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java b/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.javaindex 6ee372a5ec..faf53b6929 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java@@ -41,6 +41,7 @@ public class GhidraApplicationConfiguration extends HeadlessGhidraApplicationConpublic GhidraApplicationConfiguration() {if (GraphicsEnvironment.isHeadless()) {+ // NOTE: System.err must be used here because Messaging hasn't been initialized yetSystem.err.println("ERROR: Unable to launch Ghidra GUI application in headless environment.");System.err.println(diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/util/UniversalIdGenerator.java b/Ghidra/Framework/Generic/src/main/java/ghidra/util/UniversalIdGenerator.javaindex 8a0d030b4a..544a773342 100644--- a/Ghidra/Framework/Generic/src/main/java/ghidra/util/UniversalIdGenerator.java+++ b/Ghidra/Framework/Generic/src/main/java/ghidra/util/UniversalIdGenerator.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.@@ -66,15 +66,4 @@ public class UniversalIdGenerator {}return newTime;}-- public static void main(String[] args) {- UniversalIdGenerator gen = new UniversalIdGenerator();- UniversalIdGenerator gen2 = new UniversalIdGenerator();- for (int i = 0; i < 500; i++) {- System.out.println("id = " + gen.getNextID().getValue() + " next = " +- Long.toHexString(gen.getNextID().getValue()));- System.out.println("id2 = " + gen2.getNextID().getValue() + " next = " +- Long.toHexString(gen2.getNextID().getValue()));- }- }}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.javaindex b3a0b47a4e..8d0bb7a6e4 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java@@ -16,7 +16,7 @@package agent.dbgeng.rmi;import static org.junit.Assert.*;-import static org.junit.Assume.assumeTrue;+import static org.junit.Assume.*;import java.io.*;import java.net.*;@@ -166,6 +166,7 @@ public abstract class AbstractDbgEngTraceRmiTest extends AbstractGhidraHeadedDeb}}catch (RuntimeException e) {+ // Should not happen since we maintain library on host test machine}return Paths.get(DummyProc.which("python"));}@@ -203,10 +204,6 @@ public abstract class AbstractDbgEngTraceRmiTest extends AbstractGhidraHeadedDebif (stderr.contains("Error") || (0 != exitCode && 1 != exitCode && 143 != exitCode)) {throw new PythonError(exitCode, stdout, stderr);}- System.out.println("--stdout--");- System.out.println(stdout);- System.out.println("--stderr--");- System.out.println(stderr);return stdout;}}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngStackUnwindTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngStackUnwindTest.javaindex 4e20baec33..b8852503b7 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngStackUnwindTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngStackUnwindTest.java@@ -15,8 +15,7 @@*/package agent.dbgeng.rmi;-import static org.junit.Assert.assertEquals;-import static org.junit.Assert.assertNotNull;+import static org.junit.Assert.*;import java.io.File;import java.io.IOException;@@ -67,8 +66,7 @@ import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.database.module.DBTraceStaticMappingManager;import ghidra.trace.model.Trace;import ghidra.trace.model.modules.TraceStaticMapping;-import ghidra.util.InvalidNameException;-import ghidra.util.NumericUtilities;+import ghidra.util.*;import ghidra.util.exception.CancelledException;import junit.framework.AssertionFailedError;@@ -636,7 +634,7 @@ public class DbgEngStackUnwindTest extends AbstractDbgEngTraceRmiTest {byte[] ins = res.getInstruction().getVals();// HACK to avoid 16-bit CALL.... TODO: Why does this happen?if (ins.length >= 2 && ins[0] == (byte) 0x66 && ins[1] == (byte) 0xe8) {- System.err.println(+ Msg.error(DbgEngStackUnwindTest.class,"Filtered 16-bit call " + NumericUtilities.convertBytesToString(ins));continue;}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.javaindex 1c850e2687..22b29c60e5 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java@@ -18,7 +18,7 @@ package agent.lldb.rmi;import static org.hamcrest.MatcherAssert.assertThat;import static org.hamcrest.Matchers.*;import static org.junit.Assert.*;-import static org.junit.Assume.assumeTrue;+import static org.junit.Assume.*;import java.util.*;@@ -45,6 +45,7 @@ import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;import ghidra.trace.model.target.path.PathFilter;import ghidra.trace.model.target.path.PathPattern;+import ghidra.util.Msg;@Category(NightlyCategory.class) // this may actually be an @PortSensitive testpublic class LldbMethodsTest extends AbstractLldbTraceRmiTest {@@ -688,7 +689,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {stepToCall(conn, step_over, thread);String dis2 = conn.executeCapture("dis -c2 -s '$pc'");- System.err.println(dis2);+ Msg.info(this, dis2);CallInstr instr = CallInstr.parse(dis2);// This winds up a step_into if lldb can't place its breakpointdiff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbStackUnwindTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbStackUnwindTest.javaindex 73d0fd012e..b9e52bb939 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbStackUnwindTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbStackUnwindTest.java@@ -66,8 +66,7 @@ import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.database.module.DBTraceStaticMappingManager;import ghidra.trace.model.Trace;import ghidra.trace.model.modules.TraceStaticMapping;-import ghidra.util.InvalidNameException;-import ghidra.util.NumericUtilities;+import ghidra.util.*;import ghidra.util.exception.CancelledException;import junit.framework.AssertionFailedError;@@ -649,7 +648,7 @@ public class LldbStackUnwindTest extends AbstractLldbTraceRmiTest {byte[] ins = res.getInstruction().getVals();// HACK to avoid 16-bit CALL.... TODO: Why does this happen?if (ins.length >= 2 && ins[0] == (byte) 0x66 && ins[1] == (byte) 0xe8) {- System.err.println(+ Msg.error(LldbStackUnwindTest.class,"Filtered 16-bit call " + NumericUtilities.convertBytesToString(ins));continue;}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.javaindex 0caa1e52e9..ce15fa2e36 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.java@@ -16,7 +16,7 @@package agent.x64dbg.rmi;import static org.junit.Assert.*;-import static org.junit.Assume.assumeTrue;+import static org.junit.Assume.*;import java.io.*;import java.net.*;@@ -160,6 +160,7 @@ public abstract class AbstractX64dbgTraceRmiTest extends AbstractGhidraHeadedDeb}}catch (RuntimeException e) {+ // Should not happen since we maintain library on host test machine}return Paths.get(DummyProc.which("python"));}@@ -208,10 +209,6 @@ public abstract class AbstractX64dbgTraceRmiTest extends AbstractGhidraHeadedDebif (stderr.contains("Error") || (0 != exitCode && 1 != exitCode && 143 != exitCode)) {throw new PythonError(exitCode, stdout, stderr);}- System.out.println("--stdout--");- System.out.println(stdout);- System.out.println("--stderr--");- System.out.println(stderr);return stdout;}}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.javaindex 3e7bfd62fc..34e5d2aa3f 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java@@ -54,7 +54,6 @@ import ghidra.debug.api.action.AutoReadMemorySpec;import ghidra.debug.api.control.ControlMode;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.framework.model.*;-import ghidra.pcode.exec.DebuggerPcodeUtils;import ghidra.program.model.address.*;import ghidra.program.model.data.PointerDataType;import ghidra.program.model.lang.Register;@@ -76,6 +75,7 @@ import ghidra.trace.model.stack.TraceStack;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.schema.SchemaContext;import ghidra.trace.model.thread.TraceThread;+import ghidra.util.Msg;@Category(NightlyCategory.class)public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerIntegrationTest {@@ -1304,9 +1304,9 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerIntDomainObjectListener spyListener = new DomainObjectListener() {@Overridepublic void domainObjectChanged(DomainObjectChangedEvent ev) {- System.err.println(ev);+ Msg.info(this, ev);for (DomainObjectChangeRecord rec : ev) {- System.err.println(" " + rec);+ Msg.info(this, " " + rec);}}};diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.javaindex 90d30ef023..0b39d353eb 100644--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.java+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/plugin/core/terminal/TerminalProviderTest.java@@ -15,9 +15,8 @@*/package ghidra.app.plugin.core.terminal;-import static org.junit.Assert.assertEquals;-import static org.junit.Assume.assumeFalse;-import static org.junit.Assume.assumeTrue;+import static org.junit.Assert.*;+import static org.junit.Assume.*;import java.io.File;import java.io.UnsupportedEncodingException;@@ -122,7 +121,6 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {term.addTerminalListener(new TerminalListener() {@Overridepublic void resized(short cols, short rows) {- // System.err.println("resized: " + cols + "x" + rows);child.setWindowSize(cols, rows);}});@@ -157,7 +155,6 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {term.addTerminalListener(new TerminalListener() {@Overridepublic void resized(short cols, short rows) {- // System.err.println("resized: " + cols + "x" + rows);child.setWindowSize(cols, rows);}});@@ -189,7 +186,6 @@ public class TerminalProviderTest extends AbstractGhidraHeadedDebuggerTest {term.addTerminalListener(new TerminalListener() {@Overridepublic void resized(short cols, short rows) {- // System.err.println("resized: " + cols + "x" + rows);child.setWindowSize(cols, rows);}});diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ProjectInfoDialogTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ProjectInfoDialogTest.javaindex 9d622c8fd1..3bce1eabaf 100644--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ProjectInfoDialogTest.java+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/ProjectInfoDialogTest.java@@ -38,6 +38,7 @@ import ghidra.program.database.ProgramBuilder;import ghidra.program.model.listing.Program;import ghidra.test.AbstractGhidraHeadedIntegrationTest;import ghidra.test.TestEnv;+import ghidra.util.Msg;import ghidra.util.exception.CancelledException;import ghidra.util.task.TaskMonitor;@@ -81,7 +82,7 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {RepositoryAdapter rep = null;try {// this can throw a NotConnectedException- System.err.println(getClass().getName() + "\tstarting server...");+ Msg.info(this, getClass().getName() + "\tstarting server...");rep = SharedProjectUtil.startServer();}catch (Exception e) {@@ -99,9 +100,9 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {try {DockingActionIf saveAction = getAction("Save Project");- System.err.println("\tsaving project");+ Msg.info(this, "\tsaving project");performAction(saveAction, true);- System.err.println("\tclosing project");+ Msg.info(this, "\tclosing project");DockingActionIf action = getAction("Close Project");performAction(action, true);}@@ -112,21 +113,21 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {}private void cleanupResources() throws Exception {- System.err.println(getClass().getName() + ".cleanupResources()...");+ Msg.info(this, getClass().getName() + ".cleanupResources()...");try {- System.err.println(getClass().getName() + "\tdisposing...");+ Msg.info(this, getClass().getName() + "\tdisposing...");env.dispose();- System.err.println(getClass().getName() + "\tstoring preferences...");+ Msg.info(this, getClass().getName() + "\tstoring preferences...");Preferences.setProperty("ServerInfo", null);Preferences.store();}finally {- System.err.println(getClass().getName() + "\tdeleting server root...");+ Msg.info(this, getClass().getName() + "\tdeleting server root...");SharedProjectUtil.deleteServerRoot();- System.err.println(getClass().getName() + "\tdeleting test project...");+ Msg.info(this, getClass().getName() + "\tdeleting test project...");SharedProjectUtil.deleteTestProject("TestProject");}- System.err.println(getClass().getName() + ".cleanupResources() done!s");+ Msg.info(this, getClass().getName() + ".cleanupResources() done!s");}@Test@@ -377,7 +378,7 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {}private void stepThroughWizard(boolean doFinish, final String repositoryName) throws Exception {- System.err.println(getClass().getName() + ".stepThroughWizard()...");+ Msg.info(this, getClass().getName() + ".stepThroughWizard()...");windowForComponent(dialog.getComponent());WizardDialog wm = waitForDialogComponent(WizardDialog.class);assertNotNull(wm);@@ -397,13 +398,13 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {portNumberField.setText(Integer.toString(SharedProjectUtil.SERVER_PORT));});- System.err.println(getClass().getName() + ".stepThroughWizard()\tpressing next button...");+ Msg.info(this, getClass().getName() + ".stepThroughWizard()\tpressing next button...");pressButton(nextButton);// next panel should be the repository panelRepositoryPanel repPanel = findComponent(wm, RepositoryPanel.class);- System.err.println(+ Msg.info(this,getClass().getName() + ".stepThroughWizard()\tfound repPanel: " + repPanel);final JList<?> repList = findComponent(repPanel, JList.class);ListModel<?> model = repList.getModel();@@ -429,6 +430,6 @@ public class ProjectInfoDialogTest extends AbstractGhidraHeadedIntegrationTest {assertTrue("The wizard panel is not closed for some reason", !wm.isShowing());- System.err.println(getClass().getName() + ".stepThroughWizard() done!");+ Msg.info(this, getClass().getName() + ".stepThroughWizard() done!");}}diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/SharedProjectUtil.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/SharedProjectUtil.javaindex 8f85223a5a..9d0a76e072 100644--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/SharedProjectUtil.java+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/SharedProjectUtil.java@@ -35,6 +35,7 @@ import ghidra.framework.main.wizard.project.*;import ghidra.framework.model.*;import ghidra.server.remote.ServerTestUtil;import ghidra.test.AbstractGhidraHeadlessIntegrationTest;+import ghidra.util.Msg;import ghidra.util.exception.DuplicateNameException;import ghidra.util.exception.UserAccessException;import utilities.util.FileUtilities;@@ -63,7 +64,8 @@ public class SharedProjectUtil {public static boolean createSharedProject(FrontEndTool frontEndTool, final String projectName)throws Exception {// create shared project against existing repository- System.err.println("SharedProjectUtil.createSharedProject(): " + projectName);+ Msg.info(SharedProjectUtil.class,+ "SharedProjectUtil.createSharedProject(): " + projectName);UtilProjectListener projectListener = new UtilProjectListener();frontEndTool.addProjectListener(projectListener);@@ -130,7 +132,7 @@ public class SharedProjectUtil {AbstractGuiTest.pressButton(finishButton, true);AbstractGuiTest.waitForSwing();boolean didOpen = waitForProjectToOpen(projectName, projectListener);- System.err.println("\tdid the project get opened?: " + didOpen);+ Msg.info(SharedProjectUtil.class, "\tdid the project get opened?: " + didOpen);return didOpen;}@@ -148,7 +150,8 @@ public class SharedProjectUtil {AbstractGuiTest.waitForSwing();boolean success = desiredProjectName.equals(lastOpenedProjectName);if (!success) {- System.err.println("\tOpen windows: " + AbstractDockingTest.getOpenWindowsAsString());+ Msg.info(SharedProjectUtil.class,+ "\tOpen windows: " + AbstractDockingTest.getOpenWindowsAsString());}return success;@@ -167,14 +170,14 @@ public class SharedProjectUtil {Thread.sleep(50);}catch (InterruptedException e) {- e.printStackTrace();+ Msg.error(SharedProjectUtil.class, e, e);}AbstractGhidraHeadlessIntegrationTest.deleteProject(projectDirectory.getAbsolutePath(),projectName);}if (count > 500) {- System.err.println("Could not delete " + projectName);+ Msg.warn(SharedProjectUtil.class, "Could not delete " + projectName);return false;}return true;@@ -192,7 +195,7 @@ public class SharedProjectUtil {* @throws Exception if there are any exceptions starting the server*/public static RepositoryAdapter startServer() throws Exception {- System.err.println("SharedProjectUtil.startServer()...");+ Msg.info(SharedProjectUtil.class, "SharedProjectUtil.startServer()...");repositoryServer = null;File parent = new File(AbstractGTest.getTestDirectoryPath());@@ -200,16 +203,19 @@ public class SharedProjectUtil {serverRoot = new File(parent, "My_Server");FileUtilities.deleteDir(serverRoot);- System.err.println("SharedProjectUtil.startServer()\tgetting server adapter...");+ Msg.info(SharedProjectUtil.class,+ "SharedProjectUtil.startServer()\tgetting server adapter...");repositoryServer = ServerTestUtil.getServerAdapter(serverRoot, new String[] { USER });- System.err.println("SharedProjectUtil.startServer()\tchecking connection...");+ Msg.info(SharedProjectUtil.class,+ "SharedProjectUtil.startServer()\tchecking connection...");if (repositoryServer == null || !repositoryServer.isConnected()) {deleteServerRoot();fail("Server connect failed");}- System.err.println("SharedProjectUtil.startServer()\tcreating repository...");+ Msg.info(SharedProjectUtil.class,+ "SharedProjectUtil.startServer()\tcreating repository...");return repositoryServer.createRepository("My_Repository");}@@ -243,12 +249,14 @@ public class SharedProjectUtil {@Overridepublic void projectClosed(Project project) {- System.err.println(getClass().getSimpleName() + ".projectClosed(): " + project);+ Msg.info(UtilProjectListener.class,+ getClass().getSimpleName() + ".projectClosed(): " + project);}@Overridepublic void projectOpened(Project project) {- System.err.println(getClass().getSimpleName() + ".projectOpened(): " + project);+ Msg.info(UtilProjectListener.class,+ getClass().getSimpleName() + ".projectOpened(): " + project);lastOpenedProjectName = project.getName();}diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/FrontEndPluginOpenProgramActionsTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/FrontEndPluginOpenProgramActionsTest.javaindex 4c10beef49..fca69a26de 100644--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/FrontEndPluginOpenProgramActionsTest.java+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/framework/main/datatree/FrontEndPluginOpenProgramActionsTest.java@@ -23,7 +23,8 @@ import java.awt.event.MouseEvent;import java.util.ArrayList;import java.util.List;-import javax.swing.*;+import javax.swing.JTree;+import javax.swing.SwingUtilities;import javax.swing.tree.TreePath;import org.junit.*;@@ -273,20 +274,6 @@ public class FrontEndPluginOpenProgramActionsTest extends AbstractGhidraHeadedIn// make sure that the tool is loaded and processes all of the tasks it launchesWindow window = waitForToolLaunch();- // DEBUG:- if (window == null) {- // see if any tools have been launched- PluginTool[] runningTools = frontEndTool.getToolServices().getRunningTools();- for (PluginTool tool : runningTools) {- System.err.println("\t\"" + tool.getName() + "\"");- JFrame toolFrame = tool.getToolFrame();- System.err.println("\t\twith window: " + toolFrame.getTitle());- }-- System.err.println("Open Windows: ");- System.err.println(getOpenWindowsAsString());- }-assertNotNull(window);waitForBusyTool(env.getProject().getToolManager().getRunningTools()[0]);waitForTasks();diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/gen/AbstractJitCodeGeneratorTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/gen/AbstractJitCodeGeneratorTest.javaindex 76a0e48393..309ea2a6b4 100644--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/gen/AbstractJitCodeGeneratorTest.java+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/pcode/emu/jit/gen/AbstractJitCodeGeneratorTest.java@@ -15,8 +15,7 @@*/package ghidra.pcode.emu.jit.gen;-import static org.junit.Assert.assertEquals;-import static org.junit.Assert.fail;+import static org.junit.Assert.*;import java.io.*;import java.lang.invoke.MethodHandles;@@ -52,8 +51,7 @@ import ghidra.program.model.lang.*;import ghidra.program.model.pcode.PcodeOp;import ghidra.program.model.pcode.Varnode;import ghidra.program.util.DefaultLanguageService;-import ghidra.util.NumericUtilities;-import ghidra.util.SystemUtilities;+import ghidra.util.*;@SuppressWarnings("javadoc")public abstract class AbstractJitCodeGeneratorTest extends AbstractJitTest {@@ -69,7 +67,7 @@ public abstract class AbstractJitCodeGeneratorTest extends AbstractJitTest {if (!DEBUG_ENABLED) {return;}- System.out.println(program);+ Msg.debug(AbstractJitCodeGeneratorTest.class, program);}public static void dumpClass(byte[] classbytes) throws Exception {@@ -287,7 +285,6 @@ public abstract class AbstractJitCodeGeneratorTest extends AbstractJitTest {@PcodeUserop(functional = true)public int tap_int(int a) {- System.err.println("tap: %x".formatted(a));return a;}}diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/util/task/RunManagerTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/util/task/RunManagerTest.javaindex 4861337cc7..c40744a43b 100644--- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/util/task/RunManagerTest.java+++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/util/task/RunManagerTest.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,8 +15,7 @@*/package ghidra.util.task;-import static org.junit.Assert.assertEquals;-import static org.junit.Assert.assertTrue;+import static org.junit.Assert.*;import java.awt.Container;import java.util.Random;@@ -412,7 +411,7 @@ public class RunManagerTest extends AbstractGhidraHeadedIntegrationTest {}private void trace(String message) {- System.err.println(message);+ Msg.debug(this, message);}//==================================================================================================@@ -442,8 +441,7 @@ public class RunManagerTest extends AbstractGhidraHeadedIntegrationTest {startBarrier.await();}catch (Exception e1) {- System.err.println("Interrupted while waiting to begin: " + getName());- e1.printStackTrace();+ Msg.error(this, "Interrupted while waiting to begin: " + getName(), e1);}int runnableCount = random.nextInt(MAX_RUNNABLES_FROM_THREAD);@@ -534,9 +532,8 @@ public class RunManagerTest extends AbstractGhidraHeadedIntegrationTest {delayLatch.await();}catch (Exception e) {- System.err.println(- "Interrupted while waiting to begin: " + testName.getMethodName());- e.printStackTrace();+ Msg.error(this,+ "Interrupted while waiting to begin: " + testName.getMethodName(), e);}try {diff --git a/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.java b/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.javaindex 78fd127ba0..0140efc345 100644--- a/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.java+++ b/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.java@@ -58,6 +58,7 @@ public class LaunchSupport {// Validate command line argumentsif (args.length < 2 || args.length > 4) {+ // Logging has not been initialized and is not available to useSystem.err.println("LaunchSupport expected 2 to 4 arguments but got " + args.length);System.exit(exitCode);}