Beispiel #1
0
 public bool OpenFiles(ListView source, ListView disassembly, ListView variables, TextBox comms)
 {
     this.source      = source;
     this.disassembly = disassembly;
     this.varView     = variables;
     this.comms       = comms;
     Breakpoints.Clear();
     if (OpenSourceFile())
     {
         if (parseSourceFile())
         {
             if (OpenDisassembly())
             {
                 source.Click         -= Source_Click;
                 source.Click         += Source_Click;
                 varView.FullRowSelect = true;
                 varView.Click        -= Variable_Click;
                 varView.Click        += Variable_Click;
                 //varView.ItemMouseHover -= VarView_ItemMouseHover;
                 //varView.ItemMouseHover += VarView_ItemMouseHover;
                 varView.Enabled = false;
                 return(true);
             }
         }
     }
     MessageBox.Show("Problem opening files");
     return(false);
 }
        private void LoadBreakpoints()
        {
            _loadingBreakpoints = true;

            var solution = _shell.CurrentSolution;

            if (solution != null)
            {
                var file = System.IO.Path.Combine(Platform.GetUserDataDirectory(solution), "Breakpoints.xml");

                if (System.IO.File.Exists(file))
                {
                    using (var reader = XmlReader.Create(file))
                    {
                        var doc = new XmlDocument();
                        doc.Load(reader);

                        Breakpoints.Load(doc.DocumentElement);
                    }
                }
            }
            else
            {
                Breakpoints.Clear();
            }

            _loadingBreakpoints = false;
        }
