You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it seems like only way to get call stack (backtrace or stack trace) is to set FLAGS_log_backtrace_at variable with the desired filename and line number. However, this is a global variable and when used in multithreaded environment, it leads to data corruption issue, hence process crash. One way to prevent it would be to use locks and allow only one thread to dump the call stack.
I'm wondering whether it's possible to expose DumpStackTraceToString utility to application or user. Would that make it lock-free to get the stack trace and make it performant? or, is there any other alternative to achieve the same i.e., get call stack in multithreaded application where more than one thread can simultaneously invoke logging with backtrace set.
The text was updated successfully, but these errors were encountered:
Since it's a function and you can declear it any where, e.g. in your own header and just use it. Don't forget to link glog library.
In my code, I declare it in my header file like this:
namespace google {
namespace glog_internal_namespace_ {
void DumpStackTraceToString(std::string *stacktrace);
}
} // namespace google
Currently, it seems like only way to get call stack (backtrace or stack trace) is to set FLAGS_log_backtrace_at variable with the desired filename and line number. However, this is a global variable and when used in multithreaded environment, it leads to data corruption issue, hence process crash. One way to prevent it would be to use locks and allow only one thread to dump the call stack.
I'm wondering whether it's possible to expose DumpStackTraceToString utility to application or user. Would that make it lock-free to get the stack trace and make it performant? or, is there any other alternative to achieve the same i.e., get call stack in multithreaded application where more than one thread can simultaneously invoke logging with backtrace set.
The text was updated successfully, but these errors were encountered: