dotnet / runtime

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

ngen PdbWriter missing applying textSectionOffset to cold methods #101815

Open vvuk opened 4 months ago

vvuk commented 4 months ago

As I'm trying to figure out how to get the RVA mapping from these ngen-generated PDB files, I came across this:

https://github.com/dotnet/runtime/blob/fc76b1cac3f02cc9729f6682d6850fd7982e9fe5/src/coreclr/tools/aot/ILCompiler.Diagnostics/PdbWriter.cs#L278-L282

for cold functions, the textSectionOffset isn't applied like it is for the hot functions. This looks like a bug?

vvuk commented 4 months ago

(Also, seriously, how is one supposed to pull out the section RVA offset from these generated PDB files? There's no sections copy, no omap tables, the section_map/OMF segment map has 0 as the offset for all the sections... dia2dump can do it, but nothing else that I've found can!)

steveisok commented 4 months ago

@fanyang-mono please take a look at this.

fanyang-mono commented 1 month ago

We will verify this in .NET10 time frame.