Exemplo n.º 1
0
 private void AddBPButton_Click(object sender, EventArgs e)
 {
     if (BPCombo.Text.Trim() != "")
     {
         int newValue = knl_breakpoints.Add(BPCombo.Text.Trim().Replace(">", ""));
         if (newValue > -1)
         {
             BPCombo.Text = knl_breakpoints.Format(newValue.ToString("X"));
             UpdateDebugLines(newValue, true);
             BPLabel.Text = knl_breakpoints.Count.ToString() + " BP";
         }
     }
 }
Exemplo n.º 2
0
 private void AddBreakpoint(int address, bool isInternal)
 {
     if (Breakpoints.All(b => b.Address != address))
     {
         Breakpoints.Add(new Breakpoint(address, isInternal));
     }
 }
Exemplo n.º 3
0
 private void AddBreakpoint()
 {
     if (_breakpoint != null && !Breakpoints.Contains(_breakpoint.Value))
     {
         Breakpoints.Add(_breakpoint.Value);
         _console.SetBreakpoint(_breakpoint.Value);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Performs a single step (generally, executes a single instruction).
 /// </summary>
 public void StepInto()
 {
     if (Engine == null)
     {
         throw new NoProgramLoadedException();
     }
     Breakpoints.Add(new StepBreakpoint(Target.ProgramLocation, StepKind.Into));
     Engine.Continue();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds a breakpoint to the collection and sets its Checker.
 /// </summary>
 /// <param name="breakpoint">The breakpoint to add. Cannot be null.</param>
 public void Add(Breakpoint breakpoint)
 {
     lock (this)
     {
         if (breakpoint == null)
         {
             throw new ArgumentNullException();
         }
         Debugger.Target.SetBreakpointChecker(breakpoint);
         Breakpoints.Add(breakpoint);
     }
 }
Exemplo n.º 6
0
        public static void ShowAddTracepointDialog(string file, int line)
        {
            AddTracePointDialog dlg = new AddTracePointDialog();

            if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok && dlg.Text.Length > 0)
            {
                Breakpoint bp = new Breakpoint(file, line);
                bp.HitAction           = HitAction.PrintExpression;
                bp.TraceExpression     = dlg.Text;
                bp.ConditionExpression = dlg.Condition;
                Breakpoints.Add(bp);
            }
            dlg.Destroy();
        }
Exemplo n.º 7
0
        public static void RunToCursor(string fileName, int line, int column)
        {
            if (CheckIsBusy())
            {
                return;
            }

            var bp = new RunToCursorBreakpoint(fileName, line, column);

            Breakpoints.Add(bp);

            session.Continue();
            NotifyLocationChanged();
        }
Exemplo n.º 8
0
        private void AddBreakpoint(int lineNo, string moduleName, string condition)
        {
            var newItem = new LispBreakpointInfo(lineNo, moduleName, condition);
            var index   = Breakpoints.FindIndex(elem => (elem.LineNo == lineNo) && (elem.ModuleName == moduleName));

            if (index >= 0)
            {
                // replace existing item for this line
                Breakpoints[index] = newItem;
            }
            else
            {
                Breakpoints.Add(newItem);
            }
        }
        /// <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
                    });
                }
            }
        }
Exemplo n.º 10
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;
        }
Exemplo n.º 11
0
 /// <summary>
 /// Toggles a breakpoint, returning true if the breakpoint was set, and false if it was cleared.
 /// </summary>
 /// <param name="locator">A locator identifying the document or operator in which the breakpoint is set.</param>
 /// <param name="line">The line on which the breakpoint is set.</param>
 /// <param name="linePos">The line position, -1 for no line position.</param>
 /// <returns>True if the breakpoint was set, false if it was cleared.</returns>
 public bool ToggleBreakpoint(string locator, int line, int linePos)
 {
     lock (_syncHandle)
     {
         Breakpoint breakpoint = new Breakpoint(locator, line, linePos);
         int        index      = _breakpoints.IndexOf(breakpoint);
         if (index >= 0)
         {
             _breakpoints.Remove(breakpoint);
             return(false);
         }
         else
         {
             _breakpoints.Add(breakpoint);
             return(true);
         }
     }
 }
Exemplo n.º 12
0
        public void ToggleBreakPoint(int address)
        {
            var breakpoint = Breakpoints[address];
            var memoryMap  = MemoryMapManager.GetMemoryMap(address);

            if (memoryMap != null && memoryMap.Type == RangeType.Data)
            {
                return;
            }

            if (breakpoint != null)
            {
                Breakpoints.Remove(breakpoint.Address);
            }
            else
            {
                Breakpoints.Add(address);
            }
        }
Exemplo n.º 13
0
        // b 0xC06A if 0xff40 == 2
        bool BreakpointCommand(string[] parameters)
        {
            if (parameters.Length != 1 && parameters.Length != 5)
            {
                ConsoleAddString(String.Format("breakpoint: Invalid number of parameters. Usage:'breakpoint 0xC100'"));
                return(false);
            }

            ushort p1 = 0;
            bool   parsedParams;

            parsedParams = ParseUShortParameter(parameters[0], out p1);


            // Parse condtiion
            global::DmgDebugger.ConditionalExpression expression = null;

            if (parameters.Length > 1)
            {
                // Parse condition

                try
                {
                    expression = new DmgDebugger.ConditionalExpression(dmg.memory, parameters.Skip(1).ToArray());
                }
                catch (ArgumentException ex)
                {
                    ConsoleAddString(String.Format("Error Adding breakpoint.\n{0}", ex.ToString()));
                }
            }

            Breakpoints.Add(new Breakpoint(p1, expression));

            ConsoleAddString(String.Format("breakpoint added at 0x{0:X4}", p1));
            return(true);
        }
Exemplo n.º 14
0
 public bool AddBreakpoint(MemoryBreakpoint breakpoint)
 {
     Breakpoints.Add(breakpoint);
     return(true);
 }
Exemplo n.º 15
0
 public bool AddBreakpoint(ProgramBreakpoint breakpoint)
 {
     // Should ensure it's not a duplicate
     Breakpoints.Add(breakpoint);
     return(true);
 }
Exemplo n.º 16
0
 private void AddBreakPoint()
 {
     Breakpoints.Add(new Breakpoint());
     RaisePropertyChanged("Breakpoints");
 }