示例#1
0
 public MonoPendingBreakpoint this[BreakEvent breakEvent] => breakpoints[breakEvent];
示例#2
0
        private void HandleEvent(GdbEvent ev)
        {
            if (ev.Name != "stopped")
            {
                return;
            }

            CleanTempVariableObjects();

            BreakEvent breakEvent = null;

            TargetEventType type = TargetEventType.TargetStopped;

            if (!string.IsNullOrEmpty(ev.Reason))
            {
                switch (ev.Reason)
                {
                case "breakpoint-hit":
                    type = TargetEventType.TargetHitBreakpoint;
                    var breakPointNumber = ev.GetInt("bkptno");
                    if (!CheckBreakpoint(breakPointNumber))
                    {
                        RunCommand("-exec-continue");
                        return;
                    }

                    breakEvent = breakpoints[breakPointNumber].BreakEvent;
                    break;

                case "watchpoint-trigger":
                    type = TargetEventType.TargetHitBreakpoint;

                    var watchPointNumber = ev.GetObject("wpt").GetInt("number");
                    breakEvent = breakpoints[watchPointNumber].BreakEvent;
                    break;

                case "signal-received":
                    if (ev.GetValue("signal-name") == "SIGINT")
                    {
                        type = TargetEventType.TargetInterrupted;
                    }
                    else
                    {
                        type = TargetEventType.TargetSignaled;
                    }
                    break;

                case "exited":
                case "exited-signalled":
                case "exited-normally":
                    type = TargetEventType.TargetExited;
                    break;

                default:
                    type = TargetEventType.TargetStopped;
                    break;
                }
            }

            ResultData curFrame = ev.GetObject("frame");

            FireTargetEvent(type, curFrame, breakEvent);
        }
 public void addBreak(BreakEvent b)
 {
     generatedMap.Events.Add(b);
 }
