Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msvc-based stacktrace should also allow to determine the module image path #129

Open
Dani-Hub opened this issue Oct 20, 2022 · 1 comment

Comments

@Dani-Hub
Copy link

Dani-Hub commented Oct 20, 2022

The current msvc-based stacktrace only determines the module name - not its complete path - contrary to the full featured unixoid implementation. It turns out that this is rather simple to realize and valuable when attempting to analyze application problems by inspecting the referred to image paths. It means that you first calls IDebugSymbols::GetModuleByOffset followed by IDebugSymbols::GetModuleNames using the ImageNameBuffer, ImageNameBufferSize, and ImageNameSize parameters. I'm using this extended information in my own stacktrace implementation.

There is another way of improving the quality of msvc stacktraces related to the problem described capturestackbacktrace-randomly-fails-after-initial. I'm aware that the current stacktrace implementation has eliminated any explicit call of CoInitializeEx, but that does not prevent the user to make such a call. Instead of rewriting RtlCaptureStackBackTrace as suggested in this article, a very simple workaround seems to help here. Before calling RtlCaptureStackBackTrace with a static buffer (128), just call RtlCaptureStackBackTrace with the FramesToCapture equal to just 1 ignoring this stub call, which prevents the potential empty stacktrace situation for the second call.

Would there be interest for a corresponding PULL request?

@apolukhin
Copy link
Member

Yes. Let's take a look at the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants