Subject: [Boost-bugs] [Boost C++ Libraries] #13529: Symbols file for stacktrace is not loaded after deployment in Windows
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-04-19 06:23:30
#13529: Symbols file for stacktrace is not loaded after deployment in Windows
------------------------------+---------------------
Reporter: slawekwin@⦠| Owner: (none)
Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
Version: Boost 1.66.0 | Severity: Problem
Keywords: stacktrace msvc |
------------------------------+---------------------
When testing simplest program using {{{boost::stacktrace}}} built with
MSVC (toolset 14.1) it works perfectly on the machine it was built on, but
when deployed to a different system function names (and source files with
line numbers) are not resolved.
{{{
#include "boost/stacktrace.hpp"
int main()
{
boost::stacktrace::stacktrace stacktrace;
std::cout <<
boost::stacktrace::detail::to_string(stacktrace.as_vector().data(),
stacktrace.size())
<< std::endl;
return 0;
}
}}}
I have debugged this and it seems that the reason is that
{{{IDebugSymbols}}} does not load symbol file located in the directory of
the executable, but only the one saved in Portable Executable header (it
worked when I copied the .pdb file into the same path as it is on my
development system).
I worked around this issue by creating my own {{{IDebugSymbols}}} instance
(I copied the code creating it from frame_msvc.ipp
{{{debugging_symbols::try_init_com}}}) and modifying the last line to add
"." (current directory) to symbol search path with
{{{IDebugSymbols::AppendSymbolPath}}}:
{{{
if (S_OK == iclient->QueryInterface(__uuidof(IDebugSymbols),
idebug.to_void_ptr_ptr()))
idebug->AppendSymbolPath(".");
}}}
This needs to be done only once during the process lifetime - it appears
that the symbols paths string (or the symbols themselves) is cached, but I
could not find documentation confirming it. Alternatively, the existence
of "." part in the path could be checked with
{{{IDebugSymbols::GetSymbolPath}}} during every
{{{debugging_symbols::try_init_com}}} call.
I also tested that {{{IDebugSymbols::AppendSymbolPath}}} checks current
paths string and does not append duplicates (again could not find
documentation to back this up) so it might be enough to always just try to
append the "." during object initialization.
PS there is no stacktrace option in the "Component" combobox in this form.
-- Ticket URL: <https://svn.boost.org/trac10/ticket/13529> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2018-04-19 06:29:27 UTC