dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.16k stars 4.72k forks source link

gdb fails to load debug symbols for NAOT-ed executable in release mode #78210

Closed WhiteBlackGoose closed 1 year ago

WhiteBlackGoose commented 1 year ago

Description

Error:

Reading symbols from ./Repro...
Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro]
(No debugging symbols found in ./Repro)

It read successfully when using debug mode.

Reproduction Steps

1. Create an empty console project

dotnet new console -n Repro && cd Repro

2. Create a build script (for convenience)

#!/bin/bash
dotnet publish \
-r linux-x64 \
-c $1 \
-o ./publish-output-$1 \
-p:SelfContained=true \
-p:PublishAot=true

3. Build for debug and release

./build debug && ./build release

4. Run gdb for both

For release

$ gdb ./publish-output-release/Repro
Reading symbols from ./publish-output-release/Repro...
Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro]
(No debugging symbols found in ./publish-output-release/Repro)
(gdb) 

For debug

$ gdb ./publish-output-debug/Repro
Reading symbols from ./publish-output-debug/Repro...
(gdb) 

Expected behavior

The symbols are there since I didn't strip them out, so I expect them to have been read.

Actual behavior

Fails with error

Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro]

Regression?

No response

Known Workarounds

No response

Configuration

  1. .NET 7.0.100
  2. linux-x64 (uname -v: 1 SMP Debian 5.10.140-1 (2022-09-02))
  3. amd64 (x86 64)
  4. I don't know if it's specific to my configuration

Other information

$ gdb --version
GNU gdb (Debian 12.1-4) 12.1
$ gcc --version
gcc (Debian 12.2.0-9) 12.2.0
ghost commented 1 year ago

Tagging subscribers to this area: @tommcdon See info in area-owners.md if you want to be subscribed.

Issue Details
### Description Error: ``` Reading symbols from ./Repro... Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro] (No debugging symbols found in ./Repro) ``` It read successfully when using debug mode. ### Reproduction Steps ### 1. Create an empty console project ``` dotnet new console -n Repro && cd Repro ``` ### 2. Create a build script (for convenience) ``` #!/bin/bash dotnet publish \ -r linux-x64 \ -c $1 \ -o ./publish-output-$1 \ -p:SelfContained=true \ -p:PublishAot=true ``` ### 3. Build for debug and release ``` ./build debug && ./build release ``` ### 4. Run gdb for both For release ``` $ gdb ./publish-output-release/Repro Reading symbols from ./publish-output-release/Repro... Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro] (No debugging symbols found in ./publish-output-release/Repro) (gdb) ``` For debug ``` $ gdb ./publish-output-debug/Repro Reading symbols from ./publish-output-debug/Repro... (gdb) ``` ### Expected behavior The symbols are there since I didn't strip them out, so I expect them to have been read. ### Actual behavior Fails with error ``` Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro] ``` ### Regression? _No response_ ### Known Workarounds _No response_ ### Configuration 1. .NET 7.0.100 2. linux-x64 (`uname -v`: `1 SMP Debian 5.10.140-1 (2022-09-02)`) 3. amd64 (x86 64) 4. I don't know if it's specific to my configuration ### Other information ``` $ gdb --version | head -n 1 | ci GNU gdb (Debian 12.1-4) 12.1 $ gcc --version gcc (Debian 12.2.0-9) 12.2.0 ```
Author: WhiteBlackGoose
Assignees: -
Labels: `area-Diagnostics-coreclr`
Milestone: -
kant2002 commented 1 year ago

can you post infromation about project settings related to globalization, and is this issue reproduces on hello world for you, or on specific code only?

WhiteBlackGoose commented 1 year ago

To clarify for others: it is being reproduced on a minimal project (see first step: dotnet new console). I target net7.0

ghost commented 1 year ago

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.

Issue Details
### Description Error: ``` Reading symbols from ./Repro... Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro] (No debugging symbols found in ./Repro) ``` It read successfully when using debug mode. ### Reproduction Steps ### 1. Create an empty console project ``` dotnet new console -n Repro && cd Repro ``` ### 2. Create a build script (for convenience) ``` #!/bin/bash dotnet publish \ -r linux-x64 \ -c $1 \ -o ./publish-output-$1 \ -p:SelfContained=true \ -p:PublishAot=true ``` ### 3. Build for debug and release ``` ./build debug && ./build release ``` ### 4. Run gdb for both For release ``` $ gdb ./publish-output-release/Repro Reading symbols from ./publish-output-release/Repro... Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro] (No debugging symbols found in ./publish-output-release/Repro) (gdb) ``` For debug ``` $ gdb ./publish-output-debug/Repro Reading symbols from ./publish-output-debug/Repro... (gdb) ``` ### Expected behavior The symbols are there since I didn't strip them out, so I expect them to have been read. ### Actual behavior Fails with error ``` Dwarf Error: Could not find abbrev number 297120 in CU at offset 0x0 [in module /home/goose/trash/bgbug/Repro/publish-output-release/Repro] ``` ### Regression? _No response_ ### Known Workarounds _No response_ ### Configuration 1. .NET 7.0.100 2. linux-x64 (`uname -v`: `1 SMP Debian 5.10.140-1 (2022-09-02)`) 3. amd64 (x86 64) 4. I don't know if it's specific to my configuration ### Other information ``` $ gdb --version GNU gdb (Debian 12.1-4) 12.1 $ gcc --version gcc (Debian 12.2.0-9) 12.2.0 ```
Author: WhiteBlackGoose
Assignees: -
Labels: `area-Diagnostics-coreclr`, `untriaged`, `area-NativeAOT-coreclr`
Milestone: -
agocke commented 1 year ago

Dup of https://github.com/dotnet/runtime/issues/77407. I'm looking into it but haven't gotten very far. Something about the DWARF info is definitely busted. I'm closing this one in favor of the first.

WhiteBlackGoose commented 1 year ago

If something I can test on my side, let me know