示例#4
0
        protected override void OnLoad(EventArgs e)
        {
            _notifListener = new NotificationListener();
            _notifListener.OnNotification += OnNotificationReceived;

            bool isPaused = EmuApi.IsPaused();

            ConfigManager.Config.Debug.Debugger.ApplyConfig();

            mnuUseAltSpcOpNames.Visible = false;

            switch (_cpuType)
            {
            case CpuType.Cpu:
                ctrlDisassemblyView.Initialize(new CpuDisassemblyManager(), new CpuLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.CpuDebuggerEnabled, true);
                this.Text = "CPU Debugger";

                this.ctrlCpuStatus         = new ctrlCpuStatus();
                this.ctrlCpuStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlCpuStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlCpuStatus);
                break;

            case CpuType.Spc:
                ctrlDisassemblyView.Initialize(new SpcDisassemblyManager(), new SpcLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.SpcDebuggerEnabled, true);
                mnuBreakOnWdm.Visible       = false;
                mnuBreakOnCop.Visible       = false;
                mnuBreakOnUnitRead.Visible  = false;
                sepBreakOnUnitRead.Visible  = false;
                mnuUseAltSpcOpNames.Visible = true;
                this.Text = "SPC Debugger";

                this.ctrlSpcStatus         = new ctrlSpcStatus();
                this.ctrlSpcStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlSpcStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlSpcStatus);
                break;

            case CpuType.Sa1:
                ctrlDisassemblyView.Initialize(new Sa1DisassemblyManager(), new Sa1LineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.Sa1DebuggerEnabled, true);
                this.Text = "SA-1 Debugger";

                this.ctrlCpuStatus         = new ctrlCpuStatus();
                this.ctrlCpuStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlCpuStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlCpuStatus);
                break;

            case CpuType.Gsu:
                ctrlDisassemblyView.Initialize(new GsuDisassemblyManager(), new GsuLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.GsuDebuggerEnabled, true);
                this.Text = "GSU Debugger";
                HideDebuggerElements();

                this.ctrlGsuStatus         = new ctrlGsuStatus();
                this.ctrlGsuStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlGsuStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlGsuStatus);
                break;

            case CpuType.NecDsp:
                ctrlDisassemblyView.Initialize(new NecDspDisassemblyManager(), new NecDspLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.NecDspDebuggerEnabled, true);
                this.Text = "DSP Debugger";
                HideDebuggerElements();

                this.ctrlNecDspStatus         = new ctrlNecDspStatus();
                this.ctrlNecDspStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlNecDspStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlNecDspStatus);
                break;

            case CpuType.Cx4:
                ctrlDisassemblyView.Initialize(new Cx4DisassemblyManager(), new Cx4LineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.Cx4DebuggerEnabled, true);
                this.Text = "CX4 Debugger";

                ctrlLabelList.Visible = false;
                HideDebuggerElements();

                this.ctrlCx4Status         = new ctrlCx4Status();
                this.ctrlCx4Status.Padding = new Padding(3, 0, 3, 0);
                this.ctrlCx4Status.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlCx4Status);
                break;

            case CpuType.Gameboy:
                ctrlDisassemblyView.Initialize(new GbDisassemblyManager(), new GbLineStyleProvider());
                ConfigApi.SetDebuggerFlag(DebuggerFlags.GbDebuggerEnabled, true);
                this.Text = "GB Debugger";

                ctrlMemoryMapping         = new ctrlMemoryMapping();
                ctrlMemoryMapping.Size    = new Size(this.ClientSize.Width, 33);
                ctrlMemoryMapping.Margin  = new Padding(3, 0, 3, 3);
                ctrlMemoryMapping.Dock    = DockStyle.Bottom;
                ctrlMemoryMapping.Visible = ConfigManager.Config.Debug.Debugger.ShowMemoryMappings;
                this.Controls.Add(ctrlMemoryMapping);
                ctrlMemoryMapping.SendToBack();

                sepBrkCopStpWdm.Visible = false;
                mnuBreakOnBrk.Visible   = false;
                mnuBreakOnWdm.Visible   = false;
                mnuBreakOnCop.Visible   = false;
                mnuBreakOnStp.Visible   = false;
                ctrlPpuStatus.Visible   = false;

                sepGameboyBreak.Visible = true;
                mnuGbBreakOnDisableLcdOutsideVblank.Visible = true;
                mnuGbBreakOnInvalidOamAccess.Visible        = true;
                mnuGbBreakOnInvalidOpCode.Visible           = true;
                mnuGbBreakOnInvalidVramAccess.Visible       = true;
                mnuGbBreakOnNopLoad.Visible       = true;
                mnuGbBreakOnOamCorruption.Visible = false;

                this.ctrlGameboyStatus         = new ctrlGameboyStatus();
                this.ctrlGameboyStatus.Padding = new Padding(3, 0, 3, 0);
                this.ctrlGameboyStatus.Dock    = DockStyle.Top;
                pnlStatus.Controls.Add(this.ctrlGameboyStatus);
                break;
            }

            ctrlBreakpoints.CpuType = _cpuType;
            ctrlWatch.CpuType       = _cpuType;

            InitShortcuts();
            InitToolbar();
            LoadConfig();

            toolTip.SetToolTip(picWatchHelp, ctrlWatch.GetTooltipText());

            BreakpointManager.AddCpuType(_cpuType);

            if (!isPaused)
            {
                DebugApi.Step(_cpuType, 10000, StepType.Step);
            }
            else
            {
                BreakEvent evt = new BreakEvent()
                {
                    BreakpointId = -1, Source = BreakSource.Unspecified
                };
                RefreshDebugger(evt);
            }

            base.OnLoad(e);
        }
示例#5
0
        protected override object OnInsertBreakEvent(BreakEvent be, bool activate)
        {
            Breakpoint bp = be as Breakpoint;

            if (bp == null)
            {
                return(null);
            }

            lock (gdbLock) {
                bool dres = InternalStop();
                try {
                    string extraCmd = string.Empty;
                    if (bp.HitCount > 0)
                    {
                        extraCmd += "-i " + bp.HitCount;
                        breakpointsWithHitCount.Add(bp);
                    }
                    if (!string.IsNullOrEmpty(bp.ConditionExpression))
                    {
                        if (!bp.BreakIfConditionChanges)
                        {
                            extraCmd += " -c " + bp.ConditionExpression;
                        }
                    }

                    // Breakpoint locations must be double-quoted if files contain spaces.
                    // For example: -break-insert "\"C:/Documents and Settings/foo.c\":17"

                    RunCommand("-environment-directory", Escape(Path.GetDirectoryName(bp.FileName)));
                    GdbCommandResult res      = null;
                    string           errorMsg = null;
                    try {
                        res = RunCommand("-break-insert", extraCmd.Trim(), Escape(Escape(bp.FileName) + ":" + bp.Line));
                    } catch (Exception ex) {
                        errorMsg = ex.Message;
                    }

                    if (res == null)
                    {
                        try {
                            res = RunCommand("-break-insert", extraCmd.Trim(), Escape(Escape(Path.GetFileName(bp.FileName)) + ":" + bp.Line));
                        }
                        catch {
                            // Ignore
                        }
                    }
                    if (res == null)
                    {
                        OnDebuggerOutput(true, "Could not set breakpoint: " + errorMsg);
                        return(null);
                    }
                    int bh = res.GetObject("bkpt").GetInt("number");
                    if (!activate)
                    {
                        RunCommand("-break-disable", bh.ToString());
                    }
                    breakpoints [bh] = bp;
                    return(bh);
                } finally {
                    InternalResume(dres);
                }
            }
        }
