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
There's a caveat. Documentation of StackWalk64 and friends contains the following:
All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.
I'm not sure how to address this properly in <stacktrace>
I've updated this issue to mention the patch paper P2301R1 "Add A pmr Alias For std::stacktrace" which was just accepted, with no changes to the feature-test macro.
I'm wondering why doesn't stacktrace use source_location, and why doesn't it provide column
This is due to platform divergence. As it is stated in P0881R7: "Unfortunately this is a necessarity on some platforms, where getting source line requires allocating or where source file name returned into a storage provided by user."
"Unfortunately this is a necessarity on some platforms, where getting source line requires allocating or where source file name returned into a storage provided by user."
I see. Although this could have been addressed by making the std::string internal to stacktrace_entry, it would have required extra member to hold the buffer.
Why no source_column anyway? At least in Windows it is available for free.
Why no source_column anyway? At least in Windows it is available for free.
Most popular solutions for non-Windows platforms do not provide a source_column(). At the moment std::stacktrace is a minimal subset of abilities of all platforms, so the column is missing. This could be changed later, the addition seems quite simple for C++ standardization.
It may. It is a question of "quality of implementation" and user needs. Some of the users would love such a feature. For others opening a socket in their application may be a showstopper.
IMO the feature is a very good one if there is a switch to disable it.
I see, I also think so, the question is the default then. I was thinking a good default would be to use module names, export names, names from .pdbs, but don't go to http/https symbols servers for them.
Also I would like the configuration to be runtime, using a global or static function member setter for a thread-local variable (I wouldn't like passing extra parameters to getters, or, especially, to << operators)
How would std::stacktrace retrieve symbols from PDB files?
And if the symbols it retrieves are C++ mangled names, how would it demangle those names?
Would this functionality rely on the msdia library for PDB reading?
How would std::stacktrace retrieve symbols from PDB files? And if the symbols it retrieves are C++ mangled names, how would it demangle those names? Would this functionality rely on the msdia library for PDB reading?
Activity
[-]P0881R7 <stacktrace>[/-][+]P0881R7 `<stacktrace>`[/+]miscco commentedon Jun 30, 2021
Does this require compiler support and should it be marked as blocked until compiler support is ready?
leha-bot commentedon Jul 7, 2021
As I understood, no, we could just links to imghelp.dll and use its StackWalk() API.
I have a very draft WIP implementation for it :)
AlexGuteniev commentedon Jul 20, 2021
There's an alternative --
CaptureStackBackTrace. It is faster thanStackWalk, but it is not a part of complete API family.There's also
IDiaStackWalker::getEnumFrames2, but it is the same asStackWalk(apparently one is a wrapper on another).AlexGuteniev commentedon Jul 20, 2021
There's a caveat. Documentation of
StackWalk64and friends contains the following:I'm not sure how to address this properly in
<stacktrace>leha-bot commentedon Jul 20, 2021
Thanks, Alex, completely forgot about this kernrl32 function, would try it later.
AlexGuteniev commentedon Jul 23, 2021
Alex (@leha-bot) , are you planning to submit a PR ?
I'm interested in this feature.
leha-bot commentedon Jul 24, 2021
Yes, as a proposal co-author :)
AlexGuteniev commentedon Jul 24, 2021
Wow)
SuperWig commentedon Jul 25, 2021
Would it make sense to mark this issue as work in progress in that case?
StephanTLavavej commentedon Aug 8, 2021
Sure, I've labeled this as "work in progress" and moved it to the Investigating column.
(Guess who's catching up on half-month-old notifications?)
StephanTLavavej commentedon Oct 5, 2021
I've updated this issue to mention the patch paper P2301R1 "Add A
pmrAlias Forstd::stacktrace" which was just accepted, with no changes to the feature-test macro.5 remaining items
AlexGuteniev commentedon Feb 2, 2022
stacktracewould also benefit from usingconst char*. And from addingcolumnKindDragon commentedon Feb 2, 2022
Hi, Antony Polukhin (@apolukhin). Do you know why?
apolukhin commentedon Feb 2, 2022
This is due to platform divergence. As it is stated in P0881R7: "Unfortunately this is a necessarity on some platforms, where getting source line requires allocating or where source file name returned into a storage provided by user."
AlexGuteniev commentedon Feb 2, 2022
I see. Although this could have been addressed by making the
std::stringinternal tostacktrace_entry, it would have required extra member to hold the buffer.Why no
source_columnanyway? At least in Windows it is available for free.apolukhin commentedon Feb 2, 2022
Most popular solutions for non-Windows platforms do not provide a
source_column(). At the momentstd::stacktraceis a minimal subset of abilities of all platforms, so the column is missing. This could be changed later, the addition seems quite simple for C++ standardization.AlexGuteniev commentedon Feb 7, 2022
Antony Polukhin (@apolukhin) , should
std::stacktraceload symbols from the Internet?apolukhin commentedon Feb 9, 2022
It may. It is a question of "quality of implementation" and user needs. Some of the users would love such a feature. For others opening a socket in their application may be a showstopper.
IMO the feature is a very good one if there is a switch to disable it.
AlexGuteniev commentedon Feb 9, 2022
I see, I also think so, the question is the default then. I was thinking a good default would be to use module names, export names, names from .pdbs, but don't go to http/https symbols servers for them.
Also I would like the configuration to be runtime, using a global or static function member setter for a thread-local variable (I wouldn't like passing extra parameters to getters, or, especially, to
<<operators)jonwil commentedon Feb 9, 2022
How would std::stacktrace retrieve symbols from PDB files?
And if the symbols it retrieves are C++ mangled names, how would it demangle those names?
Would this functionality rely on the msdia library for PDB reading?
AlexGuteniev commentedon Feb 9, 2022
An open question I guess.
My PR currently uses DbgEng, but lists main alternatives and their drawback as the first question to decide upon.
AlexGuteniev commentedon Jun 10, 2022
See #2779