In case the number of characters for a string representation of a frame exceeds 255 characters, the string returned contains the string termination character '\0' which makes the return string useless/errorful.
Simple call to:
std::string backtrace = boost::stacktrace::to_string (boost::stacktrace::stacktrace ());
The root cause is in boost\stacktrace\detail\frame_msvc.ipp method
In case the original buffer size for name (=256) is too small idebug_->GetNameByOffset() returns false, which calls the method again in L213 given the adjusted size. GetNameByOffset also copies the '\0' termination character into the std::string, which is the problem.
A simple bug fix would be to remove to '\0' termination character from the result after the call successfully completed by adding:
if(res) {
//The copied string is \0 terminated, we have to remove the \0.
result.resize(size-1);
}
I'm using boost version 1_70 on windows.
In case the number of characters for a string representation of a frame exceeds 255 characters, the string returned contains the string termination character '\0' which makes the return string useless/errorful.
Simple call to:
std::string backtrace = boost::stacktrace::to_string (boost::stacktrace::stacktrace ());
The root cause is in boost\stacktrace\detail\frame_msvc.ipp methodStarting with Line 200.
In case the original buffer size for
name
(=256) is too small idebug_->GetNameByOffset() returns false, which calls the method again in L213 given the adjusted size. GetNameByOffset also copies the '\0' termination character into the std::string, which is the problem.A simple bug fix would be to remove to '\0' termination character from the result after the call successfully completed by adding: