diff --git a/src/signalhandler.cc b/src/signalhandler.cc index c5bae598d..ae28558a5 100644 --- a/src/signalhandler.cc +++ b/src/signalhandler.cc @@ -53,6 +53,8 @@ # include #endif #ifdef HAVE_UNISTD_H +# include +# include # include #endif @@ -218,8 +220,14 @@ void DumpSignalInfo(int signal_number, siginfo_t* siginfo) { formatter.AppendString(oss.str().c_str()); formatter.AppendString(") "); + // Only linux has the PID of the signal sender in si_pid. # ifdef GLOG_OS_LINUX + pid_t tid = syscall(SYS_gettid); + formatter.AppendString("(LWP "); + formatter.AppendUint64(tid, 10); + formatter.AppendString(") "); + formatter.AppendString("from PID "); formatter.AppendUint64(static_cast(siginfo->si_pid), 10); formatter.AppendString("; ");