示例#6
0
 /// <summary>
 ///     Removes the specified break event.
 /// </summary>
 /// <param name="breakEvent">The break event.</param>
 public void Remove(BreakEvent breakEvent)
 {
     Engine.Program.Session.Breakpoints.Remove(breakEvent);
     _breakpoints.Remove(breakEvent);
 }
 protected override object OnUpdateBreakEvent(object handle, BreakEvent be)
 {
     return(controller.DebuggerServer.UpdateBreakEvent(handle, be));
 }
        protected override BreakEventInfo OnInsertBreakEvent(BreakEvent be)
        {
            BreakEventInfo binfo = new BreakEventInfo();

            lock (documents) {
                Breakpoint bp = be as Breakpoint;
                if (bp != null)
                {
                    if (bp is FunctionBreakpoint)
                    {
                        // FIXME: implement breaking on function name
                        binfo.SetStatus(BreakEventStatus.Invalid, null);
                        return(binfo);
                    }
                    else
                    {
                        DocInfo doc;
                        if (!documents.TryGetValue(System.IO.Path.GetFullPath(bp.FileName), out doc))
                        {
                            binfo.SetStatus(BreakEventStatus.NotBound, null);
                            return(binfo);
                        }

                        int line;
                        try {
                            line = doc.Document.FindClosestLine(bp.Line);
                        }
                        catch {
                            // Invalid line
                            binfo.SetStatus(BreakEventStatus.Invalid, null);
                            return(binfo);
                        }
                        ISymbolMethod met = doc.Reader.GetMethodFromDocumentPosition(doc.Document, line, 0);
                        if (met == null)
                        {
                            binfo.SetStatus(BreakEventStatus.Invalid, null);
                            return(binfo);
                        }

                        int offset = -1;
                        foreach (SequencePoint sp in met.GetSequencePoints())
                        {
                            if (sp.Line == line && sp.Document.URL == doc.Document.URL)
                            {
                                offset = sp.Offset;
                                break;
                            }
                        }
                        if (offset == -1)
                        {
                            binfo.SetStatus(BreakEventStatus.Invalid, null);
                            return(binfo);
                        }

                        CorFunction           func  = doc.Module.GetFunctionFromToken(met.Token.GetToken());
                        CorFunctionBreakpoint corBp = func.ILCode.CreateBreakpoint(offset);
                        corBp.Activate(bp.Enabled);
                        breakpoints[corBp] = binfo;

                        binfo.Handle = corBp;
                        binfo.SetStatus(BreakEventStatus.Bound, null);
                        return(binfo);
                    }
                }
            }
            return(null);
        }
示例#9
0
 public void On(BreakEvent @event)
 {
     Breaks++;
     Break();
 }
        //breakpoints etc

        // returns a handle
        protected override object OnInsertBreakEvent(BreakEvent be, bool activate)
        {
            return(controller.DebuggerServer.InsertBreakEvent(be, activate));
        }
