[Lldb-commits] [lldb] r228417 - Fix a missing "*stopped" notification in LLDB-MI after "process launch -s" in case of remote-macosx

Ilia K ki.stfu at gmail.com
Fri Feb 6 10:15:05 PST 2015


Author: ki.stfu
Date: Fri Feb  6 12:15:05 2015
New Revision: 228417

URL: http://llvm.org/viewvc/llvm-project?rev=228417&view=rev
Log:
Fix a missing "*stopped" notification in LLDB-MI after "process launch -s" in case of remote-macosx

Summary:
This patch fixes *stopped notification for remote target when started with eLaunchFlagStopAtEntry (for example, using "process launch -s").

See explanation below:
```
Target::Launch (ProcessLaunchInfo &launch_info, Stream *stream)
{
...
if (state != eStateConnected && platform_sp && platform_sp->CanDebugProcess ())
{
   ...
}
else
{
   ...
   if (m_process_sp)
      error = m_process_sp->Launch (launch_info);
}

if (error.Success())
{
    if (launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == false)
    {
        ....
    }
    -- missing event if eLaunchFlagStopAtEntry is set --
    m_process_sp->RestoreProcessEvents ();
}
...
return error
```

Also this patch contains tests and you can check how it works.

Reviewers: zturner, clayborg, abidh

Reviewed By: clayborg

Subscribers: clayborg, abidh, zturner, lldb-commits

Differential Revision: http://reviews.llvm.org/D7273

Modified:
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/test/tools/lldb-mi/TestMiNotification.py

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=228417&r1=228416&r2=228417&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Feb  6 12:15:05 2015
@@ -3121,6 +3121,11 @@ Process::Launch (ProcessLaunchInfo &laun
                             StartPrivateStateThread ();
 
                         m_stop_info_override_callback = GetTarget().GetArchitecture().GetStopInfoOverrideCallback();
+
+                        // Target was stopped at entry as was intended. Need to notify the listeners
+                        // about it.
+                        if (launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == true)
+                            HandlePrivateEvent(event_sp);
                     }
                     else if (state == eStateExited)
                     {

Modified: lldb/trunk/test/tools/lldb-mi/TestMiNotification.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiNotification.py?rev=228417&r1=228416&r2=228417&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiNotification.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiNotification.py Fri Feb  6 12:15:05 2015
@@ -49,7 +49,6 @@ class MiNotificationTestCase(lldbmi_test
 
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
-    @unittest2.skip("reviews.llvm.org/D7273: requires this patch")
     def test_lldbmi_stopped_when_stopatentry_local(self):
         """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (local)."""
 
@@ -64,11 +63,10 @@ class MiNotificationTestCase(lldbmi_test
         self.expect("\^done")
 
         # Test that *stopped is printed
-        self.expect("\*stopped,reason=\"signal-received\",signal=\"17\",thread-id=\"1\",stopped-threads=\"all\"")
+        self.expect("\*stopped,reason=\"signal-received\",signal=\"17\",stopped-threads=\"all\"")
 
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
-    @unittest2.skip("reviews.llvm.org/D7273: requires this patch")
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     def test_lldbmi_stopped_when_stopatentry_remote(self):
         """Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (remote)."""
@@ -103,7 +101,12 @@ class MiNotificationTestCase(lldbmi_test
             self.expect("\^done")
 
             # Test that *stopped is printed
-            self.expect("\*stopped,reason=\"signal-received\",signal=\"17\",thread-id=\"1\",stopped-threads=\"all\"")
+            self.expect("\*stopped,reason=\"signal-received\",signal=\"17\",stopped-threads=\"all\"")
+
+            # Exit
+            self.runCmd("-gdb-exit")
+            self.runCmd("") #FIXME lldb-mi hangs here on Linux; extra return is needed
+            self.expect("\^exit")
 
         finally:
             # Clean up





More information about the lldb-commits mailing list