File tree 4 files changed +66
-4
lines changed
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart
source/Plugins/Process/gdb-remote
4 files changed +66
-4
lines changed Original file line number Diff line number Diff line change
1
+ LEVEL = ../../../make
2
+
3
+ CXX_SOURCES := main.cpp
4
+
5
+ include $(LEVEL ) /Makefile.rules
Original file line number Diff line number Diff line change
1
+ """
2
+ Test inferior restart when breakpoint is set on running target.
3
+ """
4
+
5
+ import os
6
+ import lldb
7
+ from lldbsuite .test .lldbtest import *
8
+ from lldbsuite .test import lldbutil
9
+
10
+ class BreakpointSetRestart (TestBase ):
11
+
12
+ mydir = TestBase .compute_mydir (__file__ )
13
+ BREAKPOINT_TEXT = 'Set a breakpoint here'
14
+
15
+ def test_breakpoint_set_restart (self ):
16
+ self .build ()
17
+
18
+ cwd = self .get_process_working_directory ()
19
+ exe = os .path .join (cwd , "a.out" )
20
+ target = self .dbg .CreateTarget (exe )
21
+
22
+ self .dbg .SetAsync (True )
23
+ process = target .LaunchSimple (None , None , cwd )
24
+
25
+ lldbutil .expect_state_changes (self , self .dbg .GetListener (), [lldb .eStateRunning ])
26
+ bp = target .BreakpointCreateBySourceRegex (self .BREAKPOINT_TEXT ,
27
+ lldb .SBFileSpec (os .path .join (cwd , 'main.cpp' )))
28
+ self .assertTrue (bp .IsValid () and bp .GetNumLocations () == 1 , VALID_BREAKPOINT )
29
+
30
+ event = lldb .SBEvent ()
31
+ while self .dbg .GetListener ().WaitForEvent (2 , event ):
32
+ if lldb .SBProcess .GetStateFromEvent (event ) == lldb .eStateStopped and lldb .SBProcess .GetRestartedFromEvent (event ):
33
+ continue
34
+ if lldb .SBProcess .GetStateFromEvent (event ) == lldb .eStateRunning :
35
+ continue
36
+ self .fail ("Setting a breakpoint generated an unexpected event: %s" % lldb .SBDebugger .StateAsCString (lldb .SBProcess .GetStateFromEvent (event )))
37
+
Original file line number Diff line number Diff line change
1
+ // ===-- main.cpp ------------------------------------------------*- C++ -*-===//
2
+ //
3
+ // The LLVM Compiler Infrastructure
4
+ //
5
+ // This file is distributed under the University of Illinois Open Source
6
+ // License. See LICENSE.TXT for details.
7
+ //
8
+ // ===----------------------------------------------------------------------===//
9
+
10
+ #include < iostream>
11
+ #include < stdio.h>
12
+
13
+ int main (int argc, char const *argv[])
14
+ {
15
+ getchar ();
16
+ printf (" Set a breakpoint here.\n " );
17
+ return 0 ;
18
+ }
19
+
Original file line number Diff line number Diff line change @@ -1165,12 +1165,13 @@ GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse
1165
1165
// binaries that would send two stop replies anytime the process
1166
1166
// was interrupted, so we need to also check for an extra
1167
1167
// stop reply packet if we interrupted the process
1168
- if (m_interrupt_sent || (signo != sigint_signo && signo != sigstop_signo))
1168
+ const bool received_nonstop_signal = signo != sigint_signo && signo != sigstop_signo;
1169
+ if (m_interrupt_sent || received_nonstop_signal)
1169
1170
{
1170
- continue_after_async = false ;
1171
+ if (received_nonstop_signal)
1172
+ continue_after_async = false ;
1171
1173
1172
- // We didn't get a SIGINT or SIGSTOP, so try for a
1173
- // very brief time (0.1s) to get another stop reply
1174
+ // Try for a very brief time (0.1s) to get another stop reply
1174
1175
// packet to make sure it doesn't get in the way
1175
1176
StringExtractorGDBRemote extra_stop_reply_packet;
1176
1177
uint32_t timeout_usec = 100000 ;
You can’t perform that action at this time.
0 commit comments