-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Backtrace support for flang #118179
Backtrace support for flang #118179
Conversation
…delete std::exit in PrintBacktrace
✅ With the latest revision this PR passed the C/C++ code formatter. |
flang/CMakeLists.txt
Outdated
# function checks | ||
find_package(Backtrace) | ||
set(HAVE_BACKTRACE ${Backtrace_FOUND}) | ||
set(BACKTRACE_HEADER ${Backtrace_HEADER}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you try putting this in flang/runtime/CMakeLists.txt
flang/include/flang/Runtime/stop.h
Outdated
@@ -29,6 +29,7 @@ NORETURN void RTNAME(ProgramEndStatement)(NO_ARGUMENTS); | |||
// Extensions | |||
NORETURN void RTNAME(Exit)(int status DEFAULT_VALUE(EXIT_SUCCESS)); | |||
NORETURN void RTNAME(Abort)(NO_ARGUMENTS); | |||
void RTNAME(Backtrace)(NO_ARGUMENTS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeanPerier pointed out we don't need any of the changes in flang/lib
in this case: pointing you at fdate
void RTNAME(Backtrace)(NO_ARGUMENTS); | |
void FORTRAN_PROCEDURE_NAME(Backtrace)(NO_ARGUMENTS); |
With this you shouldn't need any of the frontend changes (flang/lib
, and associated header changes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. Do you still need help to merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit on the ABORT change, LGTM otherwise, thanks for the update!
[[noreturn]] void RTNAME(Abort)() { | ||
// TODO: Add backtrace call, unless with `-fno-backtrace`. | ||
PrintBacktrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make that one also conditional on #ifdef HAVE_BACKTRACE
I do not think ABORT should crash with "Handle the case when a backtrace is not available\n" on platforms that have no backtrace.
It could lead people to believe that the abort is related to BACKTRACE while it is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, thanks for pointing this out.
Thank you for your corrections to my questions. I am very grateful. If you think there is no problem, you can merge it. |
Fixed build failures in old PRs due to missing files
Fixed build failures in old PRs due to missing files