From 14735cab655441ba45c4b88ad82f11267e5fe916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 28 Jul 2021 20:07:03 +0200 Subject: [lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compat Modify OpenOptions enum to open the future path into synchronizing vFile:open bits with GDB. Currently, LLDB and GDB use different flag models effectively making it impossible to match bits. Notably, LLDB uses two bits to indicate read and write status, and uses union of both for read/write. GDB uses a value of 0 for read-only, 1 for write-only and 2 for read/write. In order to future-proof the code for the GDB variant: 1. Add a distinct eOpenOptionReadWrite constant to be used instead of (eOpenOptionRead | eOpenOptionWrite) when R/W access is required. 2. Rename eOpenOptionRead and eOpenOptionWrite to eOpenOptionReadOnly and eOpenOptionWriteOnly respectively, to make it clear that they do not mean to be combined and require update to all call sites. 3. Use the intersection of all three flags when matching against the three possible values. This commit does not change the actual bits used by LLDB. Differential Revision: https://reviews.llvm.org/D106984 --- lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp') diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp index 75a1f5e..9bfbb37 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp @@ -583,7 +583,7 @@ TEST_F(PythonDataObjectsTest, TestPythonCallableInvoke) { TEST_F(PythonDataObjectsTest, TestPythonFile) { auto file = FileSystem::Instance().Open(FileSpec(FileSystem::DEV_NULL), - File::eOpenOptionRead); + File::eOpenOptionReadOnly); ASSERT_THAT_EXPECTED(file, llvm::Succeeded()); auto py_file = PythonFile::FromFile(*file.get(), "r"); ASSERT_THAT_EXPECTED(py_file, llvm::Succeeded()); @@ -858,4 +858,4 @@ g = foobar() ASSERT_THAT_EXPECTED(r, llvm::Succeeded()); auto g = As(globals.GetItem("g")); ASSERT_THAT_EXPECTED(g, llvm::HasValue("foobarbaz")); -} \ No newline at end of file +} -- cgit v1.1