This is an archive of the discontinued LLVM Phabricator instance.

Merge Linux and FreeBSD arm64 register contexts
ClosedPublic

Authored by labath on Oct 25 2016, 9:20 AM.

Details

Summary

This is a test-the-water change about possibilities of reducing duplication in
the register context definitions.

I've named the new class RegisterInfoPOSIX, as RegisterContextPOSIX was already
taken :(. The two files were identical except for a fix by Tamas in D12636,
which was applied to the Linux version only, which fixed a discrepancy between
the definitions of fpsr and fpcr on one hand, and all other floating point
register definitions on the other.

Linux test suite still passes after this change. For freebsd, make the floating
point register behavior consistent, but I don't know whether it will be
consistently fixed, or consistently broken. By eyeballing the code, I have a
feeling that a similar fix to D12636 will be required in
RegisterContextPOSIXProcessMonitor_arm64::ReadRegister, but I can't be sure as I
have no way to test it (the assert in that function should fire upon accessing
the registers if it is wrong though).

Diff Detail

Repository
rL LLVM

Event Timeline

labath updated this revision to Diff 75717.Oct 25 2016, 9:20 AM
labath retitled this revision from to Merge Linux and FreeBSD arm64 register contexts.
labath updated this object.
labath added reviewers: emaste, clayborg.
labath added subscribers: lldb-commits, dmikulin.
labath updated this revision to Diff 75718.Oct 25 2016, 9:22 AM

clang-format the patch

emaste added a subscriber: andrew.Oct 25 2016, 12:03 PM

Ed, what do you think about this one? Is there anyone with a FreeBSD arm64 setup that could verify this?

clayborg accepted this revision.Nov 15 2016, 8:59 AM
clayborg edited edge metadata.

Looks good as long as all register contexts are the same between these targets.

This revision is now accepted and ready to land.Nov 15 2016, 8:59 AM
sas accepted this revision.Nov 15 2016, 10:50 AM
sas added a reviewer: sas.
sas added a subscriber: sas.

Cool stuff.

Are you planning on doing a similar change for other architectures?

emaste edited edge metadata.Nov 15 2016, 3:01 PM

Ed, what do you think about this one? Is there anyone with a FreeBSD arm64 setup that could verify this?

We have an arm64 reference machine in the FreeBSD cluster and I will test after I return from travel later this week, although perhaps @andrew can try it before then.

Yes, I'd like to do similar refactorings to other contexts as well.

I'll wait until next week so Ed can give this a shot -- I am busy with other stuff these days anyway.

Ed, if I may suggest, while you are playing with the arm machine, could you grab us a core file or two? It'd be great to be able to do a basic sanity check on these things without physical access.

Ed, have you had a chance to try this out? I'd like to put this in soon.

The tests are not in great shape on FreeBSD/arm64 today, but look roughly equivalent with and without this patch.

At rL287887:

===================
Test Result Summary
===================
Test Methods:       1148
Reruns:               16
Success:             302
Expected Failure:     35
Failure:              80
Error:                26
Exceptional Exit:     98
Unexpected Success:    1
Skip:                600
Timeout:               6
Expected Timeout:      0

With the patch applied:

===================
Test Result Summary
===================
Test Methods:       1147
Reruns:               16
Success:             299
Expected Failure:     35
Failure:              80
Error:                26
Exceptional Exit:    100
Unexpected Success:    1
Skip:                600
Timeout:               6
Expected Timeout:      0

Ed, if I may suggest, while you are playing with the arm machine, could you grab us a core file or two? It'd be great to be able to do a basic sanity check on these things without physical access.

I used make-core.sh to create https://people.freebsd.org/~emaste/lldb/freebsd-arm64-core.txz

Thank you for trying this out, and getting the core file. Unfortunately, the core is somewhat bigger then I had hoped for (it contains a very large data segment). I'll try to play around with this on a freebsd vm to see if I can reduce that somehow (maybe another ulimit setting will be enough). I'll keep the file around locally for future reference though.

This revision was automatically updated to reflect the committed changes.
lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_arm64.h