private void LoadConfig() { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; _entityBinder.Entity = cfg; _entityBinder.AddBinding(nameof(cfg.ShowByteCode), mnuShowByteCode); mnuShowByteCode.CheckedChanged += (s, e) => { ctrlDisassemblyView.CodeViewer.ShowContentNotes = mnuShowByteCode.Checked; }; _entityBinder.UpdateUI(); Font font = new Font(cfg.FontFamily, cfg.FontSize, cfg.FontStyle); ctrlDisassemblyView.CodeViewer.BaseFont = font; ctrlDisassemblyView.CodeViewer.TextZoom = cfg.TextZoom; if (!cfg.WindowSize.IsEmpty) { this.StartPosition = FormStartPosition.Manual; this.Size = cfg.WindowSize; this.Location = cfg.WindowLocation; } if (cfg.SplitterDistance.HasValue) { ctrlSplitContainer.SplitterDistance = cfg.SplitterDistance.Value; } }
protected override void OnFormClosed(FormClosedEventArgs e) { base.OnFormClosed(e); if (this.DialogResult == DialogResult.OK) { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; int count = (int)nudCount.Value; cfg.BreakInCount = (int)count; if (radCpuInstructions.Checked) { DebugApi.Step(_cpuType, count, StepType.Step); cfg.BreakInMetric = BreakInMetric.CpuInstructions; } else if (radPpuCycles.Checked) { DebugApi.Step(_cpuType, count, StepType.PpuStep); cfg.BreakInMetric = BreakInMetric.PpuCycles; } else if (radScanlines.Checked) { DebugApi.Step(_cpuType, count * 341, StepType.PpuStep); cfg.BreakInMetric = BreakInMetric.Scanlines; } else { DebugApi.Step(_cpuType, count * 341 * 262, StepType.PpuStep); cfg.BreakInMetric = BreakInMetric.Frames; } ConfigManager.ApplyChanges(); } }
protected void SetBreakpointLineProperties(LineProperties props, Breakpoint breakpoint) { DebuggerInfo config = ConfigManager.Config.Debug.Debugger; Color fgColor = Color.White; Color? bgColor = null; Color bpColor = breakpoint.BreakOnExec ? config.CodeExecBreakpointColor : (breakpoint.BreakOnWrite ? config.CodeWriteBreakpointColor : config.CodeReadBreakpointColor); Color outlineColor = bpColor; LineSymbol symbol; if (breakpoint.Enabled) { bgColor = bpColor; symbol = LineSymbol.Circle; } else { fgColor = Color.Black; symbol = LineSymbol.CircleOutline; } if (breakpoint.MarkEvent) { symbol |= LineSymbol.Mark; } if (!string.IsNullOrWhiteSpace(breakpoint.Condition)) { symbol |= LineSymbol.Plus; } props.FgColor = fgColor; props.TextBgColor = bgColor; props.OutlineColor = outlineColor; props.Symbol = symbol; }
public override LineProperties GetLineStyle(CodeLineData lineData, int lineIndex) { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; LineProperties props = new LineProperties(); if (lineData.Address >= 0) { GetBreakpointLineProperties(props, lineData.Address); } bool isActiveStatement = ActiveAddress.HasValue && ActiveAddress.Value == lineData.Address; if (isActiveStatement) { ConfigureActiveStatement(props); } if (lineData.Flags.HasFlag(LineFlags.VerifiedData)) { props.LineBgColor = cfg.CodeVerifiedDataColor; } else if (!lineData.Flags.HasFlag(LineFlags.VerifiedCode)) { props.LineBgColor = cfg.CodeUnidentifiedDataColor; } return(props); }
private void LoadConfig() { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; _entityBinder.Entity = cfg; _entityBinder.AddBinding(nameof(cfg.ShowByteCode), mnuShowByteCode); _entityBinder.AddBinding(nameof(cfg.ShowMemoryMappings), mnuShowMemoryMappings); _entityBinder.AddBinding(nameof(cfg.UseLowerCaseDisassembly), mnuUseLowerCaseDisassembly); _entityBinder.AddBinding(nameof(cfg.UseAltSpcOpNames), mnuUseAltSpcOpNames); mnuShowByteCode.CheckedChanged += (s, e) => { ctrlDisassemblyView.CodeViewer.ShowContentNotes = mnuShowByteCode.Checked; }; mnuShowMemoryMappings.CheckedChanged += (s, e) => { if (_cpuType == CpuType.Gameboy) { ctrlMemoryMapping.Visible = mnuShowMemoryMappings.Checked; } }; mnuUseLowerCaseDisassembly.CheckedChanged += this.UpdateFlags; mnuUseAltSpcOpNames.CheckedChanged += this.UpdateFlags; _entityBinder.UpdateUI(); Font font = new Font(cfg.FontFamily, cfg.FontSize, cfg.FontStyle); ctrlDisassemblyView.CodeViewer.BaseFont = font; ctrlDisassemblyView.CodeViewer.TextZoom = cfg.TextZoom; RestoreLocation(cfg.WindowLocation, cfg.WindowSize); if (cfg.SplitterDistance.HasValue) { ctrlSplitContainer.SplitterDistance = cfg.SplitterDistance.Value; } }
public virtual async Task <Customer> GetCustomerById(int customerId) { DebuggerInfo.DisplayCurrentMethod(MethodBase.GetCurrentMethod()); Customer resultData; using (_dbcontext = new AdventureCtx()) { resultData = _dbcontext.Customers.SingleOrDefault(c => c.CustomerID == customerId); } return(await Task.Run(() => resultData)); }
public void GetBreakpointLineProperties(LineProperties props, int cpuAddress) { DebuggerInfo config = ConfigManager.Config.Debug.Debugger; foreach (Breakpoint breakpoint in BreakpointManager.Breakpoints) { if (breakpoint.Matches((uint)cpuAddress, SnesMemoryType.CpuMemory)) { SetBreakpointLineProperties(props, breakpoint); } } }
public void Launch(DebuggerInfo debugger) { var process = Process.Start(this.Profile.GetExecutableFile(), this.Profile.GetCommandLineArguments()); if (debugger != null) { debugger.AttachProcess(process); } else { App.ReportStatus("Profile launched successfully."); } }
public frmBreakIn(CpuType cpuType) { InitializeComponent(); _cpuType = cpuType; DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; nudCount.Value = cfg.BreakInCount; radCpuInstructions.Checked = cfg.BreakInMetric == BreakInMetric.CpuInstructions; radPpuCycles.Checked = cfg.BreakInMetric == BreakInMetric.PpuCycles; radScanlines.Checked = cfg.BreakInMetric == BreakInMetric.Scanlines; radFrames.Checked = cfg.BreakInMetric == BreakInMetric.Frames; }
public override LineProperties GetLineStyle(CodeLineData lineData, int lineIndex) { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; LineProperties props = new LineProperties(); if (lineData.Address >= 0) { GetBreakpointLineProperties(props, lineData.Address); } bool isActiveStatement = ActiveAddress.HasValue && ActiveAddress.Value == lineData.Address; if (isActiveStatement) { ConfigureActiveStatement(props); } //TODO /* else if(_code._code.UnexecutedAddresses.Contains(lineNumber)) { * props.LineBgColor = info.CodeUnexecutedCodeColor; * }*/ if (lineData.Flags.HasFlag(LineFlags.PrgRom)) { props.AddressColor = Color.Gray; } else if (lineData.Flags.HasFlag(LineFlags.WorkRam)) { props.AddressColor = Color.DarkBlue; } else if (lineData.Flags.HasFlag(LineFlags.SaveRam)) { props.AddressColor = Color.DarkRed; } if (lineData.Flags.HasFlag(LineFlags.VerifiedData)) { props.LineBgColor = cfg.CodeVerifiedDataColor; } else if (!lineData.Flags.HasFlag(LineFlags.VerifiedCode)) { props.LineBgColor = cfg.CodeUnidentifiedDataColor; } return(props); }
private void UpdateCodeHighlighting() { if (txtCode.SyntaxDescriptor != null) { SyntaxDescriptor desc = txtCode.SyntaxDescriptor; txtCode.SyntaxDescriptor = null; txtCode.ClearStylesBuffer(); desc.Dispose(); } DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; SyntaxDescriptor syntax = new SyntaxDescriptor(); syntax.styles.Add(new TextStyle(new SolidBrush(cfg.CodeOpcodeColor), Brushes.Transparent, FontStyle.Regular)); syntax.styles.Add(new TextStyle(new SolidBrush(cfg.CodeLabelDefinitionColor), Brushes.Transparent, FontStyle.Regular)); syntax.styles.Add(new TextStyle(new SolidBrush(cfg.CodeImmediateColor), Brushes.Transparent, FontStyle.Regular)); syntax.styles.Add(new TextStyle(new SolidBrush(cfg.CodeAddressColor), Brushes.Transparent, FontStyle.Regular)); syntax.styles.Add(new TextStyle(new SolidBrush(cfg.CodeCommentColor), Brushes.Transparent, FontStyle.Regular)); syntax.rules.Add(new RuleDesc() { style = syntax.styles[0], pattern = @"(\n|^)[ \t]*(?<range>[a-zA-Z]{3}[*]{0,1})( |[^:a-zA-Z])" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[1], pattern = @"(\n|^)[ \t]*(?<range>[@_a-zA-Z]+[@_a-zA-Z0-9]*):" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[1], pattern = @"(\n|^)[ \t]*[a-zA-Z]{3}[ \t]+[(]{0,1}(?<range>[@_a-zA-Z]([@_a-zA-Z0-9])+)" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[2], pattern = @"(\n|^)[ \t]*[a-zA-Z]{3}[ \t]+(?<range>#[$]{0,1}([A-Fa-f0-9])+)" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[3], pattern = @"(\n|^)[ \t]*[a-zA-Z]{3}[ \t]+[\[(]{0,1}(?<range>([$][A-Fa-f0-9]+)|([0-9]+))[\])]{0,1}[ \t]*(,X|,Y|,x|,y|,s|,s\),y){0,1}[\])]{0,1}" }); syntax.rules.Add(new RuleDesc() { style = syntax.styles[4], pattern = @"(\n|^)[^\n;]*(?<range>;[^\n]*)" }); txtCode.SyntaxDescriptor = syntax; txtCode.OnTextChanged(); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; cfg.WindowSize = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size; cfg.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location; _entityBinder.UpdateObject(); ConfigManager.ApplyChanges(); BreakpointManager.BreakpointsEnabled = false; if (this._notifListener != null) { this._notifListener.Dispose(); this._notifListener = null; } }
public override LineProperties GetLineStyle(CodeLineData lineData, int lineIndex) { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; LineProperties props = new LineProperties(); if (lineData.Address >= 0) { GetBreakpointLineProperties(props, lineData.Address); } bool isActiveStatement = ActiveAddress.HasValue && ActiveAddress.Value == lineData.Address; if (isActiveStatement) { ConfigureActiveStatement(props); } return(props); }
private void mnuBreakOptions_DropDownOpening(object sender, EventArgs e) { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; mnuBreakOnBrk.Checked = cfg.BreakOnBrk; mnuBreakOnCop.Checked = cfg.BreakOnCop; mnuBreakOnStp.Checked = cfg.BreakOnStp; mnuBreakOnWdm.Checked = cfg.BreakOnWdm; mnuBreakOnOpen.Checked = cfg.BreakOnOpen; mnuBreakOnPowerCycleReset.Checked = cfg.BreakOnPowerCycleReset; mnuBreakOnUnitRead.Checked = cfg.BreakOnUninitRead; mnuGbBreakOnDisableLcdOutsideVblank.Checked = cfg.GbBreakOnDisableLcdOutsideVblank; mnuGbBreakOnInvalidOamAccess.Checked = cfg.GbBreakOnInvalidOamAccess; mnuGbBreakOnInvalidOpCode.Checked = cfg.GbBreakOnInvalidOpCode; mnuGbBreakOnInvalidVramAccess.Checked = cfg.GbBreakOnInvalidVramAccess; mnuGbBreakOnNopLoad.Checked = cfg.GbBreakOnNopLoad; mnuGbBreakOnOamCorruption.Checked = cfg.GbBreakOnOamCorruption; mnuBringToFrontOnBreak.Checked = cfg.BringToFrontOnBreak; mnuBringToFrontOnPause.Checked = cfg.BringToFrontOnPause; }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; cfg.WindowSize = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size; cfg.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location; _entityBinder.UpdateObject(); ConfigManager.ApplyChanges(); ConfigApi.SetDebuggerFlag(_cpuType == CpuType.Cpu ? DebuggerFlags.CpuDebuggerEnabled : DebuggerFlags.SpcDebuggerEnabled, false); BreakpointManager.RemoveCpuType(_cpuType); if (this._notifListener != null) { this._notifListener.Dispose(); this._notifListener = null; } }
public static List <CodeColor> GetCpuHighlights(CodeLineData lineData, bool highlightCode, string addressFormat, Color?textColor, bool showMemoryValues) { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; string codeString = lineData.Text; Color defaultColor = Color.FromArgb(60, 60, 60); if (codeString.Length > 0 && highlightCode && !lineData.Flags.HasFlag(LineFlags.Label)) { List <CodeColor> colors = new List <CodeColor>(); bool foundOpCode = false; while (codeString.Length > 0) { Match m; if (foundOpCode && (m = _operand.Match(codeString)).Success) { string operand = m.Value; Color operandColor = operand.Length > 0 ? (operand[0] == '#' ? (Color)cfg.CodeImmediateColor : (operand[0] == '$' ? (Color)cfg.CodeAddressColor : (Color)cfg.CodeLabelDefinitionColor)) : Color.Black; colors.Add(new CodeColor() { Text = m.Value, Color = textColor.HasValue ? textColor.Value : operandColor }); } else if (!foundOpCode && (m = _opCode.Match(codeString)).Success) { foundOpCode = true; colors.Add(new CodeColor() { Text = m.Value, Color = textColor.HasValue ? textColor.Value : (Color)cfg.CodeOpcodeColor }); } else if ((m = _syntax.Match(codeString)).Success) { colors.Add(new CodeColor() { Text = m.Value, Color = textColor.HasValue ? textColor.Value : defaultColor }); } else if ((m = _space.Match(codeString)).Success) { colors.Add(new CodeColor() { Text = m.Value, Color = textColor.HasValue ? textColor.Value : defaultColor }); } if (m.Success) { codeString = codeString.Substring(m.Value.Length); } else { break; } } //Display the rest of the line (used by trace logger) colors.Add(new CodeColor() { Text = codeString, Color = defaultColor }); if (lineData.EffectiveAddress >= 0) { colors.Add(new CodeColor() { Text = " " + lineData.GetEffectiveAddressString(addressFormat), Color = cfg.CodeEffectiveAddressColor }); } if (showMemoryValues && lineData.ValueSize > 0) { colors.Add(new CodeColor() { Text = lineData.GetValueString(), Color = defaultColor }); } return(colors); } else { Color color = codeString.EndsWith(":") ? (Color)cfg.CodeLabelDefinitionColor : (textColor ?? defaultColor); return(new List <CodeColor>() { new CodeColor() { Text = codeString, Color = color } }); } }
private void mnuCodeDataLogger_DropDownOpening(object sender, EventArgs e) { DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; mnuAutoResetCdl.Checked = cfg.AutoResetCdl; }