From 18d0969b8b15348fe7d786efe45c7a1e4e7593b0 Mon Sep 17 00:00:00 2001 From: TollyH Date: Thu, 6 Jun 2024 20:02:12 +0100 Subject: [PATCH] Always compile debug information components --- AssEmbly.csproj | 2 -- Assembler.cs | 6 ------ DebugInfo.cs | 4 ++-- Exceptions.cs | 2 -- Program.cs | 2 -- .../Localization/Strings.Debugger.Designer.cs | 18 ------------------ Resources/Localization/Strings.Debugger.resx | 6 ------ Resources/Localization/Strings.Designer.cs | 18 ++++++++++++++++++ Resources/Localization/Strings.resx | 6 ++++++ 9 files changed, 26 insertions(+), 38 deletions(-) diff --git a/AssEmbly.csproj b/AssEmbly.csproj index b5aae62..598001f 100644 --- a/AssEmbly.csproj +++ b/AssEmbly.csproj @@ -58,8 +58,6 @@ - - diff --git a/Assembler.cs b/Assembler.cs index f70226f..9f84073 100644 --- a/Assembler.cs +++ b/Assembler.cs @@ -11,9 +11,7 @@ namespace AssEmbly public readonly record struct AssemblyResult ( byte[] Program, -#if DEBUGGER string DebugInfo, -#endif string[] ExpandedSourceFile, #if ASSEMBLER_WARNINGS Warning[] Warnings, @@ -452,17 +450,13 @@ public AssemblyResult GetAssemblyResult(bool finalize) { programBytes = program.ToArray(); } -#if DEBUGGER string debugInfo = DebugInfo.GenerateDebugInfoFile((uint)program.Count, assembledLines, // Convert dictionary to sorted list addressLabelNames.Select(x => (x.Key, x.Value)).OrderBy(x => x.Key).ToList(), resolvedImports, fileLineMap); -#endif return new AssemblyResult( programBytes, -#if DEBUGGER debugInfo, -#endif dynamicLines.ToArray(), #if ASSEMBLER_WARNINGS warnings.ToArray(), diff --git a/DebugInfo.cs b/DebugInfo.cs index e25b2aa..7ea2c68 100644 --- a/DebugInfo.cs +++ b/DebugInfo.cs @@ -110,11 +110,11 @@ public static DebugInfoFile ParseDebugInfoFile(string fileText) Match fileMatch = DebugFileRegex.Match(fileText); if (!fileMatch.Success) { - throw new DebugFileException(Strings_Debugger.DebugInfo_Error_Invalid_Format); + throw new DebugFileException(Strings.DebugInfo_Error_Invalid_Format); } if (fileMatch.Groups["Version"].Value != FormatVersion) { - throw new DebugFileException(Strings_Debugger.DebugInfo_Error_Wrong_Version); + throw new DebugFileException(Strings.DebugInfo_Error_Wrong_Version); } List<(ulong Address, string Line)> assembledInstructions = new(); diff --git a/Exceptions.cs b/Exceptions.cs index 2c9a8d6..978ae61 100644 --- a/Exceptions.cs +++ b/Exceptions.cs @@ -159,7 +159,6 @@ public WhileLimitExceededException([Localizable(true)] string message, int line, } #endif -#if DEBUGGER /// /// Represents exceptions specific to the AssEmbly debugger. /// @@ -183,7 +182,6 @@ public DebugFileException([Localizable(true)] string message, Exception inner) : public DebugFileException([Localizable(true)] string message, [Localizable(true)] string consoleMessage) : base(message, consoleMessage) { } public DebugFileException([Localizable(true)] string message, [Localizable(true)] string consoleMessage, Exception inner) : base(message, consoleMessage, inner) { } } -#endif #if PROCESSOR /// diff --git a/Program.cs b/Program.cs index 240885b..4760df8 100644 --- a/Program.cs +++ b/Program.cs @@ -307,12 +307,10 @@ private static void AssembleSourceFile(CommandLineArgs args) programSize = bytes.LongLength - AAPFile.HeaderSize; } -#if DEBUGGER if (!args.IsOptionGiven('D', "no-debug-file")) { File.WriteAllText(destination + ".adi", assemblyResult.DebugInfo); } -#endif if (args.IsOptionGiven('e', "output-expanded")) { File.WriteAllLines(filename + ".exp.asm", assemblyResult.ExpandedSourceFile); diff --git a/Resources/Localization/Strings.Debugger.Designer.cs b/Resources/Localization/Strings.Debugger.Designer.cs index 9eb3b1f..697b7b3 100644 --- a/Resources/Localization/Strings.Debugger.Designer.cs +++ b/Resources/Localization/Strings.Debugger.Designer.cs @@ -97,24 +97,6 @@ internal static string Command_Prompt { } } - /// - /// Looks up a localized string similar to The provided debug information file was in an invalid format. - /// - internal static string DebugInfo_Error_Invalid_Format { - get { - return ResourceManager.GetString("DebugInfo_Error_Invalid_Format", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The provided debug information file was created for a different version of AssEmbly. - /// - internal static string DebugInfo_Error_Wrong_Version { - get { - return ResourceManager.GetString("DebugInfo_Error_Wrong_Version", resourceCulture); - } - } - /// /// Looks up a localized string similar to This command requires either 1 or no arguments. Run 'help' for more info.. /// diff --git a/Resources/Localization/Strings.Debugger.resx b/Resources/Localization/Strings.Debugger.resx index 67e320a..3525549 100644 --- a/Resources/Localization/Strings.Debugger.resx +++ b/Resources/Localization/Strings.Debugger.resx @@ -263,12 +263,6 @@ Halt instruction reached. You should not continue unless this instruction was pl The stack is currently empty. - - The provided debug information file was in an invalid format - - - The provided debug information file was created for a different version of AssEmbly - Flag changes: diff --git a/Resources/Localization/Strings.Designer.cs b/Resources/Localization/Strings.Designer.cs index c574415..30f90f8 100644 --- a/Resources/Localization/Strings.Designer.cs +++ b/Resources/Localization/Strings.Designer.cs @@ -78,6 +78,24 @@ internal static string AAP_Error_Invalid_Not_Enough_Bytes { } } + /// + /// Looks up a localized string similar to The provided debug information file was in an invalid format. + /// + internal static string DebugInfo_Error_Invalid_Format { + get { + return ResourceManager.GetString("DebugInfo_Error_Invalid_Format", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided debug information file was created for a different version of AssEmbly. + /// + internal static string DebugInfo_Error_Wrong_Version { + get { + return ResourceManager.GetString("DebugInfo_Error_Wrong_Version", resourceCulture); + } + } + /// /// Looks up a localized string similar to , . /// diff --git a/Resources/Localization/Strings.resx b/Resources/Localization/Strings.resx index 38ecb2b..e722ef5 100644 --- a/Resources/Localization/Strings.resx +++ b/Resources/Localization/Strings.resx @@ -115,4 +115,10 @@ Licensed under GPLv3; run the "license" operation for details. unmapped + + The provided debug information file was in an invalid format + + + The provided debug information file was created for a different version of AssEmbly + \ No newline at end of file