This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [test] Add a minimal test for x86 dbreg reading
ClosedPublic

Authored by mgorny on Nov 11 2020, 7:38 AM.

Details

Summary

Add a test verifying that after the 'watchpoint' command, new values
of x86 debug registers can be read back correctly. The primary purpose
of this test is to catch broken DRn reading and help debugging it.

Diff Detail

Event Timeline

mgorny created this revision.Nov 11 2020, 7:38 AM
mgorny requested review of this revision.Nov 11 2020, 7:38 AM

I have a feeling we discussed this already, but I don't remember what was the conclusion.

Was exposing debug registers to the user a conscious choice? Other OSes don't actually do that. Neither does gdb, afaict...

In think that allowing the user to see dr contents is a good idea -- allows him to check what the debugger has done. I'm not convinced about the writing aspect though -- seems like an easy way to confuse the debugger and make it crash...

lldb/test/Shell/Register/x86-db-read.test
2

Who sets can-set-dbregs ?

I have a feeling we discussed this already, but I don't remember what was the conclusion.

Was exposing debug registers to the user a conscious choice? Other OSes don't actually do that. Neither does gdb, afaict...

In think that allowing the user to see dr contents is a good idea -- allows him to check what the debugger has done. I'm not convinced about the writing aspect though -- seems like an easy way to confuse the debugger and make it crash...

I agree with this. Hence, I've covered only the reading part. I don't have a strong opinion whether we should ban writes.

lldb/test/Shell/Register/x86-db-read.test
2
lldb/test/Shell/Register/x86-db-read.test
2

The feature name is dbregs-set, is it not ?

mgorny updated this revision to Diff 304751.Nov 12 2020, 1:48 AM

Corrected REQUIRES.

mgorny added inline comments.Nov 12 2020, 3:39 AM
lldb/test/Shell/Register/x86-db-read.test
2

Indeed it is. Silly me.

mgorny updated this revision to Diff 304772.Nov 12 2020, 3:40 AM

Restrict the test to FreeBSD only.

labath accepted this revision.Nov 12 2020, 4:55 AM
This revision is now accepted and ready to land.Nov 12 2020, 4:55 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 12 2020, 5:09 AM