1 package net.mograsim.plugin.launch;
5 import java.util.stream.Collectors;
7 import org.eclipse.core.runtime.PlatformObject;
8 import org.eclipse.debug.core.DebugException;
9 import org.eclipse.debug.core.ILaunch;
10 import org.eclipse.debug.core.model.IDebugTarget;
11 import org.eclipse.debug.core.model.IRegister;
12 import org.eclipse.debug.core.model.IRegisterGroup;
14 import net.mograsim.machine.Machine;
15 import net.mograsim.machine.Register;
16 import net.mograsim.plugin.MograsimActivator;
17 import net.mograsim.plugin.util.NumberRespectingStringComparator;
19 public class MachineRegisterGroup extends PlatformObject implements IRegisterGroup
21 private final MachineStackFrame stackFrame;
22 private final List<MachineRegister> registers;
24 public MachineRegisterGroup(MachineStackFrame stackFrame)
26 this.stackFrame = stackFrame;
27 Set<Register> machineRegisters = getMachine().getDefinition().getRegisters();
28 this.registers = machineRegisters.stream()
29 .sorted((r1, r2) -> NumberRespectingStringComparator.CASE_SENSITIVE.compare(r1.id(), r2.id()))
30 .map(r -> new MachineRegister(this, r)).collect(Collectors.toUnmodifiableList());
34 public String getModelIdentifier()
36 return MograsimActivator.PLUGIN_ID;
39 public Machine getMachine()
41 return stackFrame.getMachine();
45 public IDebugTarget getDebugTarget()
47 return stackFrame.getDebugTarget();
51 public ILaunch getLaunch()
53 return stackFrame.getLaunch();
57 public String getName() throws DebugException
59 return "pseudo register group";
63 public IRegister[] getRegisters() throws DebugException
65 return registers.toArray(IRegister[]::new);
69 public boolean hasRegisters() throws DebugException