Skip to content

[NativeAOT] DWARF symbols for shared libraries produce invalid DW_AT_decl_file/DW_AT_decl_line #115769

Closed
@thefex

Description

@thefex

Description

When building NativeAOT shared library (.so/.dylib) produced DWARF symbols contain invalid entries for DW_AT_decl_file/DW_AT_decl_line - which has following impact:

  • difficult to set breakpoints via native debugger, ex. lldb breakpoint set FileName.cs:LineNumber does not work
    Even though function symbol names are properly generated (DW_at_name) - the file/line number is not.

This bug exists on all linux-bionic/ios target types (i.e. linux-bionic-arm64, ios-arm64), on both net9 & net10.

Reproduction Steps

Check this repro solution:
https://github.com/thefex/ReproduceNativeAOTDwarfBug

  • you can build using publish_droid.sh on OSX if you have NDK 28.1.13356709 installed (or you can change NDK path in script)

  • build manually via dotnet publish ..

  • extract: libRepro-arm64-debug-dwarfinfo.txt.zip manually - this is dwarfdump for bin/net10/linux-bionic-arm64/publish/libRepro.so.dbg

Check that all DW_.._file points to:

DW_AT_decl_file	("/_/crypto/src/x509/SubjectPublicKeyInfoFactory.cs")
DW_AT_decl_line	(1)

Expected behavior

DWARF symbols DW_AT_decl_file/line points to valid file/line number.

Actual behavior

DW_AT_decl_file	("/_/crypto/src/x509/SubjectPublicKeyInfoFactory.cs")
DW_AT_decl_line	(1)

-> most symbols point to invalid file

Regression?

No, it exists in net9.0 as well.

Known Workarounds

n/a

Configuration

It has been built with .NET 10.0.100-preview.4.

It has been verified that bug also exists on:
version: 9.0.101
Commit: dotnet/sdk@eedb237
Workload version: 9.0.101.2
MSBuild version: 17.12.12+1cce77968

It seems issue is affecting all nativeaot target frameworks - even though I only checked ios-..-arm64, linux-bionic-arm/arm64...

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions