[Lldb-commits] [PATCH] D100208: [lldb] [Process/Linux] Report fork/vfork stop reason
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 21 08:58:04 PDT 2021
labath added a comment.
This seems reasonable.
Why don't we have tests that detach from the parent process (and maybe continue the child)? Does that already work? (or in general, what is expected to work after this patch?)
================
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:932
+
+ std::unique_ptr<NativeProcessProtocol> child_process_up{child_process};
+ Extension expected_ext = is_vfork ? Extension::vfork : Extension::fork;
----------------
Store directly into unique_ptr<NativeProcessLinux> above.
================
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:938-940
+ parent_thread->SetStoppedByVFork(child_pid);
+ else
+ parent_thread->SetStoppedByFork(child_pid);
----------------
I'd consider merging the two functions into `SetStoppedByFork(is_vfork, child_pid)`
================
Comment at: lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp:401-402
+ m_stop_info.reason = StopReason::eStopReasonFork;
+ m_stop_info.details.fork.child_pid = child_pid;
+ m_stop_info.details.fork.child_tid = child_pid;
+}
----------------
duplicated
================
Comment at: lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp:409-410
+ m_stop_info.reason = StopReason::eStopReasonVFork;
+ m_stop_info.details.fork.child_pid = child_pid;
+ m_stop_info.details.fork.child_tid = child_pid;
+}
----------------
ditto
================
Comment at: lldb/test/API/tools/lldb-server/main.cpp:322-327
+ } else if (!std::strcmp(argv[i], FORK_COMMAND)) {
+ if (fork() == 0)
+ _exit(0);
+ } else if (!std::strcmp(argv[i], VFORK_COMMAND)) {
+ if (vfork() == 0)
+ _exit(0);
----------------
I guess these would need to be ifdefed too.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100208/new/
https://reviews.llvm.org/D100208
More information about the lldb-commits
mailing list