From 95d165832448798ed3391442f9d077bc89921afb Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 4 Nov 2022 16:04:01 -0700 Subject: [PATCH] Add LE/LX debug information --- .../LinearExecutable/DebugInformation.cs | 36 +++++++++++++++++++ BurnOutSharp.Models/LinearExecutable/Enums.cs | 23 ++++++++++++ .../LinearExecutable/Executable.cs | 6 +++- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 BurnOutSharp.Models/LinearExecutable/DebugInformation.cs diff --git a/BurnOutSharp.Models/LinearExecutable/DebugInformation.cs b/BurnOutSharp.Models/LinearExecutable/DebugInformation.cs new file mode 100644 index 00000000..32ce5070 --- /dev/null +++ b/BurnOutSharp.Models/LinearExecutable/DebugInformation.cs @@ -0,0 +1,36 @@ +using System.Runtime.InteropServices; + +namespace BurnOutSharp.Models.LinearExecutable +{ + /// + /// The debug information is defined by the debugger and is not controlled by + /// the linear EXE format or linker. The only data defined by the linear EXE + /// format relative to the debug information is it's offset in the EXE file and + /// length in bytes as defined in the linear EXE header. + /// + /// To support multiple debuggers the first word of the debug information is a + /// type field which determines the format of the debug information. + /// + /// + /// + [StructLayout(LayoutKind.Sequential)] + public class DebugInformation + { + /// + /// The signature consists of a string of three (3) ASCII characters: "NB0" + /// + public byte[] Signature; + + /// + /// This defines the type of debugger data that exists in the remainder of the + /// debug information. + /// + public DebugFormatType FormatType; + + // DEBUGGER DATA = Debugger specific data. + // The format of the debugger data is defined by the debugger that is being used. + // The values defined for the type field are not enforced by the system. It is + // the responsibility of the linker or debugging tools to follow the convention + // for the type field that is defined here. + } +} diff --git a/BurnOutSharp.Models/LinearExecutable/Enums.cs b/BurnOutSharp.Models/LinearExecutable/Enums.cs index 7c5ae0fa..f4d4cf69 100644 --- a/BurnOutSharp.Models/LinearExecutable/Enums.cs +++ b/BurnOutSharp.Models/LinearExecutable/Enums.cs @@ -102,6 +102,29 @@ namespace BurnOutSharp.Models.LinearExecutable MIPSMarkIII = 0x42, } + public enum DebugFormatType : byte + { + /// + /// 32-bit CodeView debugger format. + /// + CodeView32Bit = 0x00, + + /// + /// AIX debugger format. + /// + AIXDebugger = 0x01, + + /// + /// 16-bit CodeView debugger format. + /// + CodeView16Bit = 0x02, + + /// + /// 32-bit OS/2 PM debugger (IBM) format. + /// + OS2PM32Bit = 0x04, + } + public enum DirectiveNumber : ushort { /// diff --git a/BurnOutSharp.Models/LinearExecutable/Executable.cs b/BurnOutSharp.Models/LinearExecutable/Executable.cs index e1d62628..84d09c59 100644 --- a/BurnOutSharp.Models/LinearExecutable/Executable.cs +++ b/BurnOutSharp.Models/LinearExecutable/Executable.cs @@ -82,6 +82,10 @@ namespace BurnOutSharp.Models.LinearExecutable public NonResidentNameTableEntry[] NonResidentNameTable { get; set; } // TODO: Non-resident directives data - // TODO: Debug Info + + /// + /// Debug information + /// + public DebugInformation DebugInformation { get; set; } } }