Skip to content

Commit 7b6ca81

Browse files
Merge pull request #36 from DhruvSrivastavaX/12-First-time-attach
First time attach resolution
2 parents 1ca1630 + d00d28a commit 7b6ca81

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,21 @@ Status NativeProcessAIX::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
20002000
} else if (req == PT_WRITE_BLOCK) {
20012001
ptrace64(req, pid, (long long)addr, (int)data_size, (int *)result);
20022002
} else if (req == PT_ATTACH) {
2003+
// Block SIGCHLD signal during attach to the process,
2004+
// to prevent interruptions.
2005+
// The ptrace operation may send SIGCHLD signals in certain cases
2006+
// during the attach, which can interfere.
2007+
static sigset_t signal_set;
2008+
sigemptyset (&signal_set);
2009+
sigaddset (&signal_set, SIGCHLD);
2010+
if(!pthread_sigmask( SIG_BLOCK, &signal_set, NULL))
2011+
LLDB_LOG(log,"NativeProcessAIX::pthread_sigmask(SIG_BLOCK) Failed");
2012+
20032013
ptrace64(req, pid, 0, 0, nullptr);
2014+
2015+
//Unblocking the SIGCHLD after attach work.
2016+
if(!pthread_sigmask( SIG_UNBLOCK, &signal_set, NULL ))
2017+
LLDB_LOG(log,"NativeProcessAIX::pthread_sigmask(SIG_UNBLOCK) Failed");
20042018
} else if (req == PT_WATCH) {
20052019
ptrace64(req, pid, (long long)addr, (int)data_size, nullptr);
20062020
} else if (req == PT_DETACH) {

0 commit comments

Comments
 (0)