Skip to content

Conversation

@ashgti
Copy link
Contributor

@ashgti ashgti commented Nov 8, 2025

This refactors the IO handling of lldb-dap and its SBDebugger. This adjusts the SBDebugger instance to have a pty associated with in/out/err. Using a pty allows us to handle commands with raw input modes, such as script or breakpoint command add.

Additionally, to better handle output produced by the debugger and evaluate command I added a print helper. This new print helper will inspect the SBCommandReturnObject and store any associated variables in the variable store. This lets users more easily inspect variables directly in the Debug Console in VSCode.

See the associated screenshot for more info comparing v <var>, p <var> and e <var> as an example.
Screenshot 2025-11-07 at 4 57 07 PM

@ashgti ashgti force-pushed the lldb-dap-io-handlers branch from 4930c76 to 671b912 Compare November 21, 2025 02:34
@github-actions
Copy link

🐧 Linux x64 Test Results

The build failed before running any tests. Click on a failure below to see the details.

tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/DAPErrorTest.cpp.o
FAILED: tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/DAPErrorTest.cpp.o
sccache /opt/llvm/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/unittests/DAP -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include -I/usr/include/python3.12 -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../clang/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/../clang/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/source -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests -I/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/tools/lldb-dap -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/DAPErrorTest.cpp.o -MF tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/DAPErrorTest.cpp.o.d -o tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/DAPErrorTest.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp:10:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock.h:56:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-actions.h:145:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h:50:
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1379:11: error: invalid operands to binary expression ('const std::basic_string<char>' and 'const std::nullopt_t')
1379 |   if (lhs == rhs) {
|       ~~~ ^  ~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1398:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<std::basic_string<char>, std::nullopt_t>' requested here
1398 |     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp:24:3: note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<std::basic_string<char>, std::nullopt_t, nullptr>' requested here
24 |   EXPECT_EQ(error.getURL(), std::nullopt);
|   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1869:54: note: expanded from macro 'EXPECT_EQ'
1869 |   EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
|                                                      ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:144:23: note: expanded from macro 'EXPECT_PRED_FORMAT2'
144 |   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
|                       ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:134:17: note: expanded from macro 'GTEST_PRED_FORMAT2_'
134 |   GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), on_failure)
|                 ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:79:52: note: expanded from macro 'GTEST_ASSERT_'
79 |   if (const ::testing::AssertionResult gtest_ar = (expression)) \
|                                                    ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/allocator.h:216:7: note: candidate function not viable: no known conversion from 'const std::basic_string<char>' to 'const allocator<char>' for 1st argument
216 |       operator==(const allocator&, const allocator&) _GLIBCXX_NOTHROW
|       ^          ~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/system_error:449:3: note: candidate function not viable: no known conversion from 'const std::basic_string<char>' to 'const error_code' for 1st argument
449 |   operator==(const error_code& __lhs, const error_code& __rhs) noexcept
|   ^          ~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/system_error:465:3: note: candidate function not viable: no known conversion from 'const std::basic_string<char>' to 'const error_code' for 1st argument
465 |   operator==(const error_code& __lhs, const error_condition& __rhs) noexcept
|   ^          ~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/system_error:480:3: note: candidate function not viable: no known conversion from 'const std::basic_string<char>' to 'const error_condition' for 1st argument
480 |   operator==(const error_condition& __lhs,
|   ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/system_error:517:3: note: candidate function not viable: no known conversion from 'const std::basic_string<char>' to 'const error_condition' for 1st argument
517 |   operator==(const error_condition& __lhs, const error_code& __rhs) noexcept
|   ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/variant:1273:18: note: candidate function not viable: no known conversion from 'const std::basic_string<char>' to 'monostate' for 1st argument
1273 |   constexpr bool operator==(monostate, monostate) noexcept { return true; }
|                  ^          ~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1371:13: note: candidate function not viable: no known conversion from 'const std::basic_string<char>' to 'faketype' for 1st argument
1371 | inline bool operator==(faketype, faketype) { return true; }
|             ^          ~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:448:5: note: candidate template ignored: could not match 'reverse_iterator' against 'std::basic_string'
448 |     operator==(const reverse_iterator<_Iterator>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:493:5: note: candidate template ignored: could not match 'reverse_iterator' against 'std::basic_string'
493 |     operator==(const reverse_iterator<_IteratorL>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1678:5: note: candidate template ignored: could not match 'move_iterator' against 'std::basic_string'
1678 |     operator==(const move_iterator<_IteratorL>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1748:5: note: candidate template ignored: could not match 'move_iterator' against 'std::basic_string'
1748 |     operator==(const move_iterator<_Iterator>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/postypes.h:192:5: note: candidate template ignored: could not match 'fpos' against 'std::basic_string'
192 |     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/new_allocator.h:215:2: note: candidate template ignored: could not match 'const __new_allocator<_Up>' against 'const std::nullopt_t'
215 |         operator==(const __new_allocator&, const __new_allocator<_Up>&)
|         ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/allocator.h:237:5: note: candidate template ignored: could not match 'allocator' against 'std::basic_string'
237 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_pair.h:812:5: note: candidate template ignored: could not match 'pair' against 'std::basic_string'
812 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/string_view:609:5: note: candidate template ignored: could not match 'basic_string_view' against 'std::basic_string'
609 |     operator==(basic_string_view<_CharT, _Traits> __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/string_view:616:5: note: candidate template ignored: could not match 'basic_string_view' against 'std::basic_string'
616 |     operator==(basic_string_view<_CharT, _Traits> __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/string_view:642:5: note: candidate template ignored: could not match 'basic_string_view<_CharT, _Traits>' against 'std::nullopt_t'
642 |     operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:3710:5: note: candidate template ignored: could not match 'const basic_string<_CharT, _Traits, _Alloc>' against 'const std::nullopt_t'
3710 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:3727:5: note: candidate template ignored: could not match 'const _CharT *' against 'std::nullopt_t'
3727 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:3774:5: note: candidate template ignored: could not match 'const _CharT *' against 'std::basic_string<char>'
3774 |     operator==(const _CharT* __lhs,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/tuple:1919:5: note: candidate template ignored: could not match 'tuple' against 'std::basic_string'
1919 |     operator==(const tuple<_TElements...>& __t,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/streambuf_iterator.h:234:5: note: candidate template ignored: could not match 'istreambuf_iterator' against 'std::basic_string'
234 |     operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/optional:1236:5: note: candidate template ignored: could not match 'optional' against 'std::basic_string'
1236 |     operator==(const optional<_Tp>& __lhs, const optional<_Up>& __rhs)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/optional:1296:5: note: candidate template ignored: could not match 'optional' against 'std::basic_string'
1296 |     operator==(const optional<_Tp>& __lhs, nullopt_t) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/optional:1307:5: note: candidate template ignored: could not match 'const optional<_Tp>' against 'const std::nullopt_t'
1307 |     operator==(nullopt_t, const optional<_Tp>& __rhs) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/optional:1364:5: note: candidate template ignored: could not match 'optional' against 'std::basic_string'
1364 |     operator==(const optional<_Tp>& __lhs, const _Up& __rhs)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/optional:1370:5: note: candidate template ignored: could not match 'const optional<_Tp>' against 'const std::nullopt_t'
1370 |     operator==(const _Up& __lhs, const optional<_Tp>& __rhs)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:737:5: note: candidate template ignored: could not match 'function' against 'std::basic_string'
737 |     operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:744:5: note: candidate template ignored: could not match 'const function<_Res (_Args...)>' against 'const std::nullopt_t'
744 |     operator==(nullptr_t, const function<_Res(_Args...)>& __f) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:2143:5: note: candidate template ignored: could not match 'unordered_map' against 'std::basic_string'
2143 |     operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unordered_map.h:2157:5: note: candidate template ignored: could not match 'unordered_multimap' against 'std::basic_string'
2157 |     operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:2040:5: note: candidate template ignored: could not match 'vector' against 'std::basic_string'
2040 |     operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/array:297:5: note: candidate template ignored: could not match 'array' against 'std::basic_string'
297 |     operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:829:5: note: candidate template ignored: could not match 'unique_ptr' against 'std::basic_string'
829 |     operator==(const unique_ptr<_Tp, _Dp>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:837:5: note: candidate template ignored: could not match 'unique_ptr' against 'std::basic_string'
837 |     operator==(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:845:5: note: candidate template ignored: could not match 'const unique_ptr<_Tp, _Dp>' against 'const std::nullopt_t'
845 |     operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1793:5: note: candidate template ignored: could not match '__shared_ptr' against 'std::basic_string'
1793 |     operator==(const __shared_ptr<_Tp1, _Lp>& __a,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1799:5: note: candidate template ignored: could not match '__shared_ptr' against 'std::basic_string'
1799 |     operator==(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1819:5: note: candidate template ignored: could not match 'const __shared_ptr<_Tp, _Lp>' against 'const std::nullopt_t'
1819 |     operator==(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:555:5: note: candidate template ignored: could not match 'shared_ptr' against 'std::basic_string'
555 |     operator==(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:561:5: note: candidate template ignored: could not match 'shared_ptr' against 'std::basic_string'
561 |     operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:582:5: note: candidate template ignored: could not match 'const shared_ptr<_Tp>' against 'const std::nullopt_t'
582 |     operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/variant:1266:3: note: candidate template ignored: could not match 'variant' against 'std::basic_string'
1266 |   _VARIANT_RELATION_FUNCTION_TEMPLATE(==, equal)
|   ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/variant:1241:20: note: expanded from macro '_VARIANT_RELATION_FUNCTION_TEMPLATE'
1241 |     constexpr bool operator __OP(const variant<_Types...>& __lhs, \
|                    ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_set.h:987:5: note: candidate template ignored: could not match 'set' against 'std::basic_string'
987 |     operator==(const set<_Key, _Compare, _Alloc>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_multiset.h:973:5: note: candidate template ignored: could not match 'multiset' against 'std::basic_string'
973 |     operator==(const multiset<_Key, _Compare, _Alloc>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_map.h:1513:5: note: candidate template ignored: could not match 'map' against 'std::basic_string'
1513 |     operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
|     ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_multimap.h:1134:5: note: candidate template ignored: could not match 'multimap' against 'std::basic_string'
1134 |     operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
|     ^
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp:10:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock.h:56:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-actions.h:145:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/internal/gmock-internal-utils.h:50:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:65:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-death-test.h:43:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-death-test-internal.h:47:
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-matchers.h:700:12: error: no matching function for call to object of type 'std::equal_to<void>'
700 |     return Op()(lhs, Unwrap(rhs_));
|            ^~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-matchers.h:336:22: note: in instantiation of function template specialization 'testing::internal::ComparisonBase<testing::internal::EqMatcher<std::basic_string<char>>, std::basic_string<char>, std::equal_to<void>>::MatchAndExplain<char>' requested here
336 |     return P::Get(m).MatchAndExplain(value, listener->stream());
|                      ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-matchers.h:374:41: note: in instantiation of function template specialization 'testing::internal::MatcherBase<char>::MatchAndExplainImpl<testing::internal::MatcherBase<char>::ValuePolicy<testing::internal::EqMatcher<std::basic_string<char>>>>' requested here
374 |     static constexpr VTable kVTable = {&MatchAndExplainImpl<P>,
|                                         ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-matchers.h:448:15: note: in instantiation of function template specialization 'testing::internal::MatcherBase<char>::GetVTable<testing::internal::MatcherBase<char>::ValuePolicy<testing::internal::EqMatcher<std::basic_string<char>>>>' requested here
448 |     vtable_ = GetVTable<Policy>();
|               ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-matchers.h:282:5: note: in instantiation of function template specialization 'testing::internal::MatcherBase<char>::Init<testing::internal::EqMatcher<std::basic_string<char>>>' requested here
282 |     Init(std::forward<M>(m));
|     ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest-matchers.h:483:20: note: in instantiation of function template specialization 'testing::internal::MatcherBase<char>::MatcherBase<testing::internal::EqMatcher<std::basic_string<char>>, void>' requested here
483 |   Matcher(M&& m) : internal::MatcherBase<T>(std::forward<M>(m)) {}  // NOLINT
|                    ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:4307:10: note: (skipping 6 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
4307 |   return Eq(value);
|          ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:355:12: note: in instantiation of function template specialization 'testing::internal::MatcherCastImpl<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>::CastImpl<false>' requested here
355 |     return CastImpl(polymorphic_matcher_or_value,
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:515:43: note: in instantiation of member function 'testing::internal::MatcherCastImpl<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>::Cast' requested here
515 |   return internal::MatcherCastImpl<T, M>::Cast(matcher);
|                                           ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:522:10: note: in instantiation of function template specialization 'testing::MatcherCast<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>' requested here
522 |   return MatcherCast<T>(polymorphic_matcher_or_value);
|          ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:1591:39: note: in instantiation of function template specialization 'testing::SafeMatcherCast<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>' requested here
1591 |     const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
|                                       ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp:35:3: note: in instantiation of function template specialization 'testing::internal::PredicateFormatterFromMatcher<testing::internal::OptionalMatcher<std::basic_string<char>>>::operator()<std::basic_string<char>>' requested here
35 |   EXPECT_THAT(error.getURL(), testing::Optional<std::string>("URL"));
|   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:5495:3: note: expanded from macro 'EXPECT_THAT'
5495 |   EXPECT_PRED_FORMAT1(              \
|   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:109:3: note: expanded from macro 'EXPECT_PRED_FORMAT1'
109 |   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
|   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:100:28: note: expanded from macro 'GTEST_PRED_FORMAT1_'
100 |   GTEST_ASSERT_(pred_format(#v1, v1), on_failure)
|                            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:79:52: note: expanded from macro 'GTEST_ASSERT_'
79 |   if (const ::testing::AssertionResult gtest_ar = (expression)) \
|                                                    ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_function.h:499:2: note: candidate template ignored: substitution failure [with _Tp = const char &, _Up = const std::basic_string<char> &]: invalid operands to binary expression ('const char' and 'const std::basic_string<char>')
499 |         operator()(_Tp&& __t, _Up&& __u) const
|         ^
500 |         noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))
501 |         -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u))
|                                            ~~
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp:10:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock.h:58:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-function-mocker.h:43:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-spec-builders.h:78:
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:3963:11: error: invalid argument type 'const std::basic_string<char>' to unary expression
3963 |       if (!optional) {
|           ^~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:3948:14: note: in instantiation of member function 'testing::internal::OptionalMatcher<std::basic_string<char>>::Impl<const std::basic_string<char> &>::MatchAndExplain' requested here
3948 |     explicit Impl(const ValueMatcher& value_matcher)
|              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:3940:34: note: in instantiation of member function 'testing::internal::OptionalMatcher<std::basic_string<char>>::Impl<const std::basic_string<char> &>::Impl' requested here
3940 |     return Matcher<Optional>(new Impl<const Optional&>(value_matcher_));
|                                  ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:373:12: note: in instantiation of function template specialization 'testing::internal::OptionalMatcher<std::basic_string<char>>::operator Matcher<const std::basic_string<char> &>' requested here
373 |     return polymorphic_matcher_or_value;
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:355:12: note: in instantiation of function template specialization 'testing::internal::MatcherCastImpl<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>::CastImpl<false>' requested here
355 |     return CastImpl(polymorphic_matcher_or_value,
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:515:43: note: in instantiation of member function 'testing::internal::MatcherCastImpl<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>::Cast' requested here
515 |   return internal::MatcherCastImpl<T, M>::Cast(matcher);
|                                           ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:522:10: note: in instantiation of function template specialization 'testing::MatcherCast<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>' requested here
522 |   return MatcherCast<T>(polymorphic_matcher_or_value);
|          ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:1591:39: note: in instantiation of function template specialization 'testing::SafeMatcherCast<const std::basic_string<char> &, testing::internal::OptionalMatcher<std::basic_string<char>>>' requested here
1591 |     const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
|                                       ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp:35:3: note: in instantiation of function template specialization 'testing::internal::PredicateFormatterFromMatcher<testing::internal::OptionalMatcher<std::basic_string<char>>>::operator()<std::basic_string<char>>' requested here
35 |   EXPECT_THAT(error.getURL(), testing::Optional<std::string>("URL"));
|   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:5495:3: note: expanded from macro 'EXPECT_THAT'
5495 |   EXPECT_PRED_FORMAT1(              \
|   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:109:3: note: expanded from macro 'EXPECT_PRED_FORMAT1'
109 |   GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
|   ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:100:28: note: expanded from macro 'GTEST_PRED_FORMAT1_'
100 |   GTEST_ASSERT_(pred_format(#v1, v1), on_failure)
|                            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include/gtest/gtest_pred_impl.h:79:52: note: expanded from macro 'GTEST_ASSERT_'
79 |   if (const ::testing::AssertionResult gtest_ar = (expression)) \
|                                                    ^
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/DAPErrorTest.cpp:10:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock.h:58:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-function-mocker.h:43:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-spec-builders.h:78:
/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include/gmock/gmock-matchers.h:3967:32: error: indirection requires pointer operand ('const std::basic_string<char>' invalid)
3967 |       const ValueType& value = *optional;
|                                ^~~~~~~~~
4 errors generated.
tools/lldb/tools/lldb-dap/CMakeFiles/lldbDAP.dir/Handler/RequestHandler.cpp.o
FAILED: tools/lldb/tools/lldb-dap/CMakeFiles/lldbDAP.dir/Handler/RequestHandler.cpp.o
sccache /opt/llvm/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/tools/lldb-dap -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include -I/usr/include/python3.12 -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../clang/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/../clang/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/lldb/tools/lldb-dap/CMakeFiles/lldbDAP.dir/Handler/RequestHandler.cpp.o -MF tools/lldb/tools/lldb-dap/CMakeFiles/lldbDAP.dir/Handler/RequestHandler.cpp.o.d -o tools/lldb/tools/lldb-dap/CMakeFiles/lldbDAP.dir/Handler/RequestHandler.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap/Handler/RequestHandler.cpp:276:16: error: format specifies type 'unsigned long long' but the argument has type 'lldb::pid_t' (aka 'unsigned long') [-Werror,-Wformat]
275 |     msg.Printf("Attached to process %llu.\r\n",
|                                     ~~~~
|                                     %lu
276 |                dap.target.GetProcess().GetProcessID());
|                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/VariablesTest.cpp.o
FAILED: tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/VariablesTest.cpp.o
sccache /opt/llvm/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/unittests/DAP -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include -I/usr/include/python3.12 -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../clang/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/../clang/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/source -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests -I/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb/tools/lldb-dap -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/VariablesTest.cpp.o -MF tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/VariablesTest.cpp.o.d -o tools/lldb/unittests/DAP/CMakeFiles/DAPTests.dir/VariablesTest.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/VariablesTest.cpp
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/VariablesTest.cpp:36:50: error: too many arguments to function call, expected single argument 'variable', have 2 arguments
36 |   const int64_t ref = vars.InsertVariable(dummy, Temporary);
|                       ~~~~~~~~~~~~~~~~~~~        ^~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap/Variables.h:46:11: note: 'InsertVariable' declared here
46 |   int64_t InsertVariable(lldb::SBValue variable);
|           ^              ~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/VariablesTest.cpp:44:50: error: too many arguments to function call, expected single argument 'variable', have 2 arguments
44 |   const int64_t ref = vars.InsertVariable(dummy, Permanent);
|                       ~~~~~~~~~~~~~~~~~~~        ^~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap/Variables.h:46:11: note: 'InsertVariable' declared here
46 |   int64_t InsertVariable(lldb::SBValue variable);
|           ^              ~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/VariablesTest.cpp:60:51: error: too many arguments to function call, expected single argument 'variable', have 2 arguments
60 |   const int64_t temp = vars.InsertVariable(dummy, Temporary);
|                        ~~~~~~~~~~~~~~~~~~~        ^~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap/Variables.h:46:11: note: 'InsertVariable' declared here
46 |   int64_t InsertVariable(lldb::SBValue variable);
|           ^              ~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/unittests/DAP/VariablesTest.cpp:61:51: error: too many arguments to function call, expected single argument 'variable', have 2 arguments
61 |   const int64_t perm = vars.InsertVariable(dummy, Permanent);
|                        ~~~~~~~~~~~~~~~~~~~        ^~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/tools/lldb-dap/Variables.h:46:11: note: 'InsertVariable' declared here
46 |   int64_t InsertVariable(lldb::SBValue variable);
|           ^              ~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

This refactors the IO handling of lldb-dap and its SBDebugger. This adjusts the SBDebugger instance to have a pty associated with in/out/err. Using a pty allows us to handle commands with raw input modes, such as `script` or `breakpoint command add`.

Additionally, to better handle output produced by the debugger and evaluate command I added a print helper. This new print helper will inspect the SBCommandReturnObject and store any associated variables in the variable store. This lets users more easily inspect variables directly in the Debug Console in VSCode.
@ashgti ashgti force-pushed the lldb-dap-io-handlers branch from 671b912 to 04f0a42 Compare December 4, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant