Added threads, stackframes, and registers to the debug model
[Mograsim.git] / plugins / net.mograsim.plugin.core / src / net / mograsim / plugin / launch / MachineDebugTarget.java
index 5a13401..e1efb55 100644 (file)
@@ -30,9 +30,12 @@ import net.mograsim.plugin.MograsimActivator;
 
 public class MachineDebugTarget extends PlatformObject implements IDebugTarget, IMemoryBlockRetrievalExtension
 {
+       private final static boolean USE_PSEUDO_THREAD = true;
+
        private final ILaunch launch;
        private final Machine machine;
        private final LogicExecuter exec;
+       private final MachineThread thread;
 
        private boolean running;
 
@@ -51,6 +54,9 @@ public class MachineDebugTarget extends PlatformObject implements IDebugTarget,
 
                getLaunch().addDebugTarget(this);
                fireCreationEvent();
+
+               // create after creating ourself
+               this.thread = USE_PSEUDO_THREAD ? new MachineThread(this) : null;
        }
 
        public Machine getMachine()
@@ -232,13 +238,13 @@ public class MachineDebugTarget extends PlatformObject implements IDebugTarget,
        @Override
        public boolean hasThreads() throws DebugException
        {
-               return false;
+               return USE_PSEUDO_THREAD;
        }
 
        @Override
        public IThread[] getThreads() throws DebugException
        {
-               return new IThread[0];
+               return thread == null ? new IThread[0] : new IThread[] { thread };
        }
 
        public void addExecutionSpeedListener(Consumer<Double> executionSpeedListener)