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.
Please could you try putting this in flang/runtime/CMakeLists.txt
flang/include/flang/Runtime/stop.h
Outdated
| // 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.
@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).
tblah
left a comment
There was a problem hiding this comment.
Thanks for the updates. Do you still need help to merge?
jeanPerier
left a comment
There was a problem hiding this comment.
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.
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.
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. |
|
It looks like the runtime should link against libexecinfo on *BSD's. Backtrace_LIBRARY is filed in. I am not sure of how to go about linking with the runtime in runtime/CMakeLists.txt |
|
Hi @brad0, thanks for looking into this. I don't have a BSD machine to test but I would guess something like the following would work in You can find CMake's documentation here (e.g. for |
|
@tblah Ok, let me play around with that and see what I can come up with. Thanks. |
Fixed build failures in old PRs due to missing files