示例#11
0
        public static EventBase Parse(string s)
        {
            var        parts = s.Split(',');
            EventTypes etype;
            EventBase  result;

            if (Enum.TryParse(parts[0], out etype))
            {
                var path = "";
                if (parts.Length > 3)
                {
                    path = parts[3].Trim('\"');
                }
                switch (etype)
                {
                case EventTypes.Sprite:
                    result = new SpriteEvent(path,
                                             (EventLayer)Enum.Parse(typeof(EventLayer), parts[1]),
                                             (Origin)Enum.Parse(typeof(Origin), parts[2]), float.Parse(parts[4], Constants.CULTUREINFO),
                                             float.Parse(parts[5], Constants.CULTUREINFO));
                    break;

                case EventTypes.Animation:
                    result = new AnimationEvent(path,
                                                int.Parse(parts[6]), int.Parse(parts[7]),
                                                (EventLayer)Enum.Parse(typeof(EventLayer), parts[1]),
                                                (Origin)Enum.Parse(typeof(Origin), parts[2]), float.Parse(parts[4], Constants.CULTUREINFO),
                                                float.Parse(parts[5], Constants.CULTUREINFO),
                                                parts.Length > 8 ? (Looptypes)Enum.Parse(typeof(Looptypes), parts[8]) : Looptypes.LoopForever);
                    break;

                case EventTypes.Sample:
                    result = new SampleEvent(parts[3], int.Parse(parts[1]),
                                             int.Parse(parts[4]), (EventLayer)int.Parse(parts[2]));
                    break;

                case EventTypes.Background:
                    result = new BackgroundEvent(int.Parse(parts[1]), parts[2].Trim('"'),
                                                 parts.Length > 3 ? int.Parse(parts[3]) : 0, parts.Length > 4 ? int.Parse(parts[4]) : 0);
                    break;

                case EventTypes.Video:
                    result = new VideoEvent(int.Parse(parts[1]), parts[2].Trim('"'));
                    break;

                case EventTypes.Break:
                    result = new BreakEvent(int.Parse(parts[1]), int.Parse(parts[2]));
                    break;

                case EventTypes.Backgroundcolor:
                    result = new BackgroundColorEvent(int.Parse(parts[1]), byte.Parse(parts[2]),
                                                      byte.Parse(parts[3]),
                                                      byte.Parse(parts[4]));
                    break;

                default:
                    result = new UndefinedEvent(parts);
                    break;
                }
            }
            else
            {
                result = new UndefinedEvent(parts);
            }
            return(result);
            //0,0,"JamesHa.jpg",0,0 //image
            //Video,4655,"Jmmxp.avi" //video
            //2,110843,118365 //break
            //3 //Backgroundcolor
        }
示例#12
0
 protected override BreakEventInfo OnInsertBreakEvent(BreakEvent breakEvent)
 {
     throw new NotImplementedException();
 }
示例#13
0
 public void Remove(BreakEvent breakEvent)
 {
     Engine.Session.Breakpoints.Remove(breakEvent);
     breakpoints.Remove(breakEvent);
 }
示例#14
0
        protected override BreakEventInfo OnInsertBreakEvent(BreakEvent be)
        {
            Breakpoint bp = be as Breakpoint;

            if (bp == null)
            {
                throw new NotSupportedException();
            }

            BreakEventInfo bi = new BreakEventInfo();

            lock (gdbLock) {
                bool dres = InternalStop();
                try {
                    string extraCmd = string.Empty;
                    if (bp.HitCount > 0)
                    {
                        extraCmd += "-i " + bp.HitCount;
                        breakpointsWithHitCount.Add(bi);
                    }
                    if (!string.IsNullOrEmpty(bp.ConditionExpression))
                    {
                        if (!bp.BreakIfConditionChanges)
                        {
                            extraCmd += " -c " + bp.ConditionExpression;
                        }
                    }

                    GdbCommandResult res      = null;
                    string           errorMsg = null;

                    if (bp is FunctionBreakpoint)
                    {
                        try {
                            res = RunCommand("-break-insert", extraCmd.Trim(), ((FunctionBreakpoint)bp).FunctionName);
                        } catch (Exception ex) {
                            errorMsg = ex.Message;
                        }
                    }
                    else
                    {
                        // Breakpoint locations must be double-quoted if files contain spaces.
                        // For example: -break-insert "\"C:/Documents and Settings/foo.c\":17"
                        RunCommand("-environment-directory", Escape(Path.GetDirectoryName(bp.FileName)));

                        try {
                            res = RunCommand("-break-insert", extraCmd.Trim(), Escape(Escape(bp.FileName) + ":" + bp.Line));
                        } catch (Exception ex) {
                            errorMsg = ex.Message;
                        }

                        if (res == null)
                        {
                            try {
                                res = RunCommand("-break-insert", extraCmd.Trim(), Escape(Escape(Path.GetFileName(bp.FileName)) + ":" + bp.Line));
                            }
                            catch {
                                // Ignore
                            }
                        }
                    }

                    if (res == null)
                    {
                        bi.SetStatus(BreakEventStatus.Invalid, errorMsg);
                        return(bi);
                    }
                    int bh = res.GetObject("bkpt").GetInt("number");
                    if (!be.Enabled)
                    {
                        RunCommand("-break-disable", bh.ToString());
                    }
                    breakpoints [bh] = bi;
                    bi.Handle        = bh;
                    bi.SetStatus(BreakEventStatus.Bound, null);
                    return(bi);
                } finally {
                    InternalResume(dres);
                }
            }
        }
