Skip to content

Commit 01263c6

Browse files
authored
[lldb] Rename lldb-vscode to lldb-dap (llvm#69264)
Rename lldb-vscode to lldb-dap. This change is largely mechanical. The following substitutions cover the majority of the changes in this commit: s/VSCODE/DAP/ s/VSCode/DAP/ s/vscode/dap/ s/g_vsc/g_dap/ Discourse RFC: https://discourse.llvm.org/t/rfc-rename-lldb-vscode-to-lldb-dap/74075/
1 parent 0446c58 commit 01263c6

File tree

135 files changed

+1043
-1040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+1043
-1040
lines changed

lldb/packages/Python/lldbsuite/test/dotest.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,15 @@ def setupSysPath():
485485
os.environ["LLDB_SRC"] = lldbsuite.lldb_root
486486

487487
pluginPath = os.path.join(scriptPath, "plugins")
488-
toolsLLDBVSCode = os.path.join(scriptPath, "tools", "lldb-vscode")
488+
toolsLLDBDAP = os.path.join(scriptPath, "tools", "lldb-dap")
489489
toolsLLDBServerPath = os.path.join(scriptPath, "tools", "lldb-server")
490490
intelpt = os.path.join(scriptPath, "tools", "intelpt")
491491

492492
# Insert script dir, plugin dir and lldb-server dir to the sys.path.
493493
sys.path.insert(0, pluginPath)
494-
# Adding test/tools/lldb-vscode to the path makes it easy to
495-
# "import lldb_vscode_testcase" from the VSCode tests
496-
sys.path.insert(0, toolsLLDBVSCode)
494+
# Adding test/tools/lldb-dap to the path makes it easy to
495+
# "import lldb_dap_testcase" from the DAP tests
496+
sys.path.insert(0, toolsLLDBDAP)
497497
# Adding test/tools/lldb-server to the path makes it easy
498498
# to "import lldbgdbserverutils" from the lldb-server tests
499499
sys.path.insert(0, toolsLLDBServerPath)
@@ -538,15 +538,15 @@ def setupSysPath():
538538

539539
lldbDir = os.path.dirname(lldbtest_config.lldbExec)
540540

541-
lldbVSCodeExec = os.path.join(lldbDir, "lldb-vscode")
542-
if is_exe(lldbVSCodeExec):
543-
os.environ["LLDBVSCODE_EXEC"] = lldbVSCodeExec
541+
lldbDAPExec = os.path.join(lldbDir, "lldb-dap")
542+
if is_exe(lldbDAPExec):
543+
os.environ["LLDBDAP_EXEC"] = lldbDAPExec
544544
else:
545-
if not configuration.shouldSkipBecauseOfCategories(["lldb-vscode"]):
545+
if not configuration.shouldSkipBecauseOfCategories(["lldb-dap"]):
546546
print(
547-
"The 'lldb-vscode' executable cannot be located. The lldb-vscode tests can not be run as a result."
547+
"The 'lldb-dap' executable cannot be located. The lldb-dap tests can not be run as a result."
548548
)
549-
configuration.skip_categories.append("lldb-vscode")
549+
configuration.skip_categories.append("lldb-dap")
550550

551551
lldbPythonDir = None # The directory that contains 'lldb/__init__.py'
552552

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,10 @@ def setUp(self):
801801
else:
802802
self.libcxxPath = None
803803

804-
if "LLDBVSCODE_EXEC" in os.environ:
805-
self.lldbVSCodeExec = os.environ["LLDBVSCODE_EXEC"]
804+
if "LLDBDAP_EXEC" in os.environ:
805+
self.lldbDAPExec = os.environ["LLDBDAP_EXEC"]
806806
else:
807-
self.lldbVSCodeExec = None
807+
self.lldbDAPExec = None
808808

809809
self.lldbOption = " ".join("-o '" + s + "'" for s in self.setUpCommands())
810810

lldb/packages/Python/lldbsuite/test/test_categories.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"libc++": "Test for libc++ data formatters",
3232
"libstdcxx": "Test for libstdcxx data formatters",
3333
"lldb-server": "Tests related to lldb-server",
34-
"lldb-vscode": "Visual Studio Code debug adaptor tests",
34+
"lldb-dap": "Tests for the Debug Adaptor Protocol with lldb-dap",
3535
"llgs": "Tests for the gdb-server functionality of lldb-server",
3636
"objc": "Tests related to the Objective-C programming language support",
3737
"pyapi": "Tests related to the Python API",

lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py renamed to lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ def terminate(self):
10131013
# self.recv.close()
10141014

10151015

1016-
class DebugAdaptor(DebugCommunication):
1016+
class DebugAdaptorServer(DebugCommunication):
10171017
def __init__(
10181018
self, executable=None, port=None, init_commands=[], log_file=None, env=None
10191019
):
@@ -1024,7 +1024,7 @@ def __init__(
10241024
adaptor_env.update(env)
10251025

10261026
if log_file:
1027-
adaptor_env["LLDBVSCODE_LOG"] = log_file
1027+
adaptor_env["LLDBDAP_LOG"] = log_file
10281028
self.process = subprocess.Popen(
10291029
[executable],
10301030
stdin=subprocess.PIPE,
@@ -1048,7 +1048,7 @@ def get_pid(self):
10481048
return -1
10491049

10501050
def terminate(self):
1051-
super(DebugAdaptor, self).terminate()
1051+
super(DebugAdaptorServer, self).terminate()
10521052
if self.process is not None:
10531053
self.process.terminate()
10541054
self.process.wait()
@@ -1364,7 +1364,7 @@ def main():
13641364
"using the --port option"
13651365
)
13661366
return
1367-
dbg = DebugAdaptor(executable=options.vscode_path, port=options.port)
1367+
dbg = DebugAdaptorServer(executable=options.vscode_path, port=options.port)
13681368
if options.debug:
13691369
raw_input('Waiting for debugger to attach pid "%i"' % (dbg.get_pid()))
13701370
if options.replay:

lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py renamed to lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
import os
22
import time
33

4-
import vscode
4+
import dap_server
55
from lldbsuite.test.lldbtest import *
66

77

8-
class VSCodeTestCaseBase(TestBase):
8+
class DAPTestCaseBase(TestBase):
99
NO_DEBUG_INFO_TESTCASE = True
1010

11-
def create_debug_adaptor(self, lldbVSCodeEnv=None):
11+
def create_debug_adaptor(self, lldbDAPEnv=None):
1212
"""Create the Visual Studio Code debug adaptor"""
1313
self.assertTrue(
14-
is_exe(self.lldbVSCodeExec), "lldb-vscode must exist and be executable"
14+
is_exe(self.lldbDAPExec), "lldb-dap must exist and be executable"
1515
)
16-
log_file_path = self.getBuildArtifact("vscode.txt")
17-
self.vscode = vscode.DebugAdaptor(
18-
executable=self.lldbVSCodeExec,
16+
log_file_path = self.getBuildArtifact("dap.txt")
17+
self.dap_server = dap_server.DebugAdaptorServer(
18+
executable=self.lldbDAPExec,
1919
init_commands=self.setUpCommands(),
2020
log_file=log_file_path,
21-
env=lldbVSCodeEnv,
21+
env=lldbDAPEnv,
2222
)
2323

24-
def build_and_create_debug_adaptor(self, lldbVSCodeEnv=None):
24+
def build_and_create_debug_adaptor(self, lldbDAPEnv=None):
2525
self.build()
26-
self.create_debug_adaptor(lldbVSCodeEnv)
26+
self.create_debug_adaptor(lldbDAPEnv)
2727

2828
def set_source_breakpoints(self, source_path, lines, data=None):
2929
"""Sets source breakpoints and returns an array of strings containing
@@ -32,7 +32,7 @@ def set_source_breakpoints(self, source_path, lines, data=None):
3232
Each object in data is 1:1 mapping with the entry in lines.
3333
It contains optional location/hitCondition/logMessage parameters.
3434
"""
35-
response = self.vscode.request_setBreakpoints(source_path, lines, data)
35+
response = self.dap_server.request_setBreakpoints(source_path, lines, data)
3636
if response is None:
3737
return []
3838
breakpoints = response["body"]["breakpoints"]
@@ -46,7 +46,7 @@ def set_function_breakpoints(self, functions, condition=None, hitCondition=None)
4646
and returns an array of strings containing the breakpoint IDs
4747
("1", "2") for each breakpoint that was set.
4848
"""
49-
response = self.vscode.request_setFunctionBreakpoints(
49+
response = self.dap_server.request_setFunctionBreakpoints(
5050
functions, condition=condition, hitCondition=hitCondition
5151
)
5252
if response is None:
@@ -70,7 +70,7 @@ def verify_breakpoint_hit(self, breakpoint_ids):
7070
"breakpoint_ids" should be a list of breakpoint ID strings
7171
(["1", "2"]). The return value from self.set_source_breakpoints()
7272
or self.set_function_breakpoints() can be passed to this function"""
73-
stopped_events = self.vscode.wait_for_stopped()
73+
stopped_events = self.dap_server.wait_for_stopped()
7474
for stopped_event in stopped_events:
7575
if "body" in stopped_event:
7676
body = stopped_event["body"]
@@ -83,7 +83,7 @@ def verify_breakpoint_hit(self, breakpoint_ids):
8383
# Descriptions for breakpoints will be in the form
8484
# "breakpoint 1.1", so look for any description that matches
8585
# ("breakpoint 1.") in the description field as verification
86-
# that one of the breakpoint locations was hit. VSCode doesn't
86+
# that one of the breakpoint locations was hit. DAP doesn't
8787
# allow breakpoints to have multiple locations, but LLDB does.
8888
# So when looking at the description we just want to make sure
8989
# the right breakpoint matches and not worry about the actual
@@ -100,7 +100,7 @@ def verify_stop_exception_info(self, expected_description):
100100
reason is 'exception' and that the description matches
101101
'expected_description'
102102
"""
103-
stopped_events = self.vscode.wait_for_stopped()
103+
stopped_events = self.dap_server.wait_for_stopped()
104104
for stopped_event in stopped_events:
105105
if "body" in stopped_event:
106106
body = stopped_event["body"]
@@ -150,7 +150,7 @@ def get_dict_value(self, d, key_path):
150150
def get_stackFrames_and_totalFramesCount(
151151
self, threadId=None, startFrame=None, levels=None, dump=False
152152
):
153-
response = self.vscode.request_stackTrace(
153+
response = self.dap_server.request_stackTrace(
154154
threadId=threadId, startFrame=startFrame, levels=levels, dump=dump
155155
)
156156
if response:
@@ -185,16 +185,16 @@ def get_source_and_line(self, threadId=None, frameIndex=0):
185185
return ("", 0)
186186

187187
def get_stdout(self, timeout=0.0):
188-
return self.vscode.get_output("stdout", timeout=timeout)
188+
return self.dap_server.get_output("stdout", timeout=timeout)
189189

190190
def get_console(self, timeout=0.0):
191-
return self.vscode.get_output("console", timeout=timeout)
191+
return self.dap_server.get_output("console", timeout=timeout)
192192

193193
def collect_console(self, duration):
194-
return self.vscode.collect_output("console", duration=duration)
194+
return self.dap_server.collect_output("console", duration=duration)
195195

196196
def get_local_as_int(self, name, threadId=None):
197-
value = self.vscode.get_local_variable_value(name, threadId=threadId)
197+
value = self.dap_server.get_local_variable_value(name, threadId=threadId)
198198
if value.startswith("0x"):
199199
return int(value, 16)
200200
elif value.startswith("0"):
@@ -204,48 +204,48 @@ def get_local_as_int(self, name, threadId=None):
204204

205205
def set_local(self, name, value, id=None):
206206
"""Set a top level local variable only."""
207-
return self.vscode.request_setVariable(1, name, str(value), id=id)
207+
return self.dap_server.request_setVariable(1, name, str(value), id=id)
208208

209209
def set_global(self, name, value, id=None):
210210
"""Set a top level global variable only."""
211-
return self.vscode.request_setVariable(2, name, str(value), id=id)
211+
return self.dap_server.request_setVariable(2, name, str(value), id=id)
212212

213213
def stepIn(self, threadId=None, waitForStop=True):
214-
self.vscode.request_stepIn(threadId=threadId)
214+
self.dap_server.request_stepIn(threadId=threadId)
215215
if waitForStop:
216-
return self.vscode.wait_for_stopped()
216+
return self.dap_server.wait_for_stopped()
217217
return None
218218

219219
def stepOver(self, threadId=None, waitForStop=True):
220-
self.vscode.request_next(threadId=threadId)
220+
self.dap_server.request_next(threadId=threadId)
221221
if waitForStop:
222-
return self.vscode.wait_for_stopped()
222+
return self.dap_server.wait_for_stopped()
223223
return None
224224

225225
def stepOut(self, threadId=None, waitForStop=True):
226-
self.vscode.request_stepOut(threadId=threadId)
226+
self.dap_server.request_stepOut(threadId=threadId)
227227
if waitForStop:
228-
return self.vscode.wait_for_stopped()
228+
return self.dap_server.wait_for_stopped()
229229
return None
230230

231231
def continue_to_next_stop(self):
232-
self.vscode.request_continue()
233-
return self.vscode.wait_for_stopped()
232+
self.dap_server.request_continue()
233+
return self.dap_server.wait_for_stopped()
234234

235235
def continue_to_breakpoints(self, breakpoint_ids):
236-
self.vscode.request_continue()
236+
self.dap_server.request_continue()
237237
self.verify_breakpoint_hit(breakpoint_ids)
238238

239239
def continue_to_exception_breakpoint(self, filter_label):
240-
self.vscode.request_continue()
240+
self.dap_server.request_continue()
241241
self.assertTrue(
242242
self.verify_stop_exception_info(filter_label),
243243
'verify we got "%s"' % (filter_label),
244244
)
245245

246246
def continue_to_exit(self, exitCode=0):
247-
self.vscode.request_continue()
248-
stopped_events = self.vscode.wait_for_stopped()
247+
self.dap_server.request_continue()
248+
stopped_events = self.dap_server.wait_for_stopped()
249249
self.assertEquals(
250250
len(stopped_events), 1, "stopped_events = {}".format(stopped_events)
251251
)
@@ -266,10 +266,10 @@ def disassemble(self, threadId=None, frameIndex=None):
266266
memoryReference = stackFrames[0]["instructionPointerReference"]
267267
self.assertIsNotNone(memoryReference)
268268

269-
if memoryReference not in self.vscode.disassembled_instructions:
270-
self.vscode.request_disassemble(memoryReference=memoryReference)
269+
if memoryReference not in self.dap_server.disassembled_instructions:
270+
self.dap_server.request_disassemble(memoryReference=memoryReference)
271271

272-
return self.vscode.disassembled_instructions[memoryReference]
272+
return self.dap_server.disassembled_instructions[memoryReference]
273273

274274
def attach(
275275
self,
@@ -289,22 +289,22 @@ def attach(
289289
sourceMap=None,
290290
sourceInitFile=False,
291291
):
292-
"""Build the default Makefile target, create the VSCode debug adaptor,
292+
"""Build the default Makefile target, create the DAP debug adaptor,
293293
and attach to the process.
294294
"""
295295

296-
# Make sure we disconnect and terminate the VSCode debug adaptor even
296+
# Make sure we disconnect and terminate the DAP debug adaptor even
297297
# if we throw an exception during the test case.
298298
def cleanup():
299299
if disconnectAutomatically:
300-
self.vscode.request_disconnect(terminateDebuggee=True)
301-
self.vscode.terminate()
300+
self.dap_server.request_disconnect(terminateDebuggee=True)
301+
self.dap_server.terminate()
302302

303303
# Execute the cleanup function during test case tear down.
304304
self.addTearDownHook(cleanup)
305305
# Initialize and launch the program
306-
self.vscode.request_initialize(sourceInitFile)
307-
response = self.vscode.request_attach(
306+
self.dap_server.request_initialize(sourceInitFile)
307+
response = self.dap_server.request_attach(
308308
program=program,
309309
pid=pid,
310310
waitFor=waitFor,
@@ -352,21 +352,21 @@ def launch(
352352
enableAutoVariableSummaries=False,
353353
enableSyntheticChildDebugging=False,
354354
):
355-
"""Sending launch request to vscode"""
355+
"""Sending launch request to dap"""
356356

357-
# Make sure we disconnect and terminate the VSCode debug adapter,
357+
# Make sure we disconnect and terminate the DAP debug adapter,
358358
# if we throw an exception during the test case
359359
def cleanup():
360360
if disconnectAutomatically:
361-
self.vscode.request_disconnect(terminateDebuggee=True)
362-
self.vscode.terminate()
361+
self.dap_server.request_disconnect(terminateDebuggee=True)
362+
self.dap_server.terminate()
363363

364364
# Execute the cleanup function during test case tear down.
365365
self.addTearDownHook(cleanup)
366366

367367
# Initialize and launch the program
368-
self.vscode.request_initialize(sourceInitFile)
369-
response = self.vscode.request_launch(
368+
self.dap_server.request_initialize(sourceInitFile)
369+
response = self.dap_server.request_launch(
370370
program,
371371
args=args,
372372
cwd=cwd,
@@ -422,14 +422,14 @@ def build_and_launch(
422422
runInTerminal=False,
423423
disconnectAutomatically=True,
424424
postRunCommands=None,
425-
lldbVSCodeEnv=None,
425+
lldbDAPEnv=None,
426426
enableAutoVariableSummaries=False,
427427
enableSyntheticChildDebugging=False,
428428
):
429-
"""Build the default Makefile target, create the VSCode debug adaptor,
429+
"""Build the default Makefile target, create the DAP debug adaptor,
430430
and launch the process.
431431
"""
432-
self.build_and_create_debug_adaptor(lldbVSCodeEnv)
432+
self.build_and_create_debug_adaptor(lldbDAPEnv)
433433
self.assertTrue(os.path.exists(program), "executable must exist")
434434

435435
return self.launch(

0 commit comments

Comments
 (0)