[Lldb-commits] [lldb] [LLDB][Telemetry]Define TargetInfo for collecting data about a target (PR #127834)

Vy Nguyen via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 19 07:27:14 PDT 2025


================
@@ -1064,6 +1065,29 @@ const char *Process::GetExitDescription() {
 bool Process::SetExitStatus(int status, llvm::StringRef exit_string) {
   // Use a mutex to protect setting the exit status.
   std::lock_guard<std::mutex> guard(m_exit_status_mutex);
+  telemetry::ScopedDispatcher<telemetry::ProcessExitInfo> helper;
+
+  // Find the executable-module's UUID, if available.
+  UUID exec_uuid;
+  // Check if there is (still) a valid target and get the debugger and exec_uuid
+  // from it.
+  TargetSP target_sp(Debugger::FindTargetWithProcessID(m_pid));
+  if (target_sp) {
+    helper.SetDebugger(&(target_sp->GetDebugger()));
+    exec_uuid = target_sp->GetExecModuleUUID();
----------------
oontvoo wrote:

@labath  Ah, I've found the test that crashed! (See the build log on this PR). Without the check for the validity of the Target pointer and the module pointer, the test crashed/timedout. By contrast, if we added this check, the whole test suite passed:

```
  TargetSP target_sp(Debugger::FindTargetWithProcessID(m_pid));
   if (target_sp) {
    helper.SetDebugger(&(target_sp->GetDebugger()));
    if (ModuleSP mod = target_sp->GetExecutableModule())
      module_uuid = mod->GetUUID();
   }

```



https://github.com/llvm/llvm-project/pull/127834


More information about the lldb-commits mailing list