示例#15
0
        public void RemoveBreakpoint(BreakEvent e)
        {
            _engine.SoftDebugger.Breakpoints.Remove(e);

            _breakpoints.Remove(e);
        }
示例#16
0
        private void OnNotificationReceived(NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case ConsoleNotificationType.GameLoaded: {
                if (_cpuType == CpuType.Sa1)
                {
                    CoprocessorType coprocessor = EmuApi.GetRomInfo().CoprocessorType;
                    if (coprocessor != CoprocessorType.SA1)
                    {
                        this.Invoke((MethodInvoker)(() => {
                                this.Close();
                            }));
                        return;
                    }
                }

                if (ConfigManager.Config.Debug.Debugger.BreakOnPowerCycleReset)
                {
                    DebugApi.Step(_cpuType, 1, StepType.PpuStep);
                }

                DebugState state = DebugApi.GetState();
                this.BeginInvoke((MethodInvoker)(() => {
                        DebugWorkspaceManager.ImportDbgFile();
                        LabelManager.RefreshLabels();
                        DebugApi.RefreshDisassembly(_cpuType);
                        UpdateDebugger(state, null);
                        BreakpointManager.SetBreakpoints();
                    }));
                break;
            }

            case ConsoleNotificationType.GameReset:
                if (ConfigManager.Config.Debug.Debugger.BreakOnPowerCycleReset)
                {
                    DebugApi.Step(_cpuType, 1, StepType.PpuStep);
                }
                break;

            case ConsoleNotificationType.PpuFrameDone:
                this.BeginInvoke((MethodInvoker)(() => {
                    UpdateContinueAction();
                }));
                break;

            case ConsoleNotificationType.CodeBreak: {
                BreakEvent evt   = (BreakEvent)Marshal.PtrToStructure(e.Parameter, typeof(BreakEvent));
                DebugState state = DebugApi.GetState();
                int        activeAddress;
                switch (_cpuType)
                {
                case CpuType.Cpu: activeAddress = (int)((state.Cpu.K << 16) | state.Cpu.PC); break;

                case CpuType.Spc: activeAddress = (int)state.Spc.PC; break;

                case CpuType.Sa1: activeAddress = (int)((state.Sa1.K << 16) | state.Sa1.PC); break;

                case CpuType.Gsu: activeAddress = (int)((state.Gsu.ProgramBank << 16) | state.Gsu.R[15]); break;

                default: throw new Exception("Unsupported cpu type");
                }

                this.BeginInvoke((MethodInvoker)(() => {
                        ProcessBreakEvent(evt, state, activeAddress);

                        if (_firstBreak && !ConfigManager.Config.Debug.Debugger.BreakOnOpen)
                        {
                            DebugApi.ResumeExecution();
                        }
                        _firstBreak = false;
                    }));
                break;
            }
            }
        }
        protected override BreakEventInfo OnInsertBreakEvent(BreakEvent breakEvent)
        {
            var binfo = new BreakEventInfo();

            var bp = breakEvent as Breakpoint;

            if (bp != null)
            {
                if (bp is FunctionBreakpoint)
                {
                    // FIXME: implement breaking on function name
                    binfo.SetStatus(BreakEventStatus.Invalid, null);
                    return(binfo);
                }
                else
                {
                    DocInfo doc;
                    if (!documents.TryGetValue(System.IO.Path.GetFullPath(bp.FileName), out doc))
                    {
                        binfo.SetStatus(BreakEventStatus.NotBound, "Cannot find source file in pdb/mdb debugging database.");
                        return(binfo);
                    }

                    var met = doc.GetClosestMethod(bp.Line);

                    int offset = -1;
                    foreach (var sp in met.SequencePoints)
                    {
                        if (sp.StartLine == bp.Line)
                        {
                            offset = sp.Offset;
                            break;
                        }
                    }
                    if (offset == -1)
                    {
                        if (bp.Line < met.SequencePoints.First().StartLine)
                        {
                            offset = met.SequencePoints.First().Offset;
                        }
                        else
                        {
                            offset = met.SequencePoints.Last().Offset;
                        }
                    }

                    CorDebugFunction           func  = doc.Assembly.GetFunctionFromTokenCLR(met.Method.MetadataToken.ToUInt32());
                    CorDebugFunctionBreakpoint corBp = func.ILCode.CreateBreakpoint((uint)offset);
                    corBp.Active = bp.Enabled;

                    binfo.Handle = corBp;
                    binfo.SetStatus(BreakEventStatus.Bound, null);
                    return(binfo);
                }
            }

//			var cp = breakEvent as Catchpoint;
//			if (cp != null) {
//				foreach (ModuleInfo mod in modules.Values) {
//					CorMetadataImport mi = mod.Importer;
//					if (mi != null) {
//						foreach (Type t in mi.DefinedTypes)
//							if (t.FullName == cp.ExceptionName) {
//								binfo.SetStatus (BreakEventStatus.Bound, null);
//								return binfo;
//							}
//					}
//				}
//			}

            binfo.SetStatus(BreakEventStatus.Invalid, null);
            return(binfo);
        }
