[Lldb-commits] [PATCH] D100206: [lldb] [llgs client] Support minimal fork/vfork handling
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Apr 11 08:37:20 PDT 2021
mgorny updated this revision to Diff 336669.
mgorny added a comment.
Base class `Did*Fork()` definitions have been moved to the earlier patch.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100206/new/
https://reviews.llvm.org/D100206
Files:
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -230,6 +230,9 @@
std::string HarmonizeThreadIdsForProfileData(
StringExtractorGDBRemote &inputStringExtractor);
+ void DidFork(lldb::pid_t child_pid, lldb::tid_t child_tid) override;
+ void DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) override;
+
protected:
friend class ThreadGDBRemote;
friend class GDBRemoteCommunicationClient;
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -5436,3 +5436,29 @@
GetTarget().GetDebugger().GetCommandInterpreter());
return m_command_sp.get();
}
+
+void ProcessGDBRemote::DidFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
+ Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+
+ LLDB_LOG(log, "Detaching forked child {0}", child_pid);
+ Status error = m_gdb_comm.Detach(false, child_pid);
+ if (error.Fail()) {
+ LLDB_LOG(log,
+ "ProcessGDBRemote::DidFork() detach packet send failed: {0}",
+ error.AsCString() ? error.AsCString() : "<unknown error>");
+ return;
+ }
+}
+
+void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
+ Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+
+ LLDB_LOG(log, "Detaching forked child {0}", child_pid);
+ Status error = m_gdb_comm.Detach(false, child_pid);
+ if (error.Fail()) {
+ LLDB_LOG(log,
+ "ProcessGDBRemote::DidFork() detach packet send failed: {0}",
+ error.AsCString() ? error.AsCString() : "<unknown error>");
+ return;
+ }
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100206.336669.patch
Type: text/x-patch
Size: 1999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210411/0be05a32/attachment.bin>
More information about the lldb-commits
mailing list