Skip to content

Commit a31108c

Browse files
Support of DWARF V2
Change code to support DWARF Version 2 (Microchip AVR8 tool chains) Change comment to indicate changes between V2 and V3. Verify the code to ensure it is compliant to support DWARF v2 and DWARF v3.
1 parent 18ba926 commit a31108c

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

src/LibObjectFile.CodeGen/dwarf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ extern "C" {
338338
#define DW_AT_associated 0x4f /* DWARF3 */
339339
#define DW_AT_data_location 0x50 /* DWARF3 */
340340
#define DW_AT_byte_stride 0x51 /* DWARF3f */
341-
#define DW_AT_stride 0x51 /* DWARF3 (do not use) */
341+
#define DW_AT_stride 0x51 /* DWARF2 (do not use) */
342342
#define DW_AT_entry_pc 0x52 /* DWARF3 */
343343
#define DW_AT_use_UTF8 0x53 /* DWARF3 */
344344
#define DW_AT_extension 0x54 /* DWARF3 */

src/LibObjectFile/Dwarf/DwarfUnit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public override void Read(DwarfReader reader)
171171

172172
DwarfUnitKindEx unitKind = reader.DefaultUnitKind;
173173

174-
if (version <= 2 || version > 5)
174+
if (version < 2 || version > 5)
175175
{
176176
reader.Diagnostics.Error(DiagnosticId.DWARF_ERR_VersionNotSupported, $"Version {version} is not supported");
177177
return null;

src/LibObjectFile/generated/LibObjectFile.Dwarf.generated.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ public static unsafe partial class DwarfNative
759759
public const ushort DW_AT_byte_stride = 81;
760760

761761
/// <summary>
762-
/// DWARF3 (do not use)
762+
/// DWARF2 (do not use)
763763
/// </summary>
764764
public const ushort DW_AT_stride = 81;
765765

@@ -4183,9 +4183,15 @@ public enum DwarfAttributeKind : ushort
41834183
ReturnAddr = DwarfNative.DW_AT_return_addr,
41844184

41854185
StartScope = DwarfNative.DW_AT_start_scope,
4186-
4186+
4187+
/// <summary>
4188+
/// DWARF3 name
4189+
/// </summary>
41874190
BitStride = DwarfNative.DW_AT_bit_stride,
4188-
4191+
4192+
/// <summary>
4193+
/// DWARF2 name
4194+
/// </summary>
41894195
StrideSize = DwarfNative.DW_AT_stride_size,
41904196

41914197
UpperBound = DwarfNative.DW_AT_upper_bound,
@@ -4253,9 +4259,15 @@ public enum DwarfAttributeKind : ushort
42534259
Associated = DwarfNative.DW_AT_associated,
42544260

42554261
DataLocation = DwarfNative.DW_AT_data_location,
4256-
4262+
4263+
/// <summary>
4264+
/// DWARF3f
4265+
/// </summary>
42574266
ByteStride = DwarfNative.DW_AT_byte_stride,
4258-
4267+
4268+
/// <summary>
4269+
/// DWARF2
4270+
/// </summary>
42594271
Stride = DwarfNative.DW_AT_stride,
42604272

42614273
EntryPC = DwarfNative.DW_AT_entry_pc,

0 commit comments

Comments
 (0)