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

Use _Unwind_GetRegionStart() if _Unwind_GetIP() is not available #54

Closed
wants to merge 1 commit into from

Conversation

krlmlr
Copy link

@krlmlr krlmlr commented Sep 9, 2020

Follow-up to #43. This gives correct function name, but still incorrect file+line information (and thus failing tests) on mingw64.

@ianlancetaylor
Copy link
Owner

Thanks, but I would rather not use a workaround like this. As you say, it gives incorrect results, and incorrect results can be much more confusing than missing results.

More generally, being able to backtrace with the correct PC value is essential for C++ exceptions. Being unable to get the correct PC makes some kinds of C++ programming essentially impossible. So this seems like a fatal bug that has to be fixed for the system to be at all usable. Since it has to be fixed, there isn't much point to working around the case where it is not fixed.

@krlmlr
Copy link
Author

krlmlr commented Sep 16, 2020

Thanks for the heads up. I agree with the sentiment.

For mingw64, only the _Unwind_Backtrace() code path is broken. Exception handling seems to work correctly.

The results this PR gives are good enough to get practical value out of the backtrace, only the file+line information is off. This may be sufficient for some use cases.

@ianlancetaylor
Copy link
Owner

Thanks for the info. I can only repeat that returning the file/line information gives incorrect results, and in my opinion for something like libbacktrace incorrect results are generally worse than no results.

A change like this would be fine with me if we somehow arranged to only return the function name, not the file/line information.

krlmlr added a commit to krlmlr/libbacktrace that referenced this pull request Jan 31, 2023
krlmlr added a commit to krlmlr/libbacktrace that referenced this pull request Jan 31, 2023
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.

2 participants