On Release build, why does boost::stacktrace::stacktrace() produce a decoded stacktrace only when an absolute PDB file path is in the exe/dll file?

Viewed 173

I am working on a c++ project using Microsoft visual studio 2017. We use boost::stacktrace::stacktrace() API to generate a functions stacktrace when the application crashes.

Recently I noticed on Release build that when a PDB file is generated, its absolute path is embedded into the exe/dll file. IF the PDB file exists at that path and the application crashes, the generated stacktrace is decoded, i.e., consists of actual function names. If the PDB file is not at that path, the stacktrace is encoded, i.e., it just consists of some hexadecimal stack addresses.

Then I have found that we can remove the PDB directory path in the exe/dll file and keep only its base name, i.e., the PDB file name, using the linker option /PDBALTPATH:%_PDB%.

I used the previously mentioned linker option and made an experiment by putting the PDB file without changing its name next to the exe/dll file in the same directory, and I expected that a decoded stacktrace will be generated because the new PDB path in the exe/dll file should be interpreted as a relative path. But when the application crashes now, the generated stacktrace is encoded.

Why was not the PDB file found by boost:stacktrace::stacktrace() in the previously mentioned case?

0 Answers
Related