Skip to content

[lldb][lldb-dap] Redirect LLDB's messages to the right output category. #137002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_inflight_request(self):

blocking_seq = self.async_blocking_request(duration=self.timeoutval / 2)
# Wait for the sleep to start to cancel the inflight request.
self.collect_stdout(
self.collect_console(
timeout_secs=self.timeoutval,
pattern="starting sleep",
)
Expand Down
7 changes: 6 additions & 1 deletion lldb/test/API/tools/lldb-dap/output/TestDAP_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def test_output(self):
output += self.get_stdout(timeout=lldbdap_testcase.DAPTestCaseBase.timeoutval)
self.assertTrue(output and len(output) > 0, "expect program stdout")
self.assertIn(
"abcdefghi\r\nhello world\r\nfinally\0\0out\0\0\r\nerr\0\0",
"abcdefghi\r\nhello world\r\nfinally\0\0",
output,
"full stdout not found in: " + repr(output),
)
console = self.get_console(timeout=self.timeoutval)
self.assertTrue(console and len(console) > 0, "expect dap messages")
self.assertIn(
"out\0\0\r\nerr\0\0\r\n", console, f"full console message not found"
)
4 changes: 2 additions & 2 deletions lldb/tools/lldb-dap/DAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ llvm::Error DAP::ConfigureIO(std::FILE *overrideOut, std::FILE *overrideErr) {
in = lldb::SBFile(std::fopen(DEV_NULL, "r"), /*transfer_ownership=*/true);

if (auto Error = out.RedirectTo(overrideOut, [this](llvm::StringRef output) {
SendOutput(OutputType::Stdout, output);
SendOutput(OutputType::Console, output);
}))
return Error;

if (auto Error = err.RedirectTo(overrideErr, [this](llvm::StringRef output) {
SendOutput(OutputType::Stderr, output);
SendOutput(OutputType::Console, output);
}))
return Error;

Expand Down
Loading