diff --git a/src/signalhandler.cc b/src/signalhandler.cc index c5bae59..4c00234 100644 --- a/src/signalhandler.cc +++ b/src/signalhandler.cc @@ -55,6 +55,10 @@ #ifdef HAVE_UNISTD_H # include #endif +#if defined(HAVE_SYS_SYSCALL_H) && defined(HAVE_SYS_TYPES_H) +# include +# include +#endif namespace google { @@ -216,8 +220,14 @@ void DumpSignalInfo(int signal_number, siginfo_t* siginfo) { std::ostringstream oss; oss << std::showbase << std::hex << std::this_thread::get_id(); formatter.AppendString(oss.str().c_str()); - +# if defined(GLOG_OS_LINUX) && defined(HAVE_SYS_SYSCALL_H) && \ + defined(HAVE_SYS_TYPES_H) + pid_t tid = syscall(SYS_gettid); + formatter.AppendString(" LWP "); + formatter.AppendUint64(static_cast(tid), 10); +# endif formatter.AppendString(") "); + // Only linux has the PID of the signal sender in si_pid. # ifdef GLOG_OS_LINUX formatter.AppendString("from PID ");