diff options
Diffstat (limited to 'lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp index feba3af8fcf..a498e559915 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp @@ -41,8 +41,8 @@ using namespace lldb; using namespace lldb_private; -// We disable the tracing of ptrace calls for integration builds to -// avoid the additional indirection and checks. +// We disable the tracing of ptrace calls for integration builds to avoid the +// additional indirection and checks. #ifndef LLDB_CONFIGURATION_BUILDANDINTEGRATION // Wrapper for ptrace to catch errors and log calls. @@ -61,9 +61,8 @@ const char *Get_PT_IO_OP(int op) { } } -// Wrapper for ptrace to catch errors and log calls. -// Note that ptrace sets errno on error because -1 is reserved as a valid -// result. +// Wrapper for ptrace to catch errors and log calls. Note that ptrace sets +// errno on error because -1 is reserved as a valid result. extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data, const char *reqName, const char *file, int line) { long int result; @@ -130,8 +129,8 @@ extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data, return result; } -// Wrapper for ptrace when logging is not required. -// Sets errno to 0 prior to calling ptrace. +// Wrapper for ptrace when logging is not required. Sets errno to 0 prior to +// calling ptrace. extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data) { long result = 0; errno = 0; @@ -875,9 +874,9 @@ bool ProcessMonitor::Launch(LaunchArgs *args) { if (PTRACE(PT_TRACE_ME, 0, NULL, 0) < 0) exit(ePtraceFailed); - // terminal has already dupped the tty descriptors to stdin/out/err. - // This closes original fd from which they were copied (and avoids - // leaking descriptors to the debugged process. + // terminal has already dupped the tty descriptors to stdin/out/err. This + // closes original fd from which they were copied (and avoids leaking + // descriptors to the debugged process. terminal.CloseSlaveFileDescriptor(); // Do not inherit setgid powers. @@ -1102,9 +1101,9 @@ ProcessMessage ProcessMonitor::MonitorSIGTRAP(ProcessMonitor *monitor, break; case (SIGTRAP /* | (PTRACE_EVENT_EXIT << 8) */): { - // The inferior process is about to exit. Maintain the process in a - // state of "limbo" until we are explicitly commanded to detach, - // destroy, resume, etc. + // The inferior process is about to exit. Maintain the process in a state + // of "limbo" until we are explicitly commanded to detach, destroy, resume, + // etc. unsigned long data = 0; if (!monitor->GetEventMessage(tid, &data)) data = -1; @@ -1159,8 +1158,8 @@ ProcessMessage ProcessMonitor::MonitorSignal(ProcessMonitor *monitor, Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); // POSIX says that process behaviour is undefined after it ignores a SIGFPE, - // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a - // kill(2) or raise(3). Similarly for tgkill(2) on FreeBSD. + // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a kill(2) + // or raise(3). Similarly for tgkill(2) on FreeBSD. // // IOW, user generated signals never generate what we consider to be a // "crash". @@ -1196,8 +1195,8 @@ ProcessMessage ProcessMonitor::MonitorSignal(ProcessMonitor *monitor, } // else; Use atleast si_signo info for other si_code } - // Everything else is "normal" and does not require any special action on - // our part. + // Everything else is "normal" and does not require any special action on our + // part. return ProcessMessage::Signal(tid, signo); } @@ -1423,14 +1422,14 @@ void ProcessMonitor::StopMonitor() { } // FIXME: On Linux, when a new thread is created, we receive to notifications, -// (1) a SIGTRAP|PTRACE_EVENT_CLONE from the main process thread with the -// child thread id as additional information, and (2) a SIGSTOP|SI_USER from -// the new child thread indicating that it has is stopped because we attached. -// We have no guarantee of the order in which these arrive, but we need both -// before we are ready to proceed. We currently keep a list of threads which -// have sent the initial SIGSTOP|SI_USER event. Then when we receive the -// SIGTRAP|PTRACE_EVENT_CLONE notification, if the initial stop has not occurred -// we call ProcessMonitor::WaitForInitialTIDStop() to wait for it. +// (1) a SIGTRAP|PTRACE_EVENT_CLONE from the main process thread with the child +// thread id as additional information, and (2) a SIGSTOP|SI_USER from the new +// child thread indicating that it has is stopped because we attached. We have +// no guarantee of the order in which these arrive, but we need both before we +// are ready to proceed. We currently keep a list of threads which have sent +// the initial SIGSTOP|SI_USER event. Then when we receive the +// SIGTRAP|PTRACE_EVENT_CLONE notification, if the initial stop has not +// occurred we call ProcessMonitor::WaitForInitialTIDStop() to wait for it. // // Right now, the above logic is in ProcessPOSIX, so we need a definition of // this function in the FreeBSD ProcessMonitor implementation even if it isn't |