示例#18
0
        private void OnNotificationReceived(NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case ConsoleNotificationType.GameLoaded: {
                if (_cpuType == CpuType.Sa1)
                {
                    CoprocessorType coprocessor = EmuApi.GetRomInfo().CoprocessorType;
                    if (coprocessor != CoprocessorType.SA1)
                    {
                        this.Invoke((MethodInvoker)(() => {
                                this.Close();
                            }));
                        return;
                    }
                }

                if (ConfigManager.Config.Debug.Debugger.BreakOnPowerCycleReset)
                {
                    DebugApi.Step(_cpuType, 1, StepType.PpuStep);
                }

                BreakpointManager.SetBreakpoints();

                DebugState state = DebugApi.GetState();
                this.BeginInvoke((MethodInvoker)(() => {
                        //Refresh workspace here as well as frmMain to ensure workspace
                        //is up-to-date no matter which form is notified first.
                        DebugWorkspaceManager.GetWorkspace();

                        bool isPowerCycle = e.Parameter.ToInt32() != 0;
                        if (!isPowerCycle)
                        {
                            DebugWorkspaceManager.AutoImportSymbols();
                        }
                        LabelManager.RefreshLabels();
                        DebugApi.RefreshDisassembly(_cpuType);
                        UpdateDebugger(state, null);
                    }));
                break;
            }

            case ConsoleNotificationType.GameReset:
                if (ConfigManager.Config.Debug.Debugger.BreakOnPowerCycleReset)
                {
                    DebugApi.Step(_cpuType, 1, StepType.PpuStep);
                }
                break;

            case ConsoleNotificationType.PpuFrameDone:
                this.BeginInvoke((MethodInvoker)(() => {
                    UpdateContinueAction();
                }));
                break;

            case ConsoleNotificationType.CodeBreak: {
                BreakEvent evt = (BreakEvent)Marshal.PtrToStructure(e.Parameter, typeof(BreakEvent));
                RefreshDebugger(evt);
                break;
            }
            }
        }
示例#19
0
 public BreakpointGlyphTag(BreakEvent breakpoint) : base(breakpoint)
 {
 }
示例#20
0
 /// <summary>
 ///     Adds the specified break event.
 /// </summary>
 /// <param name="breakEvent">The break event.</param>
 /// <param name="pendingBreakpoint">The pending breakpoint.</param>
 public void Add(BreakEvent breakEvent, MonoPendingBreakpoint pendingBreakpoint)
 {
     _breakpoints[breakEvent] = pendingBreakpoint;
 }
示例#21
0
 public TracepointDisabledGlyphTag(BreakEvent breakpoint) : base(breakpoint)
 {
 }
示例#22
0
        void OnSave(object sender, EventArgs e)
        {
            if (be == null)
            {
                if (stopOnFunction.Active)
                {
                    be = new FunctionBreakpoint("", "C#");
                }
                else if (stopOnLocation.Active)
                {
                    be = breakpointLocation.ToBreakpoint();
                }
                else if (stopOnException.Active)
                {
                    be = new Catchpoint(entryExceptionType.Text, checkIncludeSubclass.Active);
                }
                else
                {
                    return;
                }
            }

            var fb = be as FunctionBreakpoint;

            if (fb != null)
            {
                SaveFunctionBreakpoint(fb);
            }

            var bp = be as Breakpoint;

            if (bp != null)
            {
                SaveBreakpoint(bp);
            }

            if ((HitCountMode)ignoreHitType.SelectedItem == HitCountMode.GreaterThanOrEqualTo && (int)ignoreHitCount.Value == 0)
            {
                be.HitCountMode = HitCountMode.None;
            }
            else
            {
                be.HitCountMode = (HitCountMode)ignoreHitType.SelectedItem;
            }
            be.HitCount = be.HitCountMode != HitCountMode.None ? (int)ignoreHitCount.Value : 0;


            if (!string.IsNullOrWhiteSpace(entryConditionalExpression.Text))
            {
                be.ConditionExpression     = entryConditionalExpression.Text;
                be.BreakIfConditionChanges = conditionalHitType.SelectedItem.Equals(ConditionalHitWhen.ExpressionChanges);
            }
            else
            {
                be.ConditionExpression = null;
            }

            if (breakpointActionPrint.Active)
            {
                be.HitAction       = HitAction.PrintExpression;
                be.TraceExpression = entryPrintExpression.Text;
            }
            else
            {
                be.HitAction = HitAction.Break;
            }
            be.CommitChanges();
        }
