Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Consider Printing the Stack Trace Upon Failure #608

Open
@kuzminrobin

Description

@kuzminrobin

Request bettinaheim:
The thrown std::runtime_error that is used everywhere throughout the QIR runtime results in a somewhat uninformative pop up window that merely states "Debug Error ... abort() has been called" without showing the string that has been passed to runtime_error, or any kind of stack trace. Catching the exception and manually logging exception.what() to std::out allows to show the failure message, but is not currently done at the top level of our programs. It would also be good to have more of a stack trace to facilitate identifying the issue.

Additional infos from kuzminrobin:
Printing the stack trace is a feature that has been discussed for a number of years in C++ community. If it is added to the language then not earlier than in C++20 (not yet fully implemented by any compiler). Years ago I implemented that feature one time for Linux, using the Linux-specific calls. I can try to get that implemented again, and for Windows too (I'm sure WinSDK provides that feature), if needed.
As for the pop-up window on Windows, if you have MS VC++ installed, then the pop-up typically has an extra button to debug the crashed executable. Upon pressing that button the exe is loaded to the debugger of Visual Studio where you can open the call stack window and see the offending stack trace (at least the frames in C/C++, but not the ones in LLVM IR), you should also be able to see the exception message, local variables of different stack frames, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions