Change the naming convention for debug symbol files on Windows to avoid collisions (e.g. java.exe/java.dll -> java.pdb)
Frederic Thevenet
fthevene at redhat.com
Tue Oct 3 11:57:58 UTC 2023
Hi Erik,
On 02/10/2023 20:54, erik.joelsson at oracle.com wrote:
> Hello Frederic,
>
> Is the "foo.dll" -> "foo.dll.pdb" actually recognized as a naming
> convention by Windows tools, or are they just reading the link
> recorded in the binary?
I was also initially worried about the fact the the naming convention
could turn out to be one of the means that the Microsoft tooling uses to
resolve the symbols location, but this link [1] ("Step 3: Finding the
right pdb") indicates that the convention is unimportant; instead, the
name is explicitly stored in the PE header at link time.
Although it's just a blog post and not necessarily a definitive
authority, some of the claims it makes are easy enough to verify (such
as finding the name in the PE header for an exe or dll at the expected
address).
Also, empirically using Visual Studio (VS2022 Community Edition) to
debug either a live process or a minidump, I experienced no differences
debugging a build with this patch (i.e. with "jvm.dll.pdb"), that
without; symbols are automatically found by VS is they are stored in
alongside the exes and dlls (ie. in the same folder).
When they are not, you have to manually point to a folder that contains
those, but again this is expected. Interestingly, if instead of loading
all symbols from a folder you choose to only load symbols for
"jvm.dll", for instance, then the dialog box from VS is populated with
the actual name for the file it expects: in our case it calls for
"jvm.dll.pdb" (which is further proof than this info is indeed stored,
not inferred).
> Regardless of which, if we aren't bound to the current naming
> convention for tool compatibility, I think your suggested one seems as
> good as any. I would be interested to hear from others with more
> experience developing and debugging on Windows though.
>
> /Erik
>
[1]
https://polystream.com/behind-the-curtain-understanding-the-magic-behind-loading-symbols-in-visual-studio/
--
Frederic Thevenet
Senior Software Engineer - OpenJDK
Red Hat France <https://www.redhat.com>
BAF5 C2D2 0BE0 1715 5EE1 0815 2065 AD47 B326 EB92
More information about the build-dev
mailing list