示例#23
0
 public TracepointInvalidGlyphTag(BreakEvent breakpoint) : base(breakpoint)
 {
 }
 protected override object OnUpdateBreakEvent(object handle, BreakEvent be)
 {
     return(handle);
 }
示例#25
0
 public BaseBreakpointGlyphTag(BreakEvent breakpoint)
 {
     this.breakpoint = breakpoint;
 }
示例#26
0
        /// <summary>
        /// Saves the beatmap
        /// </summary>
        /// <param name="filename">The file to save the beatmap as</param>
        public void Save(string filename)
        {
            WriteBuffer.Clear();
            SectionLength.Clear();

            CultureInfo lastCulture = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
            Save("", "osu file format v13");
            FieldInfo[] newFields = GetType().GetFields();
            FieldInfo[] oldFields = Info.GetType().GetFields();

            foreach (FieldInfo f1 in newFields)
            {
                foreach (FieldInfo f2 in oldFields.Where(f2 => f1.Name == f2.Name))
                {
                    switch (f1.Name)
                    {
                    case "EditorBookmarks":
                    {
                        List <int> temps = (List <int>)f1.GetValue(this);
                        if (temps.Count != 0)
                        {
                            Save("General", "EditorBookmarks:" + string.Join(",", temps.Select(t => t.ToString(CultureInfo.InvariantCulture)).ToArray()));
                        }
                    }
                    break;

                    case "Bookmarks":
                    {
                        List <int> temps = (List <int>)f1.GetValue(this);
                        if (temps.Count != 0)
                        {
                            Save("Editor", "Bookmarks:" + string.Join(",", temps.Select(t => t.ToString(CultureInfo.InvariantCulture)).ToArray()));
                        }
                    }
                    break;

                    case "Tags":
                    {
                        List <string> temps = (List <string>)f1.GetValue(this);
                        if (temps.Count != 0)
                        {
                            Save("Metadata", "Tags:" + string.Join(" ", temps.ToArray()));
                        }
                    }
                    break;

                    case "Events":
                        foreach (EventBase o in (IEnumerable <EventBase>)f1.GetValue(this))
                        {
                            if (o.GetType() == typeof(ContentEvent))
                            {
                                ContentEvent backgroundInfo = (ContentEvent)o;
                                Save("Events", "0," + o.StartTime + ",\"" + backgroundInfo.Filename + "\"");
                            }
                            else if (o.GetType() == typeof(BreakEvent))
                            {
                                BreakEvent breakInfo = (BreakEvent)o;
                                Save("Events", "2," + o.StartTime + "," + breakInfo.EndTime);
                            }
                            else if (o.GetType() == typeof(BackgroundColourEvent))
                            {
                                BackgroundColourEvent colourInfo = (BackgroundColourEvent)o;
                                Save("Events", "3," + o.StartTime + "," + colourInfo.Colour.R + "," + colourInfo.Colour.G + "," + colourInfo.Colour.B);
                            }
                        }
                        break;

                    case "TimingPoints":
                    {
                        foreach (TimingPoint o in (IEnumerable <TimingPoint>)f1.GetValue(this))
                        {
                            Save("TimingPoints", o.Time + "," + o.BpmDelay + "," + o.TimeSignature + "," + o.SampleSet + "," + o.CustomSampleSet + "," + o.VolumePercentage + "," + Convert.ToInt32(!o.InheritsBPM) + "," + (int)o.VisualOptions);
                        }
                    }
                    break;

                    case "ComboColours":
                    {
                        foreach (Combo o in (IEnumerable <Combo>)f1.GetValue(this))
                        {
                            Save("Colours", "Combo" + o.ComboNumber + ':' + o.Colour.R + "," + o.Colour.G + "," + o.Colour.B);
                        }
                    }
                    break;

                    //case "SliderBorder":
                    //    {
                    //        if (f1.GetValue(this) == f2.GetValue(Info))
                    //            continue;
                    //        Colour o = (Colour)f1.GetValue(this);
                    //        Save("Colours", "SliderBorder: " + o.R + "," + o.G + "," + o.B);
                    //    }
                    //    break;
                    case "HitObjects":
                        foreach (CircleObject obj in (IEnumerable <CircleObject>)f1.GetValue(this))
                        {
                            if (obj.GetType() == typeof(CircleObject))
                            {
                                Save("HitObjects", obj.Location.X + "," + obj.Location.Y + "," + obj.StartTime + "," + (int)obj.Type + "," + (int)obj.Effect);
                            }
                            else if (obj.GetType() == typeof(SliderObject))
                            {
                                SliderObject sliderInfo  = (SliderObject)obj;
                                string       pointString = sliderInfo.Points.Aggregate("", (current, p) => current + ("|" + p.X + ':' + p.Y));
                                Save("HitObjects", obj.Location.X + "," + obj.Location.Y + "," + obj.StartTime + "," + (int)obj.Type + "," + (int)obj.Effect + "," + sliderInfo.Type.ToString().Substring(0, 1) + pointString + "," + sliderInfo.RepeatCount + "," + sliderInfo.MaxPoints);
                            }
                            else if (obj.GetType() == typeof(SpinnerObject))
                            {
                                SpinnerObject spinnerInfo = (SpinnerObject)obj;
                                Save("HitObjects", obj.Location.X + "," + obj.Location.Y + "," + obj.StartTime + "," + (int)obj.Type + "," + (int)obj.Effect + "," + spinnerInfo.EndTime);
                            }
                        }
                        break;

                    default:
                        if (f1.Name != "Format" && f1.Name != "Filename" && f1.Name != "BeatmapHash")
                        {
                            if (f1.GetValue(this) != null)
                            {
                                if (f2.GetValue(Info) != null)
                                {
                                    if ((f1.GetValue(this).GetType() == typeof(GameMode)) || (f1.GetValue(this).GetType() == typeof(OverlayOptions)))
                                    {
                                        Save(GetSection(f1.Name), f1.Name + ':' + (int)f1.GetValue(this));
                                    }
                                    else
                                    {
                                        Save(GetSection(f1.Name), f1.Name + ':' + f1.GetValue(this));
                                    }
                                }
                                else
                                {
                                    if ((f2.GetValue(Info).GetType() == typeof(GameMode)) || (f2.GetValue(Info).GetType() == typeof(OverlayOptions)))
                                    {
                                        Save(GetSection(f2.Name), f2.Name + ':' + (int)f2.GetValue(Info));
                                    }
                                    else
                                    {
                                        Save(GetSection(f2.Name), f2.Name + ':' + f2.GetValue(Info));
                                    }
                                }
                            }
                        }
                        break;
                    }
                }
            }
            foreach (PropertyInfo f1 in GetType().GetProperties())
            {
                foreach (PropertyInfo f2 in Info.GetType().GetProperties().Where(f2 => f1.Name == f2.Name))
                {
                    if (f1.GetValue(this, null) != null)
                    {
                        if (f2.GetValue(Info, null) != null)
                        {
                            if ((f1.GetValue(this, null).GetType() == typeof(GameMode)) || (f1.GetValue(this, null).GetType() == typeof(OverlayOptions)))
                            {
                                Save(GetSection(f1.Name), f1.Name + ':' + (int)f1.GetValue(this, null));
                            }
                            else
                            {
                                Save(GetSection(f1.Name), f1.Name + ':' + f1.GetValue(this, null));
                            }
                        }
                        else
                        {
                            if ((f2.GetValue(Info, null).GetType() == typeof(GameMode)) || (f2.GetValue(Info, null).GetType() == typeof(OverlayOptions)))
                            {
                                Save(GetSection(f2.Name), f2.Name + ':' + (int)f2.GetValue(Info, null));
                            }
                            else
                            {
                                Save(GetSection(f2.Name), f2.Name + ':' + f2.GetValue(Info, null));
                            }
                        }
                    }
                }
            }
            FinishSave(filename);
            Thread.CurrentThread.CurrentCulture = lastCulture;
        }
        protected override BreakEventInfo OnInsertBreakEvent(BreakEvent breakEvent)
        {
            this.VirtualMachine?.Suspend();

            return(base.OnInsertBreakEvent(breakEvent));
        }