protected override bool ValidateInput() { if (txtCondition.Text.Length > 0) { EvalResultType resultType; InteropEmu.DebugEvaluateExpression(txtCondition.Text, out resultType); if (resultType == EvalResultType.Invalid) { picExpressionWarning.Visible = true; return(false); } } picExpressionWarning.Visible = false; if (radRange.Checked) { int start = 0, end = 0; int.TryParse(txtFrom.Text, NumberStyles.HexNumber, null, out start); int.TryParse(txtTo.Text, NumberStyles.HexNumber, null, out end); if (end < start) { return(false); } } return(chkRead.Checked || chkWrite.Checked || chkExec.Checked || chkReadVram.Checked || chkWriteVram.Checked || txtCondition.Text.Length > 0); }
public static List <WatchValueInfo> GetWatchContent(bool useHex) { var list = new List <WatchValueInfo>(); for (int i = 0; i < _watchEntries.Count; i++) { string expression = _watchEntries[i]; string newValue = ""; EvalResultType resultType; Int32 result = InteropEmu.DebugEvaluateExpression(expression, out resultType); bool forceHasChanged = false; switch (resultType) { case EvalResultType.Numeric: newValue = useHex ? ("$" + result.ToString("X2")) : result.ToString(); break; case EvalResultType.Boolean: newValue = result == 0 ? "false" : "true"; break; case EvalResultType.Invalid: newValue = "<invalid expression>"; forceHasChanged = true; break; case EvalResultType.DivideBy0: newValue = "<division by zero>"; forceHasChanged = true; break; } list.Add(new WatchValueInfo() { Expression = expression, Value = newValue, HasChanged = forceHasChanged || (i < _previousValues.Count ? (_previousValues[i].Value != newValue) : false) }); } _previousValues = list; return(list); }
public static List <WatchValueInfo> GetWatchContent(bool useHex) { var list = new List <WatchValueInfo>(); for (int i = 0; i < _watchEntries.Count; i++) { string expression = _watchEntries[i].Trim(); string newValue = ""; EvalResultType resultType; bool forceHasChanged = false; Match match = _arrayWatchRegex.Match(expression); if (match.Success) { //Watch expression matches the array display syntax (e.g: [$300,10] = display 10 bytes starting from $300) newValue = ProcessArrayDisplaySyntax(useHex, ref forceHasChanged, match); } else { Int32 result = InteropEmu.DebugEvaluateExpression(expression, out resultType, true); switch (resultType) { case EvalResultType.Numeric: //When using {$00} syntax to show the value of a word, always display 4 hex characters. bool displayAsWord = expression.StartsWith("{") && expression.EndsWith("}"); newValue = useHex ? ("$" + result.ToString(displayAsWord ? "X4" : "X2")) : result.ToString(); break; case EvalResultType.Boolean: newValue = result == 0 ? "false" : "true"; break; case EvalResultType.Invalid: newValue = "<invalid expression>"; forceHasChanged = true; break; case EvalResultType.DivideBy0: newValue = "<division by zero>"; forceHasChanged = true; break; case EvalResultType.OutOfScope: newValue = "<label out of scope>"; forceHasChanged = true; break; } } list.Add(new WatchValueInfo() { Expression = expression, Value = newValue, HasChanged = forceHasChanged || (i < _previousValues.Count ? (_previousValues[i].Value != newValue) : false) }); } _previousValues = list; return(list); }
private void tmrUpdateLog_Tick(object sender, EventArgs e) { if (txtCondition.Text.Length > 0) { EvalResultType resultType; InteropEmu.DebugEvaluateExpression(txtCondition.Text, out resultType, false); picExpressionWarning.Visible = (resultType == EvalResultType.Invalid); } else { picExpressionWarning.Visible = false; } if (mnuAutoRefresh.Checked) { RefreshLog(false, false); } }
protected override bool ValidateInput() { if (txtCondition.Text.Trim().Length > 0) { EvalResultType resultType; InteropEmu.DebugEvaluateExpression(txtCondition.Text.Replace(Environment.NewLine, " "), out resultType); if (resultType == EvalResultType.Invalid) { picExpressionWarning.Visible = true; return(false); } } picExpressionWarning.Visible = false; DebugMemoryType type = cboBreakpointType.GetEnumValue <DebugMemoryType>(); int maxValue = InteropEmu.DebugGetMemorySize(type) - 1; if (radRange.Checked) { int start = 0, end = 0; int.TryParse(txtFrom.Text, NumberStyles.HexNumber, null, out start); int.TryParse(txtTo.Text, NumberStyles.HexNumber, null, out end); if (end < start || end > maxValue || start > maxValue) { return(false); } } int address; if (int.TryParse(txtAddress.Text, NumberStyles.HexNumber, null, out address)) { if (address > maxValue) { return(false); } } return(chkRead.Checked || chkWrite.Checked || (chkExec.Checked && Breakpoint.IsTypeCpuBreakpoint(type)) || txtCondition.Text.Length > 0); }
public static List <WatchValueInfo> GetWatchContent(bool useHex) { var list = new List <WatchValueInfo>(); for (int i = 0; i < _watchEntries.Count; i++) { string expression = _watchEntries[i]; string newValue = ""; EvalResultType resultType; bool forceHasChanged = false; Match match = _arrayWatchRegex.Match(expression); if (match.Success) { //Watch expression matches the array display syntax (e.g: [$300,10] = display 10 bytes starting from $300) newValue = ProcessArrayDisplaySyntax(useHex, ref forceHasChanged, match); } else { Int32 result = InteropEmu.DebugEvaluateExpression(expression, out resultType); switch (resultType) { case EvalResultType.Numeric: newValue = useHex ? ("$" + result.ToString("X2")) : result.ToString(); break; case EvalResultType.Boolean: newValue = result == 0 ? "false" : "true"; break; case EvalResultType.Invalid: newValue = "<invalid expression>"; forceHasChanged = true; break; case EvalResultType.DivideBy0: newValue = "<division by zero>"; forceHasChanged = true; break; } } list.Add(new WatchValueInfo() { Expression = expression, Value = newValue, HasChanged = forceHasChanged || (i < _previousValues.Count ? (_previousValues[i].Value != newValue) : false) }); } _previousValues = list; return(list); }
protected override bool ValidateInput() { if (txtCondition.Text.Trim().Length > 0) { EvalResultType resultType; InteropEmu.DebugEvaluateExpression(txtCondition.Text.Replace(Environment.NewLine, " "), out resultType, false); if (resultType == EvalResultType.Invalid) { picExpressionWarning.Visible = true; return(false); } } picExpressionWarning.Visible = false; DebugMemoryType type = cboBreakpointType.GetEnumValue <DebugMemoryType>(); int maxValue = InteropEmu.DebugGetMemorySize(type) - 1; if (radSpecificAddress.Checked) { if (ValidateAddress(txtAddress, maxValue) < 0) { return(false); } } else if (radRange.Checked) { int start = ValidateAddress(txtFrom, maxValue); int end = ValidateAddress(txtTo, maxValue); if (start < 0 || end < 0 || end < start) { return(false); } } return(chkRead.Checked || chkWrite.Checked || (chkExec.Checked && Breakpoint.IsTypeCpuBreakpoint(type)) || txtCondition.Text.Length > 0); }
public void UpdateWatch(int currentSelection = -1) { lstWatch.SelectedIndices.Clear(); //Remove empty items for (int i = lstWatch.Items.Count - 1; i >= 0; i--) { if (string.IsNullOrWhiteSpace(lstWatch.Items[i].Text)) { lstWatch.Items.RemoveAt(i); } } lstWatch.Items.Add(""); ListViewItem lastItem = lstWatch.Items[lstWatch.Items.Count - 1]; foreach (ListViewItem item in lstWatch.Items) { item.UseItemStyleForSubItems = false; if (item != lastItem) { string previousValue = null; if (item.SubItems.Count > 1) { previousValue = item.SubItems[1].Text; item.SubItems.RemoveAt(1); } string newValue = ""; EvalResultType resultType; Int32 result = InteropEmu.DebugEvaluateExpression(item.Text, out resultType); switch (resultType) { case EvalResultType.Numeric: if (mnuHexDisplay.Checked) { newValue = "$" + result.ToString("X"); } else { newValue = result.ToString(); } break; case EvalResultType.Boolean: newValue = result == 0 ? "false" : "true"; break; case EvalResultType.Invalid: newValue = "<invalid expression>"; break; } item.SubItems.Add(newValue); item.SubItems[1].ForeColor = newValue != previousValue ? Color.Red : Color.Black; } } AdjustColumnWidth(); if (currentSelection >= 0 && lstWatch.Items.Count > currentSelection) { lstWatch.FocusedItem = lstWatch.Items[currentSelection]; lstWatch.Items[currentSelection].Selected = true; } ConfigManager.Config.DebugInfo.WatchValues.Clear(); foreach (ListViewItem item in lstWatch.Items) { if (!string.IsNullOrWhiteSpace(item.Text)) { ConfigManager.Config.DebugInfo.WatchValues.Add(item.Text); } } }
public static List <WatchValueInfo> GetWatchContent(List <WatchValueInfo> previousValues) { WatchFormatStyle defaultStyle = ConfigManager.Config.DebugInfo.WatchFormat; int defaultByteLength = 1; if (defaultStyle == WatchFormatStyle.Signed) { defaultByteLength = 4; } var list = new List <WatchValueInfo>(); for (int i = 0; i < _watchEntries.Count; i++) { string expression = _watchEntries[i].Trim(); string newValue = ""; EvalResultType resultType; string exprToEvaluate = expression; WatchFormatStyle style = defaultStyle; int byteLength = defaultByteLength; if (expression.StartsWith("{") && expression.EndsWith("}")) { //Default to 2-byte values when using {} syntax byteLength = 2; } ProcessFormatSpecifier(ref exprToEvaluate, ref style, ref byteLength); bool forceHasChanged = false; Match match = _arrayWatchRegex.Match(expression); if (match.Success) { //Watch expression matches the array display syntax (e.g: [$300,10] = display 10 bytes starting from $300) newValue = ProcessArrayDisplaySyntax(style, ref forceHasChanged, match); } else { Int32 result = InteropEmu.DebugEvaluateExpression(exprToEvaluate, out resultType, true); switch (resultType) { case EvalResultType.Numeric: newValue = FormatValue(result, style, byteLength); break; case EvalResultType.Boolean: newValue = result == 0 ? "false" : "true"; break; case EvalResultType.Invalid: newValue = "<invalid expression>"; forceHasChanged = true; break; case EvalResultType.DivideBy0: newValue = "<division by zero>"; forceHasChanged = true; break; case EvalResultType.OutOfScope: newValue = "<label out of scope>"; forceHasChanged = true; break; } } list.Add(new WatchValueInfo() { Expression = expression, Value = newValue, HasChanged = forceHasChanged || (i < previousValues.Count ? (previousValues[i].Value != newValue) : false) }); } return(list); }