[Lldb-commits] [PATCH] D90938: [lldb] [Process/FreeBSDRemote] Handle exec() from inferior

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 9 02:37:06 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9e1409aa1e0b: [lldb] [Process/FreeBSDRemote] Handle exec() from inferior (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90938/new/

https://reviews.llvm.org/D90938

Files:
  lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
  lldb/test/API/functionalities/exec/TestExec.py


Index: lldb/test/API/functionalities/exec/TestExec.py
===================================================================
--- lldb/test/API/functionalities/exec/TestExec.py
+++ lldb/test/API/functionalities/exec/TestExec.py
@@ -20,7 +20,6 @@
     @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
     @expectedFailureNetBSD
     @skipIfAsan # rdar://problem/43756823
-    @skipIfFreeBSD  # hangs
     @skipIfWindows
     def test_hitting_exec (self):
         self.do_test(False)
@@ -29,7 +28,6 @@
     @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
     @expectedFailureNetBSD
     @skipIfAsan # rdar://problem/43756823
-    @skipIfFreeBSD  # hangs
     @skipIfWindows
     def test_skipping_exec (self):
         self.do_test(True)
Index: lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
===================================================================
--- lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
@@ -211,6 +211,22 @@
     return;
   }
 
+  if (info.pl_flags & PL_FLAG_EXEC) {
+    Status error = ReinitializeThreads();
+    if (error.Fail()) {
+      SetState(StateType::eStateInvalid);
+      return;
+    }
+
+    // Let our delegate know we have just exec'd.
+    NotifyDidExec();
+
+    for (const auto &thread : m_threads)
+      static_cast<NativeThreadFreeBSD &>(*thread).SetStoppedByExec();
+    SetState(StateType::eStateStopped, true);
+    return;
+  }
+
   if (info.pl_lwpid > 0) {
     for (const auto &t : m_threads) {
       if (t->GetID() == static_cast<lldb::tid_t>(info.pl_lwpid))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90938.303796.patch
Type: text/x-patch
Size: 1823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201109/087eba57/attachment-0001.bin>


More information about the lldb-commits mailing list