================
@@ -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();
----------------
labath wrote:

Are you sure about that. Modules normally exist long after the process exits:
```
$ lldb echo
(lldb) target create "echo"
Current executable set to '/bin/echo' (x86_64).
(lldb) r
Process 15996 launched: '/bin/echo' (x86_64)

Process 15996 exited with status = 0 (0x00000000) 
(lldb) image list
[  0] 676F00F7 0x0000555555554000 /bin/echo 
[  1] D626A570 0x00007ffff7fc6000 /lib64/ld-linux-x86-64.so.2 
[  2] 421DCFD2-138A-B321-D6F1-7AFD7B7FC999-F79CA445 0x00007ffff7fc5000 [vdso] 
(0x00007ffff7fc5000)
[  3] C88DE6C8 0x00007ffff7d99000 /lib64/libc.so.6 
      /usr/lib/debug/lib64/libc.so.6.debug
```

It's possible this happens in some exceptional exit scenarios, but in that 
case, I'd like to know what they are. In general, you cannot assume that a 
target will always have an executable module due to the scenarios I mentioned 
before.

https://github.com/llvm/llvm-project/pull/127834
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to