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

Backtrace support for flang #118179

Merged
merged 20 commits into from
Dec 10, 2024
Merged

Backtrace support for flang #118179

merged 20 commits into from
Dec 10, 2024

Conversation

dty2
Copy link
Contributor

@dty2 dty2 commented Nov 30, 2024

Fixed build failures in old PRs due to missing files

Copy link

github-actions bot commented Nov 30, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Comment on lines 93 to 97
# function checks
find_package(Backtrace)
set(HAVE_BACKTRACE ${Backtrace_FOUND})
set(BACKTRACE_HEADER ${Backtrace_HEADER})

Copy link
Contributor

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

@tblah tblah requested a review from jeanPerier December 2, 2024 10:21
@@ -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);
Copy link
Contributor

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

Suggested change
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).

Copy link
Contributor

@tblah tblah left a 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?

Copy link
Contributor

@jeanPerier jeanPerier left a 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();
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@dty2
Copy link
Contributor Author

dty2 commented Dec 9, 2024

Thanks for the updates. Do you still need help to merge?

Thank you for your corrections to my questions. I am very grateful. If you think there is no problem, you can merge it.

@tblah tblah merged commit e8baa79 into llvm:main Dec 10, 2024
9 checks passed
broxigarchen pushed a commit to broxigarchen/llvm-project that referenced this pull request Dec 10, 2024
Fixed build failures in old PRs due to missing files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants