This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [test/Register] Use initial state for write tests
ClosedPublic

Authored by mgorny on Oct 25 2020, 12:19 AM.

Details

Summary

Reset registers to their 'initial' state instead of a semi-random
pattern in write tests. While the latter might have been helpful
while debugging failures (i.e. to distinguish unmodified registers
from mistakenly written zeroes), the former makes it possible to test
whether xstate_bv field is written correctly when using XSAVE.

With this change, the four relevant tests start failing on NetBSD
without D90105.

Diff Detail

Event Timeline

mgorny requested review of this revision.Oct 25 2020, 12:19 AM
mgorny created this revision.
labath accepted this revision.Oct 26 2020, 3:12 AM

I am somewhat surprised that this is sufficient. IIRC (from the time when I was fixing the same bug on linux) linux will set this bit on ANY modification of these registers, regardless of the value. OTOH, guaranteeing that the process does not touch these registers at all would be pretty tricky, so I guess this is better than nothing.

This revision is now accepted and ready to land.Oct 26 2020, 3:12 AM

Well, NetBSD passes whatever value is in the XSAVE Area, and (according to the Intel manual) XSAVE indicates whether the values match the defaults.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2020, 3:56 AM

Well, NetBSD passes whatever value is in the XSAVE Area, and (according to the Intel manual) XSAVE indicates whether the values match the defaults.

It seems I was wrong. Disabling the relevant linux code makes your new tests pass. Thanks for figuring how how to test these.

I've discovered this by accident when I was figuring why fp-write tests started failing.