Closed Ulysses1337 closed 2 weeks ago
Use /PDBALTPATH:%_PDB%
to work around this limitation, then you can put .pdb
next to .exe
. See /PDBALTPATH.
Sorry about having such annoying undocumented limitation.
That works; many thanks. I'll definitely apply it across the board from now on. Of course I only get full symbol info on my own binary, i.e. it has no effect on separate libraries like OpenCV in the example. This is not an issue for me, and I know there are tools to patch the embedded path, but IMO path stripping begs to be the default.
Quoting relevant parts of the help page to aid future travelers in their search:
Normally, the linker records the location of the .pdb file in the binaries that it produces. You can use this option to provide a different path and file name for the .pdb file.
and
The linker defines the environment variables %_PDB% and %_EXT%. %_PDB% expands to the file name of the actual .pdb file without any path information and %_EXT% is the extension of the generated executable.
I've contributed the std::stacktrace
feature to this STL some time ago, implementing it on top of DbgEng.dll
APIs.
And I acknowledge the feature quality is a disappointment, and I cannot do much about it.
The toolset and the APIs are designed around the idea that they are used on development setup, and the debugger process is another process. In contrast, the C++ feature should work everywhere, not only the development setup, and from within the same process.
The particular limitation you encountered comes from DbgEng.dll
in particular. An alternative could be to implement std::stacktrace
on top of DbgHelp.dll
, which can look up only file name, if full path lookup failed. But DbgHelp.dll
is not thread safe is more thread-unsafe than DbgEng.dll
in a sense it has this unsafety warning on every function.
If you're doing post-mortem debugging, consider using dumps instead of text stack traces.
I've reported this as one of DevCom-10692305 issues.
I appreciate it.
On my rig with VS 17.10.1 installed, I get everything I could ask for in stack traces, even in release builds. If I copy my output binary folder to a customer PC and run my program there, it ignores the PDB next to my executable.
I've tried this on a Win10 and a Win11 PC and they behave the same. I reluctantly installed Debugging Tools for Windows on one of them, but it didn't help. How can I get useful info there?
Dev rig:
Customer: