This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [test] Add a test for watchpoint set error handling on NetBSD
AbandonedPublic

Authored by mgorny on Nov 10 2019, 2:48 AM.

Details

Summary

Add a test that verifies that when the user does not have permissions
to set watchpoints on NetBSD, the 'watchpoint set' errors out gracefully
and thread monitoring does not crash on being unable to copy watchpoints
to new threads.

Diff Detail

Event Timeline

mgorny created this revision.Nov 10 2019, 2:48 AM
labath accepted this revision.Nov 11 2019, 1:16 AM
labath added inline comments.
lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
1–23

Maybe simplify this and remove the threads and stuff?

lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test
5

You should use %clang_host now. Are you sure that this even works on current master?

This revision is now accepted and ready to land.Nov 11 2019, 1:16 AM
mgorny marked 2 inline comments as done.Nov 11 2019, 1:22 AM
mgorny added inline comments.
lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
1–23

Threads are intentional since new thread handler copies dbregs per the other patch. This makes sure that new thread handler will not crash when it is unable to set dbregs.

lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test
5

I have to admit that I'm at ~Oct 31 in my checkout. I've tried using %clang_host but it failed with fg saying that there is no job control.

labath added inline comments.Nov 11 2019, 1:32 AM
lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
1–23

Hang on, isn't this test about what happens when you *cannot* set watchpoints? In that case there should be nothing to copy the dbregs from, right?

lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test
5

%clang_host was added *on* Oct 31, so maybe you need to sync a bit further... :)

labath added inline comments.Nov 11 2019, 1:39 AM
lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
1–23

Hmm... or is it that you're testing that the act of trying to copy this "nothing" works? In that case, this might be fine, but it'd probably be worth mentioning this in the test case.

mgorny marked 2 inline comments as done.Nov 11 2019, 1:45 AM
mgorny added inline comments.
lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
1–23

Actually, since the whole dbreg support is rather stateless at the moment, we just unconditionally copy dbregs. I suppose this needs to be fixed, and now I see that my other patch misses error handling as well. However, the main point for this test is to prevent regressions, and this is a potential programmer's mistake.

lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test
5

Ok, I'll try.