Skip to content

Fix remaining Native AOT Linux DWARF errors #90209

Closed

Description

@agocke

As noted in #89488, the only remaining Native AOT errors are EH around SAMETRY:

error: DIEs have overlapping address ranges:
0x000367a4: DW_TAG_try_block [37]   (0x000366e5)
              DW_AT_low_pc [DW_FORM_addr]       (0x00000000000132f6 "__managedcode")
              DW_AT_high_pc [DW_FORM_data8]     (0x000000000000016a)

0x00036782: DW_TAG_try_block [37]   (0x000366e5)
              DW_AT_low_pc [DW_FORM_addr]       (0x00000000000133ed "__managedcode")
              DW_AT_high_pc [DW_FORM_data8]     (0x0000000000000069)

error: DIEs have overlapping address ranges:
...

The other errors are from clang-compiled files, so there's nothing for us to do there.

Also note: EH info is not produced on Mac, so the errors don't appear there.

Activity

  1. added this to the 9.0.0 milestone on Aug 9, 2023
  2. am11 commented on Feb 6, 2024

    @am11
    Member

    error: DIEs have overlapping address ranges

    Related: #83233 (comment). @filipnavara, maybe the CORINFO_EH_CLAUSE_SAMETRY scope vs. variables in .debug_loc (LocationList

    _infoSectionWriter.EmitSymbolReference(RelocType.IMAGE_REL_BASED_HIGHLOW, ".debug_loc", (int)offset);
    ) can now be handled in managed objwriter bit more conveniently?

    ((clause.Flags & CORINFO_EH_CLAUSE_FLAGS.CORINFO_EH_CLAUSE_SAMETRY) == 0))
    {
    totalClauses++;
    }
    }
    builder.EmitCompressedUInt((uint)totalClauses);
    for (int i = 0; i < _ehClauses.Length; i++)
    {
    ref CORINFO_EH_CLAUSE clause = ref _ehClauses[i];
    if (i > 0)
    {
    ref CORINFO_EH_CLAUSE previousClause = ref _ehClauses[i - 1];
    // If the previous clause has same try offset and length as the current clause,
    // but belongs to a different try block (CORINFO_EH_CLAUSE_SAMETRY is not set),
    // emit a special marker to allow runtime distinguish this case.
    if ((previousClause.TryOffset == clause.TryOffset) &&
    (previousClause.TryLength == clause.TryLength) &&
    ((clause.Flags & CORINFO_EH_CLAUSE_FLAGS.CORINFO_EH_CLAUSE_SAMETRY) == 0))
    {
    builder.EmitCompressedUInt(0);
    builder.EmitCompressedUInt((uint)RhEHClauseKind.RH_EH_CLAUSE_FAULT);
    builder.EmitCompressedUInt(0);

  3. filipnavara commented on Feb 6, 2024

    @filipnavara
    Member

    The clauses need to be nested based on the address ranges. It should not be hard to implement.

  4. modified the milestones: 9.0.0, Future on May 21, 2024
  5. am11 commented on Jun 1, 2024

    @am11
    Member

    The code pattern which entails these errors is nested try in try and/or the catch blocks:

    using System;
    
    try {
    	// error: DIEs have overlapping address ranges:
    	// 0x000442d5: DW_TAG_try_block [32]   (0x0004426f)
    	//              DW_AT_low_pc [DW_FORM_addr]	(0x0000000000063b2c "__managedcode")
    	//              DW_AT_high_pc [DW_FORM_data8]	(0x0000000000000048)
        try { Console.WriteLine(1); }
        catch { throw; }
    
        Console.WriteLine(1.1);
    }
    catch {
    	// error: DIEs have overlapping address ranges:
        // 0x00040e71: DW_TAG_catch_block [33]   (0x00040df8)
        //          DW_AT_low_pc [DW_FORM_addr]	(0x0000000000059884 "__managedcode")
        //          DW_AT_high_pc [DW_FORM_data8]	(0x0000000000000018)
        try { Console.WriteLine(2); }
        catch { throw; }
    }
  6. filipnavara commented on Jun 1, 2024

    @filipnavara
    Member

    Yeah, that's the pattern. The tricky part is to figure out what is the correct representation in DWARF. I was convinced that it's fine to just mirror the nesting inside the DWARF structure (as parent-child relationship). Then I couldn't find it in the spec, and I tried to replicate something similar emitted by C++ compiler... and I really couldn't come up with an answer what is the correct way to represent it.

  7. am11 commented on Jun 1, 2024

    @am11
    Member

    I understood from @jakobbotsch' comment #83233 (comment) that RyuJIT should not be creating separate debug info for these nested try scopes. I assume the debuggers would still hit the breakpoint on nested try and inside the nested try as well without them? I tried to filter out the nested ranges in PublishCode() of CorInfoImpl.cs, but was failing (error: DIEs have overlapping address ranges: continue to persist). 😅

    I tried to replicate something similar emitted by C++ compiler.

    Same, found out that with clang++ -gdwarf-4 -g3 -O0 -o example example.cpp and this example.cpp:

    #include <iostream>
    
    int main() {
        int x = 0;
        std::cout << "Enter a value: ";
        std::cin >> x;
        try {
            if (x > 0) {
                throw x;
            }
        } catch (int e) {
            std::cout << "Caught exception: " << e << std::endl;
        }
        return 0;
    }

    , clang did produced some info, but that wasn't particularly useful. 🥲

  8. added
    in-pr
    on Nov 13, 2026
  9. added 2 commits that reference this issue on Nov 16, 2026
    5b71214
    f8a0761
  10. added a commit that references this issue on Nov 16, 2026
    111905c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrin-pr

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions