aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2025-05-07 09:11:09 +0000
committerDavid Spickett <david.spickett@linaro.org>2025-05-07 09:11:09 +0000
commit47c7e73e5763f81f218cc4e1eae306d0427aa42d (patch)
tree795efc09cb86e6ee7f1205b5c331a9e06b1adf84 /lldb/packages/Python/lldbsuite
parentb643a529dcd2b1b2e4e81c3be427edfcadc6d8fa (diff)
downloadllvm-47c7e73e5763f81f218cc4e1eae306d0427aa42d.zip
llvm-47c7e73e5763f81f218cc4e1eae306d0427aa42d.tar.gz
llvm-47c7e73e5763f81f218cc4e1eae306d0427aa42d.tar.bz2
Revert "[lldb-dap] Change the launch sequence (#138219)"
This reverts commit ba29e60f9a2222bd5e883579bb78db13fc5a7588. As it broke tests on Windows on Arm: https://lab.llvm.org/buildbot/#/builders/141/builds/8500 ******************** Unresolved Tests (2): lldb-api :: tools/lldb-dap/completions/TestDAP_completions.py lldb-api :: tools/lldb-dap/startDebugging/TestDAP_startDebugging.py ******************** Timed Out Tests (1): lldb-api :: tools/lldb-dap/send-event/TestDAP_sendEvent.py ******************** Failed Tests (6): lldb-api :: tools/lldb-dap/console/TestDAP_console.py lldb-api :: tools/lldb-dap/console/TestDAP_redirection_to_console.py lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py lldb-api :: tools/lldb-dap/stackTrace/TestDAP_stackTrace.py lldb-api :: tools/lldb-dap/stackTraceDisassemblyDisplay/TestDAP_stackTraceDisassemblyDisplay.py lldb-api :: tools/lldb-dap/variables/children/TestDAP_variables_children.py
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py65
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py7
2 files changed, 31 insertions, 41 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index e10342b..6d9ab77 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -132,6 +132,7 @@ class DebugCommunication(object):
self.exit_status = None
self.initialize_body = None
self.thread_stop_reasons = {}
+ self.breakpoint_events = []
self.progress_events = []
self.reverse_requests = []
self.module_events = []
@@ -243,6 +244,13 @@ class DebugCommunication(object):
self._process_stopped()
tid = body["threadId"]
self.thread_stop_reasons[tid] = body
+ elif event == "breakpoint":
+ # Breakpoint events come in when a breakpoint has locations
+ # added or removed. Keep track of them so we can look for them
+ # in tests.
+ self.breakpoint_events.append(packet)
+ # no need to add 'breakpoint' event packets to our packets list
+ return keepGoing
elif event.startswith("progress"):
# Progress events come in as 'progressStart', 'progressUpdate',
# and 'progressEnd' events. Keep these around in case test
@@ -404,15 +412,6 @@ class DebugCommunication(object):
self.threads = []
return stopped_events
- def wait_for_breakpoint_events(self, timeout=None):
- breakpoint_events = []
- while True:
- event = self.wait_for_event("breakpoint", timeout=timeout)
- if not event:
- break
- breakpoint_events.append(event)
- return breakpoint_events
-
def wait_for_exited(self):
event_dict = self.wait_for_event("exited")
if event_dict is None:
@@ -592,7 +591,6 @@ class DebugCommunication(object):
attachCommands=None,
terminateCommands=None,
coreFile=None,
- stopOnAttach=True,
postRunCommands=None,
sourceMap=None,
gdbRemotePort=None,
@@ -622,8 +620,6 @@ class DebugCommunication(object):
args_dict["attachCommands"] = attachCommands
if coreFile:
args_dict["coreFile"] = coreFile
- if stopOnAttach:
- args_dict["stopOnEntry"] = stopOnAttach
if postRunCommands:
args_dict["postRunCommands"] = postRunCommands
if sourceMap:
@@ -636,7 +632,7 @@ class DebugCommunication(object):
response = self.send_recv(command_dict)
if response["success"]:
- self.wait_for_event("process")
+ self.wait_for_events(["process", "initialized"])
return response
def request_breakpointLocations(
@@ -670,6 +666,10 @@ class DebugCommunication(object):
response = self.send_recv(command_dict)
if response:
self.configuration_done_sent = True
+ # Client requests the baseline of currently existing threads after
+ # a successful launch or attach.
+ # Kick off the threads request that follows
+ self.request_threads()
return response
def _process_stopped(self):
@@ -887,7 +887,7 @@ class DebugCommunication(object):
response = self.send_recv(command_dict)
if response["success"]:
- self.wait_for_event("process")
+ self.wait_for_events(["process", "initialized"])
return response
def request_next(self, threadId, granularity="statement"):
@@ -1325,26 +1325,6 @@ def attach_options_specified(options):
def run_vscode(dbg, args, options):
dbg.request_initialize(options.sourceInitFile)
-
- if options.sourceBreakpoints:
- source_to_lines = {}
- for file_line in options.sourceBreakpoints:
- (path, line) = file_line.split(":")
- if len(path) == 0 or len(line) == 0:
- print('error: invalid source with line "%s"' % (file_line))
-
- else:
- if path in source_to_lines:
- source_to_lines[path].append(int(line))
- else:
- source_to_lines[path] = [int(line)]
- for source in source_to_lines:
- dbg.request_setBreakpoints(source, source_to_lines[source])
- if options.funcBreakpoints:
- dbg.request_setFunctionBreakpoints(options.funcBreakpoints)
-
- dbg.request_configurationDone()
-
if attach_options_specified(options):
response = dbg.request_attach(
program=options.program,
@@ -1373,6 +1353,23 @@ def run_vscode(dbg, args, options):
)
if response["success"]:
+ if options.sourceBreakpoints:
+ source_to_lines = {}
+ for file_line in options.sourceBreakpoints:
+ (path, line) = file_line.split(":")
+ if len(path) == 0 or len(line) == 0:
+ print('error: invalid source with line "%s"' % (file_line))
+
+ else:
+ if path in source_to_lines:
+ source_to_lines[path].append(int(line))
+ else:
+ source_to_lines[path] = [int(line)]
+ for source in source_to_lines:
+ dbg.request_setBreakpoints(source, source_to_lines[source])
+ if options.funcBreakpoints:
+ dbg.request_setFunctionBreakpoints(options.funcBreakpoints)
+ dbg.request_configurationDone()
dbg.wait_for_stopped()
else:
if "message" in response:
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 958c726..2c14bb35 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -340,7 +340,6 @@ class DAPTestCaseBase(TestBase):
exitCommands=None,
attachCommands=None,
coreFile=None,
- stopOnAttach=True,
disconnectAutomatically=True,
terminateCommands=None,
postRunCommands=None,
@@ -365,8 +364,6 @@ class DAPTestCaseBase(TestBase):
self.addTearDownHook(cleanup)
# Initialize and launch the program
self.dap_server.request_initialize(sourceInitFile)
- self.dap_server.wait_for_event("initialized")
- self.dap_server.request_configurationDone()
response = self.dap_server.request_attach(
program=program,
pid=pid,
@@ -379,7 +376,6 @@ class DAPTestCaseBase(TestBase):
attachCommands=attachCommands,
terminateCommands=terminateCommands,
coreFile=coreFile,
- stopOnAttach=stopOnAttach,
postRunCommands=postRunCommands,
sourceMap=sourceMap,
gdbRemotePort=gdbRemotePort,
@@ -438,9 +434,6 @@ class DAPTestCaseBase(TestBase):
# Initialize and launch the program
self.dap_server.request_initialize(sourceInitFile)
- self.dap_server.wait_for_event("initialized")
- self.dap_server.request_configurationDone()
-
response = self.dap_server.request_launch(
program,
args=args,