[Lldb-commits] [PATCH] D114796: [lldb/qemu] Add support for pty redirection
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 30 06:19:09 PST 2021
labath created this revision.
labath added reviewers: mgorny, DavidSpickett, JDevlieghere.
labath requested review of this revision.
Herald added a project: LLDB.
Lldb uses a pty to read/write to the standard input and output of the
debugged process. For host processes this would be automatically set up
by Target::FinalizeFileActions. The Qemu platform is in a unique
position of not really being a host platform, but not being remote
either. It reports IsHost() = false, but it is sufficiently host-like
that we can use the usual pty mechanism.
This patch adds the necessary glue code to enable pty redirection. It
includes a small refactor of Target::FinalizeFileActions and
ProcessLaunchInfo::SetUpPtyRedirection to reduce the amount of
boilerplate that would need to be copied.
I will note that qemu is not able to separate output from the emulated
program from the output of the emulator itself, so the two will arrive
intertwined. Normally this should not be a problem since qemu should not
produce any output during regular operation, but some output can slip
through in case of errors. This situation should be pretty obvious (to a
human), and it is the best we can do anyway.
For testing purposes, and inspired by lldb-server tests, I have extended
the mock emulator with the ability "program" the behavior of the
"emulated" program via command-line arguments.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114796
Files:
lldb/source/Host/common/ProcessLaunchInfo.cpp
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
lldb/source/Target/Target.cpp
lldb/test/API/qemu/TestQemuLaunch.py
lldb/test/API/qemu/qemu.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114796.390681.patch
Type: text/x-patch
Size: 11055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211130/0cce216c/attachment.bin>
More information about the lldb-commits
mailing list