[Lldb-commits] [PATCH] D128932: [lldb] [llgs] Improve stdio forwarding in multiprocess+nonstop
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 6 01:35:43 PDT 2022
labath added a comment.
I have a feeling the semaphores will not work (compile) on darwin. I didn't find any sem_init call there -- just sem_open. Maybe instead of semaphores we could use files for the synchronization? Something similar to the `wait_for_file_on_target` function, just in the other direction. Then the test could create a file to move the processes forward? (This might be easier to achieve with a dedicated inferior, instead of trying to fit it into the universal LLGS inferior.)
================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:1110
// does not interfere with our protocol.
- StopSTDIOForwarding();
+ if (!m_non_stop)
+ StopSTDIOForwarding();
----------------
In the multiprocess all-stop mode, if one process stops, we are supposed to stop all of them, right? I take it that's not something we do right now, is it?
================
Comment at: lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py:116
+ parent_pid, parent_tid, child_pid, child_tid = (
+ self.start_fork_test(["fork", "sleep:2", "print-pid", "sleep:2",
+ "stop"],
----------------
mgorny wrote:
> mgorny wrote:
> > I really dislike these sleeps but I can't think of a better way of doing it (short of using IPC for synchronization). The goal is to 1) ensure that both processes start before they start outputting, and 2) ensure that both output before the first stop reason comes.
> Ok, semaphores are not scary after all, and I suppose we can expect them to work if we expect `fork()` to work.
> ensure that both processes start before they start outputting
But we should be able to see the output from the first process (if it had any) even it is the only process running. Do we have a test for that? Could you add a step where the first process outputs something before it waits to synchronize with the second process?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128932/new/
https://reviews.llvm.org/D128932
More information about the lldb-commits
mailing list