Skip to content

Commit

Permalink
Always compile debug information components
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed Jun 6, 2024
1 parent 952d26f commit 18d0969
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 38 deletions.
2 changes: 0 additions & 2 deletions AssEmbly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
<ItemGroup Condition="!$(DefineConstants.Contains(';DEBUGGER;'))">
<Compile Remove="Debugger.cs" />
<Compile Remove="Debugger.*.cs" />
<Compile Remove="DebugInfo.cs" />
<Compile Remove="DebugInfo.*.cs" />
</ItemGroup>

<ItemGroup Condition="!$(DefineConstants.Contains(';DISASSEMBLER;'))">
Expand Down
6 changes: 0 additions & 6 deletions Assembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions DebugInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ public WhileLimitExceededException([Localizable(true)] string message, int line,
}
#endif

#if DEBUGGER
/// <summary>
/// Represents exceptions specific to the AssEmbly debugger.
/// </summary>
Expand All @@ -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
/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 0 additions & 18 deletions Resources/Localization/Strings.Debugger.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions Resources/Localization/Strings.Debugger.resx
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,6 @@ Halt instruction reached. You should not continue unless this instruction was pl
<data name="Warning_Stack_Empty" xml:space="preserve">
<value>The stack is currently empty.</value>
</data>
<data name="DebugInfo_Error_Invalid_Format" xml:space="preserve">
<value>The provided debug information file was in an invalid format</value>
</data>
<data name="DebugInfo_Error_Wrong_Version" xml:space="preserve">
<value>The provided debug information file was created for a different version of AssEmbly</value>
</data>
<data name="REPL_Changed_Flags_Header" xml:space="preserve">
<value>Flag changes:</value>
</data>
Expand Down
18 changes: 18 additions & 0 deletions Resources/Localization/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Resources/Localization/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,10 @@ Licensed under GPLv3; run the "license" operation for details.</value>
<data name="Generic_Unmapped" xml:space="preserve">
<value>unmapped</value>
</data>
<data name="DebugInfo_Error_Invalid_Format" xml:space="preserve">
<value>The provided debug information file was in an invalid format</value>
</data>
<data name="DebugInfo_Error_Wrong_Version" xml:space="preserve">
<value>The provided debug information file was created for a different version of AssEmbly</value>
</data>
</root>

0 comments on commit 18d0969

Please sign in to comment.