Beispiel #3
0
 public void Reset()
 {
     cpu.Resume();
     cpu.Reset();
     MaxCycle     = 0;
     CurrentCycle = 0;
     Breakpoints.Clear();
 }
        /// <summary>
        /// Us this method to prepare the breakpoints when running the
        /// virtual machine in debug mode
        /// </summary>
        public void PrepareBreakpoints()
        {
            // --- Keep CPU breakpoints set through the Disassembler tool
            var cpuBreakPoints = Breakpoints.Where(bp => bp.Value.IsCpuBreakpoint).ToList();

            Breakpoints.Clear();
            foreach (var bpItem in cpuBreakPoints)
            {
                Breakpoints.Add(bpItem.Key, bpItem.Value);
            }

            // --- Merge breakpoints set in Visual Studio
            if (CompiledOutput == null)
            {
                return;
            }
            foreach (Breakpoint breakpoint in Package.ApplicationObject.Debugger.Breakpoints)
            {
                // --- Check for the file
                int fileIndex = -1;
                for (var i = 0; i < CompiledOutput.SourceFileList.Count; i++)
                {
                    if (string.Compare(breakpoint.File, CompiledOutput.SourceFileList[i].Filename,
                                       StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        fileIndex = i;
                        break;
                    }
                }
                if (fileIndex < 0)
                {
                    continue;
                }

                // --- Check the breakpoint address
                if (CompiledOutput.AddressMap.TryGetValue((fileIndex, breakpoint.FileLine), out var address))
                {
                    Breakpoints.Add(address, new BreakpointInfo
                    {
                        File     = CompiledOutput.SourceFileList[fileIndex].Filename,
                        FileLine = breakpoint.FileLine,
                        Type     = BreakpointType.NoCondition
                    });
                }
            }
        }
Beispiel #5
0
        public static void Read(FileInfo file)
        {
            DebuggerState state;

            try
            {
                using (var stream = file.Open(FileMode.Open, FileAccess.Read))
                    state = (DebuggerState) new BinaryFormatter().Deserialize(stream);
            }
            catch (Exception ex)
            {
                Log.Error("Could not read database file '{0}':", file);
                Log.Error(ex.ToString());

                return;
            }

            ResetState();

            WorkingDirectory     = state.WorkingDirectory;
            Arguments            = state.Arguments;
            EnvironmentVariables = state.EnvironmentVariables;
            Watches = state.Watches;
            Aliases = state.Aliases;

            Breakpoints.Clear();
            BreakEvents.Clear();

            foreach (var kvp in state.Breakpoints)
            {
                Breakpoints.Add(kvp.Key, kvp.Value.Item1);

                if (kvp.Value.Item2)
                {
                    BreakEvents.Add(kvp.Value.Item1);
                }
            }

            foreach (var cp in state.Catchpoints)
            {
                BreakEvents.Add(cp);
            }

            _nextWatchId      = state.NextWatchId;
            _nextBreakpointId = state.NextBreakpointId;
        }
Beispiel #6
0
 public override void Dispose()
 {
     foreach (var p in processes.ToArray())
     {
         p.Dispose();
     }
     ObjectAdapter.Dispose();
     ObjectAdapter = null;
     Breakpoints.Clear();
     processes = null;
     process   = null;
     VsPackage.MessageCentre.Session = null;
     documents     = null;
     stepper       = null;
     processesInfo = null;
     base.Dispose();
 }
Beispiel #7
0
        public static void Disconnect()
        {
            lock (_lock)
            {
                if (_session == null)
                {
                    return;
                }

                CommandLine.InferiorExecuting = true;

                _kind = SessionKind.Disconnected;

                Breakpoints.Clear();
                BreakEvents.Clear();

                _session.Continue();

                _session = null;
            }
        }
Beispiel #8
0
        /// <summary>
        /// Removes all breakpoints and reapplies them again.
        /// </summary>
        /// <param name="hasPdbChanged"></param>
        /// <param name="ct"></param>
        /// <returns></returns>
        /// <remarks>This method is required when lost contact with VICE or when debugging symbols change.</remarks>
        public async Task ReapplyBreakpoints(bool hasPdbChanged, CancellationToken ct)
        {
            var checkpointsListCommand = viceBridge.EnqueueCommand(new CheckpointListCommand());
            var checkpointsList        = await checkpointsListCommand.Response.AwaitWithLogAndTimeoutAsync(dispatcher, logger, checkpointsListCommand, ct : ct);

            if (checkpointsList is not null)
            {
                foreach (var ci in checkpointsList.Info)
                {
                    // TODO verify result
                    await DeleteCheckpointAsync(ci.CheckpointNumber, ct);
                }
            }
            var breakpoints = Breakpoints.ToImmutableArray();

            Breakpoints.Clear();
            breakpointsLinesMap.Clear();
            breakpointsMap.Clear();
            await ApplyOriginalBreakpointsAsync(breakpoints, hasPdbChanged, ct);

            logger.LogDebug("Checkpoints reapplied");
        }
 /// <summary>
 /// Clears the provider
 /// </summary>
 public void Clear()
 {
     Breakpoints.Clear();
     Z80AsmTaggers.Clear();
 }
Beispiel #10
0
 public void ClearBreakpoints()
 {
     Breakpoints.Clear();
 }
Beispiel #11
0
 private void ClearAllBreakpoints()
 {
     Breakpoints.Clear();
 }
Beispiel #12
0
        bool ExecuteCommand(ConsoleCommand command, string[] parameters)
        {
            ConsoleAddString(String.Format("{0}", command.ToString()));
            switch (command)
            {
            case ConsoleCommand.step:
                BreakpointStepAvailable = true;
                return(true);

            case ConsoleCommand.next:
                return(NextCommand());

            case ConsoleCommand.@continue:
                DmgMode = Mode.Running;

                executionHistory.Clear();
                return(true);

            case ConsoleCommand.mem:
                return(MemCommand(parameters));

            case ConsoleCommand.lcd:
                return(LcdCommand());

            case ConsoleCommand.set:
                return(SetCommand(parameters));

            case ConsoleCommand.brk:
                DmgMode = Mode.BreakPoint;
                PeekSequentialInstructions();
                UpdateCodeSnapshot();
                return(true);

            case ConsoleCommand.breakpoint:
                return(BreakpointCommand(parameters));

            case ConsoleCommand.delete:
                Breakpoints.Clear();
                return(true);

            case ConsoleCommand.dumptiles:
                dmg.DumpTileSet();
                return(true);

            case ConsoleCommand.dumptilemaps:
                dmg.ppu.TileMaps[0].DumpTileMap();
                dmg.ppu.TileMaps[1].DumpTileMap();
                return(true);

            case ConsoleCommand.dumpbg:
                dmg.ppu.DumpFullCurrentBgToPng(true);
                return(true);

            case ConsoleCommand.ticks:
                ConsoleAddString(String.Format("ticks - {0} mcycles {1} tcycles", (dmg.cpu.Ticks - lastTicks), ((dmg.cpu.Ticks - lastTicks) * 4)));
                lastTicks = dmg.cpu.Ticks;
                return(true);

            case ConsoleCommand.rom:
                ConsoleAddString(String.Format("ROM Info - {0}", dmg.rom.Type.ToString()));
                return(true);

            case ConsoleCommand.screenshot:
                dmg.ppu.DumpFrameBufferToPng();
                return(true);

            case ConsoleCommand.exit:
                dmg.DumpTty();
                dmg.ppu.DumpFrameBufferToPng();
                dmg.DumpTileSet();
                dmg.ppu.TileMaps[0].DumpTileMap();
                dmg.ppu.TileMaps[1].DumpTileMap();
                dmg.ppu.DumpFullCurrentBgToPng(true);
                return(true);

            default:
                return(false);
            }
        }
Beispiel #13
0
 public void Clear()
 {
     lock (this) Breakpoints.Clear();
 }