[Lldb-commits] [lldb] r265843 - Reset continue_after_async only if neither SIGINIT nor SIGSTOP received.

Oleksiy Vyalov via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 8 13:44:30 PDT 2016


Author: ovyalov
Date: Fri Apr  8 15:44:28 2016
New Revision: 265843

URL: http://llvm.org/viewvc/llvm-project?rev=265843&view=rev
Log:
Reset continue_after_async only if neither SIGINIT nor SIGSTOP received.

http://reviews.llvm.org/D18886


Added:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile?rev=265843&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/Makefile Fri Apr  8 15:44:28 2016
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py?rev=265843&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py Fri Apr  8 15:44:28 2016
@@ -0,0 +1,37 @@
+"""
+Test inferior restart when breakpoint is set on running target.
+"""
+
+import os
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class BreakpointSetRestart(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+    BREAKPOINT_TEXT = 'Set a breakpoint here'
+
+    def test_breakpoint_set_restart(self):
+        self.build()
+
+        cwd = self.get_process_working_directory()
+        exe = os.path.join(cwd, "a.out")
+        target = self.dbg.CreateTarget(exe)
+
+        self.dbg.SetAsync(True)
+        process = target.LaunchSimple(None, None, cwd)
+
+        lldbutil.expect_state_changes(self, self.dbg.GetListener(), [lldb.eStateRunning])
+        bp = target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
+                                                  lldb.SBFileSpec(os.path.join(cwd, 'main.cpp')))
+        self.assertTrue(bp.IsValid() and bp.GetNumLocations() == 1, VALID_BREAKPOINT)
+
+        event = lldb.SBEvent()
+        while self.dbg.GetListener().WaitForEvent(2, event):
+            if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event):
+                continue
+            if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
+                continue
+            self.fail("Setting a breakpoint generated an unexpected event: %s" % lldb.SBDebugger.StateAsCString(lldb.SBProcess.GetStateFromEvent(event)))
+

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp?rev=265843&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/main.cpp Fri Apr  8 15:44:28 2016
@@ -0,0 +1,19 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <iostream>
+#include <stdio.h>
+
+int main(int argc, char const *argv[])
+{
+    getchar();
+    printf("Set a breakpoint here.\n");
+    return 0;
+}
+

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=265843&r1=265842&r2=265843&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Apr  8 15:44:28 2016
@@ -1165,12 +1165,13 @@ GDBRemoteCommunicationClient::SendContin
                             // binaries that would send two stop replies anytime the process
                             // was interrupted, so we need to also check for an extra
                             // stop reply packet if we interrupted the process
-                            if (m_interrupt_sent || (signo != sigint_signo && signo != sigstop_signo))
+                            const bool received_nonstop_signal = signo != sigint_signo && signo != sigstop_signo;
+                            if (m_interrupt_sent || received_nonstop_signal)
                             {
-                                continue_after_async = false;
+                                if (received_nonstop_signal)
+                                    continue_after_async = false;
 
-                                // We didn't get a SIGINT or SIGSTOP, so try for a
-                                // very brief time (0.1s) to get another stop reply
+                                // Try for a very brief time (0.1s) to get another stop reply
                                 // packet to make sure it doesn't get in the way
                                 StringExtractorGDBRemote extra_stop_reply_packet;
                                 uint32_t timeout_usec = 100000;




More information about the lldb-commits mailing list