Пример #1
0
        private void BuildCxxProgram()
        {
            string prefix  = ConfigurationManager.AppSettings["GCCPrefix"];
            var    program = string.Format("p-{0}.elf", Guid.NewGuid());

            loadedProgram = program;

            // Save the program
            System.IO.File.WriteAllText("editor.c", textBoxProgram.Text);

            // Create a program
            var toolchain = new ElfToolchain(prefix);
            var lib       = new[] { "syscalls.c", "video.c", "math.c" };
            var sources   = new[] { "editor.c" };
            var bigEndian = false;

            toolchain.ExecuteTool("gcc", string.Format("-mips1 -E{2} -o {0} {1}", program, string.Join(" ", sources.Union(lib)), bigEndian ? "B" : "L"));
            var mips = Debugger.Machine;

            // Load the program
            var elf = mips.LoadElf(program, 0x00800000);

            Debugger = new Architecture.Debugger(mips, elf);

            UpdateDebugInfo();
        }
Пример #2
0
        public DebugForm(Machine machine, ELFSharp.IELF elf)
        {
            InitializeComponent();

            Debugger = new MIPS.Architecture.Debugger(machine, elf);

            // Add event handlers
            Debugger.Machine.CPU.CPUStep       += new EventHandler(CPU_CPUStep);
            Debugger.Machine.CPU.BreakpointHit += new EventHandler(CPU_BreakpointHit);
            Debugger.Machine.CPU.BreakpointHit += new EventHandler(CPU_CPUStep);
            Debugger.Machine.CPU.Paused        += new EventHandler(CPU_CPUStep);
            Debugger.Machine.CPU.Syscall       += new EventHandler(CPU_Syscall);

            UpdateDebugInfo();

            KeyPreview = true;
        }