Skip to content

Commit

Permalink
Feat/debugger QoL part two (OpenRakis#956)
Browse files Browse the repository at this point in the history
* chore: Remove+Sort usings

* refactor: Reloading DISASM is async

* fix: Conflicting keyboatd shortcuts

* refactor: InstructionsDecoder out of DISASM VM

* refactor: load indicator layout

* feat: Breakpoint toggle from checkbox

* chore: Update all Nuget packages

* chore: Prefer generic overload

* refactor: Move simple copies to extension methods

* feat: Address in breakpoint status message

* refactor: UI uses STJ instead of Newtonsoft.Json

* refactor: ByteArrayBinaryDocument is obsolete.

* feat: AutoCompleteBox in memory and disasm views

* fix: exception handling in memory edit commands

* chore: Reorganze class

* feat: DISASM context menu keyboard shortcuts

* feat: DISASM UI refresh on Key.Enter usage

* feat: Memory selection information status bar

* feat: Memory breakpoint range creation

* feat: Memory breakpoint context menu entry

* feat: Remove breakpoint keyboard shortcut

* feat: Breakpoint comment field

* fix: DISASM breakpoint updates from elsewhere

* feat: Disable/Enable Breakpoint in DISASM

Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>

* refactor: Remove Created breakpoint UI event

* refactor: GDB checks if the parsed breakpoint is null

* fix: BreakPoint enable/disable from UI

* fix: No crashes, and no phantom breakpoints

* fix: Update DISASM on breakpoint disable/enable

Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>

* feat: Add comment for generated UI breakpoints

* refactor: Step into with UnconditionalBreakpoint

* refactor: GetOrCreateBreakpoint

* fix: Step Over was generating phantom breakpoints

* refactor: More precise DISASM listing updates

Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>

---------

Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
  • Loading branch information
maximilien-noal authored Dec 14, 2024
1 parent 981d343 commit 8c3b7cd
Show file tree
Hide file tree
Showing 30 changed files with 914 additions and 516 deletions.
19 changes: 10 additions & 9 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="11.2.1" />
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.2.1" />
<PackageVersion Include="Avalonia" Version="11.2.2" />
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.2.2" />
<PackageVersion Include="Avalonia.Controls.PanAndZoom" Version="11.2.0" />
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.0.10" />
<PackageVersion Include="Avalonia.Desktop" Version="11.2.1" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.1" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.2.1" />
<PackageVersion Include="Avalonia.Xaml.Behaviors" Version="11.2.0" />
<PackageVersion Include="Avalonia.Desktop" Version="11.2.2" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.2" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.2.2" />
<PackageVersion Include="Avalonia.Xaml.Behaviors" Version="11.2.0.1" />
<PackageVersion Include="AvaloniaGraphControl" Version="0.6.1" />
<PackageVersion Include="AvaloniaHex" Version="0.1.5" />
<PackageVersion Include="bodong.Avalonia.PropertyGrid" Version="11.1.4.2" />
Expand All @@ -20,9 +20,10 @@
<PackageVersion Include="CommunityToolkit.HighPerformance" Version="8.3.2" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Deadpikle.AvaloniaProgressRing" Version="0.10.10" />
<PackageVersion Include="DialogHost.Avalonia" Version="0.8.1" />
<PackageVersion Include="ErrorProne.NET.CoreAnalyzers" Version="0.1.2" />
<PackageVersion Include="FluentIcons.Avalonia.Fluent" Version="1.1.265" />
<PackageVersion Include="FluentIcons.Avalonia.Fluent" Version="1.1.266" />
<PackageVersion Include="Iced" Version="1.21.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageVersion Include="JvE.Structurizer" Version="1.0.1" />
Expand All @@ -34,8 +35,8 @@
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.9" />
<PackageVersion Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.9" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.1" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.1" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1.1" />
<PackageVersion Include="Semi.Avalonia.TreeDataGrid" Version="11.0.10.1" />
<PackageVersion Include="Serilog" Version="4.1.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
Expand Down
8 changes: 5 additions & 3 deletions src/Spice86.Core/Emulator/Gdb/GdbCommandBreakPointHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ public GdbCommandBreakpointHandler(EmulatorBreakpointsManager emulatorBreakpoint
/// <returns>A response string to send back to GDB.</returns>
public string AddBreakpoint(string commandContent) {
BreakPoint? breakPoint = ParseBreakPoint(commandContent);
_emulatorBreakpointsManager.ToggleBreakPoint(breakPoint, true);
if (_loggerService.IsEnabled(LogEventLevel.Debug)) {
_loggerService.Debug("Breakpoint added!\n{@BreakPoint}", breakPoint);
if(breakPoint is not null) {
_emulatorBreakpointsManager.ToggleBreakPoint(breakPoint, true);
if (_loggerService.IsEnabled(LogEventLevel.Debug)) {
_loggerService.Debug("Breakpoint added!\n{@BreakPoint}", breakPoint);
}
}
return _gdbIo.GenerateResponse("OK");
}
Expand Down
7 changes: 2 additions & 5 deletions src/Spice86.Core/Emulator/VM/EmulatorBreakpointsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ public void OnMachineStop() {
/// </summary>
/// <param name="breakPoint">The breakpoint to toggle.</param>
/// <param name="on">True to turn the breakpoint on, false to turn it off.</param>
public void ToggleBreakPoint(BreakPoint? breakPoint, bool on) {
if (breakPoint is null) {
return;
}
BreakPointType? breakPointType = breakPoint.BreakPointType;
public void ToggleBreakPoint(BreakPoint breakPoint, bool on) {
BreakPointType breakPointType = breakPoint.BreakPointType;
switch (breakPointType) {
case BreakPointType.EXECUTION:
_executionBreakPoints.ToggleBreakPoint(breakPoint, on);
Expand Down
45 changes: 23 additions & 22 deletions src/Spice86/App.axaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
<Application
x:Class="Spice86.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
RequestedThemeVariant="Default">
x:Class="Spice86.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
RequestedThemeVariant="Default">

<Application.Resources>
<ResourceDictionary>
<FontFamily x:Key="RobotoMonoFont">avares://Spice86/Assets#Roboto Mono</FontFamily>
<FontFamily x:Key="ConsolasFont">Consolas</FontFamily>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Spice86/Assets/ControlThemes.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Application.Resources>
<ResourceDictionary>
<FontFamily x:Key="RobotoMonoFont">avares://Spice86/Assets#Roboto Mono</FontFamily>
<FontFamily x:Key="ConsolasFont">Consolas</FontFamily>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="avares://Spice86/Assets/ControlThemes.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

<Application.Styles>
<dialogHostAvalonia:DialogHostStyles />
<StyleInclude Source="avares://AvaloniaHex/Themes/Simple/AvaloniaHex.axaml" />
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
<StyleInclude Source="Styles/Spice86.axaml" />
</Application.Styles>
<Application.Styles>
<StyleInclude Source="avares://AvaloniaProgressRing/Styles/ProgressRing.xaml"/>
<dialogHostAvalonia:DialogHostStyles />
<StyleInclude Source="avares://AvaloniaHex/Themes/Simple/AvaloniaHex.axaml" />
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.TreeDataGrid/Index.axaml" />
<StyleInclude Source="Styles/Spice86.axaml" />
</Application.Styles>

</Application>
4 changes: 2 additions & 2 deletions src/Spice86/Controls/GroupBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Spice86.Controls;
/// </summary>
internal sealed class GroupBox : HeaderedContentControl {
static GroupBox() {
IsTabStopProperty.OverrideDefaultValue(typeof(GroupBox), false);
FocusableProperty.OverrideDefaultValue(typeof(GroupBox), false);
IsTabStopProperty.OverrideDefaultValue<GroupBox>(false);
FocusableProperty.OverrideDefaultValue<GroupBox>(false);
}
}
2 changes: 1 addition & 1 deletion src/Spice86/Controls/StatusBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal sealed class StatusBar : StackPanel {
protected override Type StyleKeyOverride { get; } = typeof(StackPanel);

static StatusBar() {
OrientationProperty.OverrideDefaultValue(typeof(StatusBar), Orientation.Horizontal);
OrientationProperty.OverrideDefaultValue<StatusBar>(Orientation.Horizontal);
HorizontalAlignmentProperty.OverrideDefaultValue<StatusBar>(HorizontalAlignment.Stretch);
}
}
2 changes: 1 addition & 1 deletion src/Spice86/Controls/StatusBarItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ namespace Spice86.Controls;
internal sealed class StatusBarItem : ContentControl {
static StatusBarItem() {
HorizontalContentAlignmentProperty.OverrideDefaultValue<StatusBarItem>(HorizontalAlignment.Stretch);
IsTabStopProperty.OverrideDefaultValue(typeof(StatusBarItem), false);
IsTabStopProperty.OverrideDefaultValue<StatusBarItem>(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,31 @@
using Avalonia.Media;
using Avalonia.Styling;

using Spice86.ViewModels;

using System;
using System.Globalization;

internal class BoolToBrushConverter : IValueConverter {
internal class BreakpointToBrushConverter : IValueConverter {
private static readonly SolidColorBrush DarkRed = new SolidColorBrush(Color.FromRgb(128, 0,0));
private static readonly SolidColorBrush LightRed = new SolidColorBrush(Color.FromRgb(255, 150,150));

private static readonly SolidColorBrush LightGrey = new SolidColorBrush(Color.FromRgb(240, 240, 240));
private static readonly SolidColorBrush DarkGrey = new SolidColorBrush(Color.FromRgb(64, 64, 64));

public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) {
if (value is bool source) {
if(source is true) {
ThemeVariant themeVariant = Application.Current!.ActualThemeVariant;
if (value is BreakpointViewModel source) {
ThemeVariant themeVariant = Application.Current!.ActualThemeVariant;
if (source.IsEnabled) {
return themeVariant == ThemeVariant.Dark ? DarkRed : LightRed;
}
else {
return themeVariant == ThemeVariant.Dark ? DarkGrey : LightGrey;
}
}
else {
return null;
}
return BindingOperations.DoNothing;
}

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) {
Expand Down
Loading

0 comments on commit 8c3b7cd

Please sign in to comment.