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

Conversation

@mikem8361
Copy link

Removed the old dwarf unwind info decoding and use libunwind for both dwarf and arm exidx.

Simplifies the out of proc unwind code by using the libunwind coreclr has directly to find and decode the unwind info.

@mikem8361 mikem8361 added this to the 3.0 milestone Aug 8, 2019
@mikem8361 mikem8361 requested a review from janvorli August 8, 2019 17:15
@mikem8361 mikem8361 self-assigned this Aug 8, 2019
@mikem8361 mikem8361 requested a review from jkotas August 8, 2019 17:16
Removed the old dwarf unwind info decoding and use libunwind
for both dwarf and arm exidx.
@mikem8361
Copy link
Author

@janvorli/@jkotas do you think these changes are too risky to get into 3.0 (Preview 9)?

@jkotas
Copy link
Member

jkotas commented Aug 8, 2019

@jkotas do you think these changes are too risky to get into 3.0 (Preview 9)?

How confident we are in the testing we have for this? If we have good test coverage for this and this change is required to make something important work that meets the bar; I think it would be ok to take for 3.0.

@mikem8361
Copy link
Author

I've done extensive manually testing using "createdump" which enumerates all the thread's stacks. I added some temp code to compare/assert the new code with the old code results on amd64/arm64. On all three architectures, I manually verified that createdump was correctly enumerating all the thread's stack frames by comparing the debug logging with a native debugger backtrace under lldb/gdb on the core dump generated.

I also verified that the DAC's usage of this PAL unwind function (via SOS's clrstack cmd) works to unwind the special uncached method helper frame (the main reason for this change).

There are no automated tests.

@tommcdon tommcdon requested a review from sdmaclea August 8, 2019 22:48
#include "_OOP_internal.h"

int
_OOP_find_proc_info (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like your own function. Does it come from libunwind? Is it a specific version other than libunwind 1.3? Otherwise, if it's yours, is the header necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas should I replace the license at the beginning of these two new files (OOP*.c) that I wrote with the MIT one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

I have not realized that you wrote this code. I assumed that you have just copied this file over from libunwind..when I saw the copyright.

@mikem8361 mikem8361 merged commit e8f08ff into dotnet:master Aug 9, 2019
@mikem8361 mikem8361 deleted the arm32unwind branch August 9, 2019 17:24
@omajid
Copy link
Member

omajid commented Sep 22, 2020

Hey folks, is there still a plan to merge this into libunwind itself?

Unfortunately, this change means that support for using the system-wide version of libunwind is broken since the system-wide version of libunwind wont have your custom function.

@sdmaclea
Copy link

Hey folks, is there still a plan to merge this into libunwind itself?

It is still desirable long term. @mikem8361 added a work around for x64 in .NET 5 which made this lower priority. It currently is on my backlog. The libunwind/libunwind#187 PR was temporarily closed because I didn't have time to address the comments (add it to the build system and add tests...). I will probably get to it in the next 6 months, but not much sooner.

@omajid
Copy link
Member

omajid commented Sep 22, 2020

Thanks for the update! Please let me know if there's anything I can do to help move this along. Using system libraries is generally a use case that I (and Red Hat) care about quite a bit.

@sdmaclea
Copy link

I didn't realize this affected 3.1 too. Perhaps we can consider backporting @mikem8361 change dotnet/runtime#39417 to 3.1.

As for this task, my issue was that I didn't understand the code well enough to draft reasonable tests. I don't think it would take terribly long, so if this is important I can increase priority. Part of the reason the priority dropped is this wouldn't be in existing libunwind release versions, so we didn't think it would fix source build issues for a while. Until distros picked up libunwind next (1.7?)

@omajid
Copy link
Member

omajid commented Sep 22, 2020

I am still not sure it affects 3.1. For 3.1, I only saw issues unwinding on aarch64, which I think I can live with. For x86_64, using the system libunwind works for me on Fedora and RHEL 7.

For 5.0, it seems like using the system libunwind broke everything, at least according to https://github.com/dotnet/source-build/blob/52e0279afa047ec925c2228c9d728eef1f6d0373/repos/runtime.common.props#L24

@sdmaclea
Copy link

You should be able to revert that comment and reenable CLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE. We believe that is fixed. If not please open an issue. We will fix for 5.0 source-build.

omajid added a commit to omajid/dotnet-source-build that referenced this pull request Sep 22, 2020
Recent discussion on dotnet/coreclr#26082
suggests this should be working.
@omajid
Copy link
Member

omajid commented Sep 23, 2020

Thanks @sdmaclea, that seems to work!

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
ARM32 out of proc unwind support

Removed the old dwarf unwind info decoding and use libunwind
for both dwarf and arm exidx.


Commit migrated from dotnet/coreclr@e8f08ff
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants