[lldb] Rename lldb-vscode to lldb-dap (#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/
This commit is contained in:
committed by
GitHub
parent
0446c589af
commit
01263c6c6f
@@ -485,15 +485,15 @@ def setupSysPath():
|
||||
os.environ["LLDB_SRC"] = lldbsuite.lldb_root
|
||||
|
||||
pluginPath = os.path.join(scriptPath, "plugins")
|
||||
toolsLLDBVSCode = os.path.join(scriptPath, "tools", "lldb-vscode")
|
||||
toolsLLDBDAP = os.path.join(scriptPath, "tools", "lldb-dap")
|
||||
toolsLLDBServerPath = os.path.join(scriptPath, "tools", "lldb-server")
|
||||
intelpt = os.path.join(scriptPath, "tools", "intelpt")
|
||||
|
||||
# Insert script dir, plugin dir and lldb-server dir to the sys.path.
|
||||
sys.path.insert(0, pluginPath)
|
||||
# Adding test/tools/lldb-vscode to the path makes it easy to
|
||||
# "import lldb_vscode_testcase" from the VSCode tests
|
||||
sys.path.insert(0, toolsLLDBVSCode)
|
||||
# Adding test/tools/lldb-dap to the path makes it easy to
|
||||
# "import lldb_dap_testcase" from the DAP tests
|
||||
sys.path.insert(0, toolsLLDBDAP)
|
||||
# Adding test/tools/lldb-server to the path makes it easy
|
||||
# to "import lldbgdbserverutils" from the lldb-server tests
|
||||
sys.path.insert(0, toolsLLDBServerPath)
|
||||
@@ -538,15 +538,15 @@ def setupSysPath():
|
||||
|
||||
lldbDir = os.path.dirname(lldbtest_config.lldbExec)
|
||||
|
||||
lldbVSCodeExec = os.path.join(lldbDir, "lldb-vscode")
|
||||
if is_exe(lldbVSCodeExec):
|
||||
os.environ["LLDBVSCODE_EXEC"] = lldbVSCodeExec
|
||||
lldbDAPExec = os.path.join(lldbDir, "lldb-dap")
|
||||
if is_exe(lldbDAPExec):
|
||||
os.environ["LLDBDAP_EXEC"] = lldbDAPExec
|
||||
else:
|
||||
if not configuration.shouldSkipBecauseOfCategories(["lldb-vscode"]):
|
||||
if not configuration.shouldSkipBecauseOfCategories(["lldb-dap"]):
|
||||
print(
|
||||
"The 'lldb-vscode' executable cannot be located. The lldb-vscode tests can not be run as a result."
|
||||
"The 'lldb-dap' executable cannot be located. The lldb-dap tests can not be run as a result."
|
||||
)
|
||||
configuration.skip_categories.append("lldb-vscode")
|
||||
configuration.skip_categories.append("lldb-dap")
|
||||
|
||||
lldbPythonDir = None # The directory that contains 'lldb/__init__.py'
|
||||
|
||||
|
||||
@@ -801,10 +801,10 @@ class Base(unittest2.TestCase):
|
||||
else:
|
||||
self.libcxxPath = None
|
||||
|
||||
if "LLDBVSCODE_EXEC" in os.environ:
|
||||
self.lldbVSCodeExec = os.environ["LLDBVSCODE_EXEC"]
|
||||
if "LLDBDAP_EXEC" in os.environ:
|
||||
self.lldbDAPExec = os.environ["LLDBDAP_EXEC"]
|
||||
else:
|
||||
self.lldbVSCodeExec = None
|
||||
self.lldbDAPExec = None
|
||||
|
||||
self.lldbOption = " ".join("-o '" + s + "'" for s in self.setUpCommands())
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ all_categories = {
|
||||
"libc++": "Test for libc++ data formatters",
|
||||
"libstdcxx": "Test for libstdcxx data formatters",
|
||||
"lldb-server": "Tests related to lldb-server",
|
||||
"lldb-vscode": "Visual Studio Code debug adaptor tests",
|
||||
"lldb-dap": "Tests for the Debug Adaptor Protocol with lldb-dap",
|
||||
"llgs": "Tests for the gdb-server functionality of lldb-server",
|
||||
"objc": "Tests related to the Objective-C programming language support",
|
||||
"pyapi": "Tests related to the Python API",
|
||||
|
||||
@@ -1013,7 +1013,7 @@ class DebugCommunication(object):
|
||||
# self.recv.close()
|
||||
|
||||
|
||||
class DebugAdaptor(DebugCommunication):
|
||||
class DebugAdaptorServer(DebugCommunication):
|
||||
def __init__(
|
||||
self, executable=None, port=None, init_commands=[], log_file=None, env=None
|
||||
):
|
||||
@@ -1024,7 +1024,7 @@ class DebugAdaptor(DebugCommunication):
|
||||
adaptor_env.update(env)
|
||||
|
||||
if log_file:
|
||||
adaptor_env["LLDBVSCODE_LOG"] = log_file
|
||||
adaptor_env["LLDBDAP_LOG"] = log_file
|
||||
self.process = subprocess.Popen(
|
||||
[executable],
|
||||
stdin=subprocess.PIPE,
|
||||
@@ -1048,7 +1048,7 @@ class DebugAdaptor(DebugCommunication):
|
||||
return -1
|
||||
|
||||
def terminate(self):
|
||||
super(DebugAdaptor, self).terminate()
|
||||
super(DebugAdaptorServer, self).terminate()
|
||||
if self.process is not None:
|
||||
self.process.terminate()
|
||||
self.process.wait()
|
||||
@@ -1364,7 +1364,7 @@ def main():
|
||||
"using the --port option"
|
||||
)
|
||||
return
|
||||
dbg = DebugAdaptor(executable=options.vscode_path, port=options.port)
|
||||
dbg = DebugAdaptorServer(executable=options.vscode_path, port=options.port)
|
||||
if options.debug:
|
||||
raw_input('Waiting for debugger to attach pid "%i"' % (dbg.get_pid()))
|
||||
if options.replay:
|
||||
@@ -1,29 +1,29 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.lldbtest import *
|
||||
|
||||
|
||||
class VSCodeTestCaseBase(TestBase):
|
||||
class DAPTestCaseBase(TestBase):
|
||||
NO_DEBUG_INFO_TESTCASE = True
|
||||
|
||||
def create_debug_adaptor(self, lldbVSCodeEnv=None):
|
||||
def create_debug_adaptor(self, lldbDAPEnv=None):
|
||||
"""Create the Visual Studio Code debug adaptor"""
|
||||
self.assertTrue(
|
||||
is_exe(self.lldbVSCodeExec), "lldb-vscode must exist and be executable"
|
||||
is_exe(self.lldbDAPExec), "lldb-dap must exist and be executable"
|
||||
)
|
||||
log_file_path = self.getBuildArtifact("vscode.txt")
|
||||
self.vscode = vscode.DebugAdaptor(
|
||||
executable=self.lldbVSCodeExec,
|
||||
log_file_path = self.getBuildArtifact("dap.txt")
|
||||
self.dap_server = dap_server.DebugAdaptorServer(
|
||||
executable=self.lldbDAPExec,
|
||||
init_commands=self.setUpCommands(),
|
||||
log_file=log_file_path,
|
||||
env=lldbVSCodeEnv,
|
||||
env=lldbDAPEnv,
|
||||
)
|
||||
|
||||
def build_and_create_debug_adaptor(self, lldbVSCodeEnv=None):
|
||||
def build_and_create_debug_adaptor(self, lldbDAPEnv=None):
|
||||
self.build()
|
||||
self.create_debug_adaptor(lldbVSCodeEnv)
|
||||
self.create_debug_adaptor(lldbDAPEnv)
|
||||
|
||||
def set_source_breakpoints(self, source_path, lines, data=None):
|
||||
"""Sets source breakpoints and returns an array of strings containing
|
||||
@@ -32,7 +32,7 @@ class VSCodeTestCaseBase(TestBase):
|
||||
Each object in data is 1:1 mapping with the entry in lines.
|
||||
It contains optional location/hitCondition/logMessage parameters.
|
||||
"""
|
||||
response = self.vscode.request_setBreakpoints(source_path, lines, data)
|
||||
response = self.dap_server.request_setBreakpoints(source_path, lines, data)
|
||||
if response is None:
|
||||
return []
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
@@ -46,7 +46,7 @@ class VSCodeTestCaseBase(TestBase):
|
||||
and returns an array of strings containing the breakpoint IDs
|
||||
("1", "2") for each breakpoint that was set.
|
||||
"""
|
||||
response = self.vscode.request_setFunctionBreakpoints(
|
||||
response = self.dap_server.request_setFunctionBreakpoints(
|
||||
functions, condition=condition, hitCondition=hitCondition
|
||||
)
|
||||
if response is None:
|
||||
@@ -70,7 +70,7 @@ class VSCodeTestCaseBase(TestBase):
|
||||
"breakpoint_ids" should be a list of breakpoint ID strings
|
||||
(["1", "2"]). The return value from self.set_source_breakpoints()
|
||||
or self.set_function_breakpoints() can be passed to this function"""
|
||||
stopped_events = self.vscode.wait_for_stopped()
|
||||
stopped_events = self.dap_server.wait_for_stopped()
|
||||
for stopped_event in stopped_events:
|
||||
if "body" in stopped_event:
|
||||
body = stopped_event["body"]
|
||||
@@ -83,7 +83,7 @@ class VSCodeTestCaseBase(TestBase):
|
||||
# Descriptions for breakpoints will be in the form
|
||||
# "breakpoint 1.1", so look for any description that matches
|
||||
# ("breakpoint 1.") in the description field as verification
|
||||
# that one of the breakpoint locations was hit. VSCode doesn't
|
||||
# that one of the breakpoint locations was hit. DAP doesn't
|
||||
# allow breakpoints to have multiple locations, but LLDB does.
|
||||
# So when looking at the description we just want to make sure
|
||||
# the right breakpoint matches and not worry about the actual
|
||||
@@ -100,7 +100,7 @@ class VSCodeTestCaseBase(TestBase):
|
||||
reason is 'exception' and that the description matches
|
||||
'expected_description'
|
||||
"""
|
||||
stopped_events = self.vscode.wait_for_stopped()
|
||||
stopped_events = self.dap_server.wait_for_stopped()
|
||||
for stopped_event in stopped_events:
|
||||
if "body" in stopped_event:
|
||||
body = stopped_event["body"]
|
||||
@@ -150,7 +150,7 @@ class VSCodeTestCaseBase(TestBase):
|
||||
def get_stackFrames_and_totalFramesCount(
|
||||
self, threadId=None, startFrame=None, levels=None, dump=False
|
||||
):
|
||||
response = self.vscode.request_stackTrace(
|
||||
response = self.dap_server.request_stackTrace(
|
||||
threadId=threadId, startFrame=startFrame, levels=levels, dump=dump
|
||||
)
|
||||
if response:
|
||||
@@ -185,16 +185,16 @@ class VSCodeTestCaseBase(TestBase):
|
||||
return ("", 0)
|
||||
|
||||
def get_stdout(self, timeout=0.0):
|
||||
return self.vscode.get_output("stdout", timeout=timeout)
|
||||
return self.dap_server.get_output("stdout", timeout=timeout)
|
||||
|
||||
def get_console(self, timeout=0.0):
|
||||
return self.vscode.get_output("console", timeout=timeout)
|
||||
return self.dap_server.get_output("console", timeout=timeout)
|
||||
|
||||
def collect_console(self, duration):
|
||||
return self.vscode.collect_output("console", duration=duration)
|
||||
return self.dap_server.collect_output("console", duration=duration)
|
||||
|
||||
def get_local_as_int(self, name, threadId=None):
|
||||
value = self.vscode.get_local_variable_value(name, threadId=threadId)
|
||||
value = self.dap_server.get_local_variable_value(name, threadId=threadId)
|
||||
if value.startswith("0x"):
|
||||
return int(value, 16)
|
||||
elif value.startswith("0"):
|
||||
@@ -204,48 +204,48 @@ class VSCodeTestCaseBase(TestBase):
|
||||
|
||||
def set_local(self, name, value, id=None):
|
||||
"""Set a top level local variable only."""
|
||||
return self.vscode.request_setVariable(1, name, str(value), id=id)
|
||||
return self.dap_server.request_setVariable(1, name, str(value), id=id)
|
||||
|
||||
def set_global(self, name, value, id=None):
|
||||
"""Set a top level global variable only."""
|
||||
return self.vscode.request_setVariable(2, name, str(value), id=id)
|
||||
return self.dap_server.request_setVariable(2, name, str(value), id=id)
|
||||
|
||||
def stepIn(self, threadId=None, waitForStop=True):
|
||||
self.vscode.request_stepIn(threadId=threadId)
|
||||
self.dap_server.request_stepIn(threadId=threadId)
|
||||
if waitForStop:
|
||||
return self.vscode.wait_for_stopped()
|
||||
return self.dap_server.wait_for_stopped()
|
||||
return None
|
||||
|
||||
def stepOver(self, threadId=None, waitForStop=True):
|
||||
self.vscode.request_next(threadId=threadId)
|
||||
self.dap_server.request_next(threadId=threadId)
|
||||
if waitForStop:
|
||||
return self.vscode.wait_for_stopped()
|
||||
return self.dap_server.wait_for_stopped()
|
||||
return None
|
||||
|
||||
def stepOut(self, threadId=None, waitForStop=True):
|
||||
self.vscode.request_stepOut(threadId=threadId)
|
||||
self.dap_server.request_stepOut(threadId=threadId)
|
||||
if waitForStop:
|
||||
return self.vscode.wait_for_stopped()
|
||||
return self.dap_server.wait_for_stopped()
|
||||
return None
|
||||
|
||||
def continue_to_next_stop(self):
|
||||
self.vscode.request_continue()
|
||||
return self.vscode.wait_for_stopped()
|
||||
self.dap_server.request_continue()
|
||||
return self.dap_server.wait_for_stopped()
|
||||
|
||||
def continue_to_breakpoints(self, breakpoint_ids):
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.verify_breakpoint_hit(breakpoint_ids)
|
||||
|
||||
def continue_to_exception_breakpoint(self, filter_label):
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.assertTrue(
|
||||
self.verify_stop_exception_info(filter_label),
|
||||
'verify we got "%s"' % (filter_label),
|
||||
)
|
||||
|
||||
def continue_to_exit(self, exitCode=0):
|
||||
self.vscode.request_continue()
|
||||
stopped_events = self.vscode.wait_for_stopped()
|
||||
self.dap_server.request_continue()
|
||||
stopped_events = self.dap_server.wait_for_stopped()
|
||||
self.assertEquals(
|
||||
len(stopped_events), 1, "stopped_events = {}".format(stopped_events)
|
||||
)
|
||||
@@ -266,10 +266,10 @@ class VSCodeTestCaseBase(TestBase):
|
||||
memoryReference = stackFrames[0]["instructionPointerReference"]
|
||||
self.assertIsNotNone(memoryReference)
|
||||
|
||||
if memoryReference not in self.vscode.disassembled_instructions:
|
||||
self.vscode.request_disassemble(memoryReference=memoryReference)
|
||||
if memoryReference not in self.dap_server.disassembled_instructions:
|
||||
self.dap_server.request_disassemble(memoryReference=memoryReference)
|
||||
|
||||
return self.vscode.disassembled_instructions[memoryReference]
|
||||
return self.dap_server.disassembled_instructions[memoryReference]
|
||||
|
||||
def attach(
|
||||
self,
|
||||
@@ -289,22 +289,22 @@ class VSCodeTestCaseBase(TestBase):
|
||||
sourceMap=None,
|
||||
sourceInitFile=False,
|
||||
):
|
||||
"""Build the default Makefile target, create the VSCode debug adaptor,
|
||||
"""Build the default Makefile target, create the DAP debug adaptor,
|
||||
and attach to the process.
|
||||
"""
|
||||
|
||||
# Make sure we disconnect and terminate the VSCode debug adaptor even
|
||||
# Make sure we disconnect and terminate the DAP debug adaptor even
|
||||
# if we throw an exception during the test case.
|
||||
def cleanup():
|
||||
if disconnectAutomatically:
|
||||
self.vscode.request_disconnect(terminateDebuggee=True)
|
||||
self.vscode.terminate()
|
||||
self.dap_server.request_disconnect(terminateDebuggee=True)
|
||||
self.dap_server.terminate()
|
||||
|
||||
# Execute the cleanup function during test case tear down.
|
||||
self.addTearDownHook(cleanup)
|
||||
# Initialize and launch the program
|
||||
self.vscode.request_initialize(sourceInitFile)
|
||||
response = self.vscode.request_attach(
|
||||
self.dap_server.request_initialize(sourceInitFile)
|
||||
response = self.dap_server.request_attach(
|
||||
program=program,
|
||||
pid=pid,
|
||||
waitFor=waitFor,
|
||||
@@ -352,21 +352,21 @@ class VSCodeTestCaseBase(TestBase):
|
||||
enableAutoVariableSummaries=False,
|
||||
enableSyntheticChildDebugging=False,
|
||||
):
|
||||
"""Sending launch request to vscode"""
|
||||
"""Sending launch request to dap"""
|
||||
|
||||
# Make sure we disconnect and terminate the VSCode debug adapter,
|
||||
# Make sure we disconnect and terminate the DAP debug adapter,
|
||||
# if we throw an exception during the test case
|
||||
def cleanup():
|
||||
if disconnectAutomatically:
|
||||
self.vscode.request_disconnect(terminateDebuggee=True)
|
||||
self.vscode.terminate()
|
||||
self.dap_server.request_disconnect(terminateDebuggee=True)
|
||||
self.dap_server.terminate()
|
||||
|
||||
# Execute the cleanup function during test case tear down.
|
||||
self.addTearDownHook(cleanup)
|
||||
|
||||
# Initialize and launch the program
|
||||
self.vscode.request_initialize(sourceInitFile)
|
||||
response = self.vscode.request_launch(
|
||||
self.dap_server.request_initialize(sourceInitFile)
|
||||
response = self.dap_server.request_launch(
|
||||
program,
|
||||
args=args,
|
||||
cwd=cwd,
|
||||
@@ -422,14 +422,14 @@ class VSCodeTestCaseBase(TestBase):
|
||||
runInTerminal=False,
|
||||
disconnectAutomatically=True,
|
||||
postRunCommands=None,
|
||||
lldbVSCodeEnv=None,
|
||||
lldbDAPEnv=None,
|
||||
enableAutoVariableSummaries=False,
|
||||
enableSyntheticChildDebugging=False,
|
||||
):
|
||||
"""Build the default Makefile target, create the VSCode debug adaptor,
|
||||
"""Build the default Makefile target, create the DAP debug adaptor,
|
||||
and launch the process.
|
||||
"""
|
||||
self.build_and_create_debug_adaptor(lldbVSCodeEnv)
|
||||
self.build_and_create_debug_adaptor(lldbDAPEnv)
|
||||
self.assertTrue(os.path.exists(program), "executable must exist")
|
||||
|
||||
return self.launch(
|
||||
@@ -1,13 +1,13 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
@@ -25,7 +25,7 @@ def spawn_and_wait(program, delay):
|
||||
process.wait()
|
||||
|
||||
|
||||
class TestVSCode_attach(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_attach(lldbdap_testcase.DAPTestCaseBase):
|
||||
def set_and_hit_breakpoint(self, continueToExit=True):
|
||||
source = "main.c"
|
||||
breakpoint1_line = line_number(source, "// breakpoint 1")
|
||||
@@ -190,10 +190,10 @@ class TestVSCode_attach(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# Continue after launch and hit the "pause()" call and stop the target.
|
||||
# Get output from the console. This should contain both the
|
||||
# "stopCommands" that were run after we stop.
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
time.sleep(0.5)
|
||||
self.vscode.request_pause()
|
||||
self.vscode.wait_for_stopped()
|
||||
self.dap_server.request_pause()
|
||||
self.dap_server.wait_for_stopped()
|
||||
output = self.get_console(timeout=1.0)
|
||||
self.verify_commands("stopCommands", output, stopCommands)
|
||||
|
||||
@@ -236,6 +236,6 @@ class TestVSCode_attach(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.get_console()
|
||||
# Once it's disconnected the console should contain the
|
||||
# "terminateCommands"
|
||||
self.vscode.request_disconnect(terminateDebuggee=True)
|
||||
self.dap_server.request_disconnect(terminateDebuggee=True)
|
||||
output = self.collect_console(duration=1.0)
|
||||
self.verify_commands("terminateCommands", output, terminateCommands)
|
||||
@@ -1,17 +1,17 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_breakpointEvents(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_breakpointEvents(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipUnlessDarwin
|
||||
@expectedFailureAll(macos_version=[">=", "13.0"])
|
||||
@@ -48,7 +48,7 @@ class TestVSCode_breakpointEvents(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Set a breakpoint after creating the target by running a command line
|
||||
# command. It will eventually resolve and cause a breakpoint changed
|
||||
# event to be sent to lldb-vscode. We want to make sure we don't send a
|
||||
# event to be sent to lldb-dap. We want to make sure we don't send a
|
||||
# breakpoint any breakpoints that were set from the command line.
|
||||
# Breakpoints that are set via the VS code DAP packets will be
|
||||
# registered and marked with a special keyword to ensure we deliver
|
||||
@@ -59,24 +59,28 @@ class TestVSCode_breakpointEvents(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
main_bp_id = 0
|
||||
foo_bp_id = 0
|
||||
# Set breakpoints and verify that they got set correctly
|
||||
vscode_breakpoint_ids = []
|
||||
response = self.vscode.request_setBreakpoints(main_source_path, [main_bp_line])
|
||||
dap_breakpoint_ids = []
|
||||
response = self.dap_server.request_setBreakpoints(
|
||||
main_source_path, [main_bp_line]
|
||||
)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
for breakpoint in breakpoints:
|
||||
main_bp_id = breakpoint["id"]
|
||||
vscode_breakpoint_ids.append("%i" % (main_bp_id))
|
||||
dap_breakpoint_ids.append("%i" % (main_bp_id))
|
||||
# line = breakpoint['line']
|
||||
self.assertTrue(
|
||||
breakpoint["verified"], "expect main breakpoint to be verified"
|
||||
)
|
||||
|
||||
response = self.vscode.request_setBreakpoints(foo_source_path, [foo_bp1_line])
|
||||
response = self.dap_server.request_setBreakpoints(
|
||||
foo_source_path, [foo_bp1_line]
|
||||
)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
for breakpoint in breakpoints:
|
||||
foo_bp_id = breakpoint["id"]
|
||||
vscode_breakpoint_ids.append("%i" % (foo_bp_id))
|
||||
dap_breakpoint_ids.append("%i" % (foo_bp_id))
|
||||
self.assertFalse(
|
||||
breakpoint["verified"], "expect foo breakpoint to not be verified"
|
||||
)
|
||||
@@ -88,21 +92,23 @@ class TestVSCode_breakpointEvents(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# libraries are not loaded yet (at least on macOS they aren't) and any
|
||||
# breakpoints set in foo.cpp should not be resolved.
|
||||
self.assertEqual(
|
||||
len(self.vscode.breakpoint_events),
|
||||
len(self.dap_server.breakpoint_events),
|
||||
0,
|
||||
"no breakpoint events when stopped at entry point",
|
||||
)
|
||||
|
||||
# Continue to the breakpoint
|
||||
self.continue_to_breakpoints(vscode_breakpoint_ids)
|
||||
self.continue_to_breakpoints(dap_breakpoint_ids)
|
||||
|
||||
# Make sure we only get an event for the breakpoint we set via a call
|
||||
# to self.vscode.request_setBreakpoints(...), not the breakpoint
|
||||
# to self.dap_server.request_setBreakpoints(...), not the breakpoint
|
||||
# we set with with a LLDB command in preRunCommands.
|
||||
self.assertEqual(
|
||||
len(self.vscode.breakpoint_events), 1, "make sure we got a breakpoint event"
|
||||
len(self.dap_server.breakpoint_events),
|
||||
1,
|
||||
"make sure we got a breakpoint event",
|
||||
)
|
||||
event = self.vscode.breakpoint_events[0]
|
||||
event = self.dap_server.breakpoint_events[0]
|
||||
# Verify the details of the breakpoint changed notification.
|
||||
body = event["body"]
|
||||
self.assertEqual(
|
||||
@@ -7,5 +7,5 @@ static void unique_function_name() {
|
||||
int foo(int x) {
|
||||
// foo breakpoint 1
|
||||
unique_function_name();
|
||||
return x+42;
|
||||
return x + 42;
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
"""
|
||||
Test lldb-vscode logpoints feature.
|
||||
Test lldb-dap logpoints feature.
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
import shutil
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_logpoints(lldbdap_testcase.DAPTestCaseBase):
|
||||
def setUp(self):
|
||||
lldbvscode_testcase.VSCodeTestCaseBase.setUp(self)
|
||||
lldbdap_testcase.DAPTestCaseBase.setUp(self)
|
||||
|
||||
self.main_basename = "main-copy.cpp"
|
||||
self.main_path = os.path.realpath(self.getBuildArtifact(self.main_basename))
|
||||
@@ -36,7 +36,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
self.assertEquals(len(before_loop_breakpoint_ids), 1, "expect one breakpoint")
|
||||
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint before loop line
|
||||
self.verify_breakpoint_hit(before_loop_breakpoint_ids)
|
||||
@@ -56,7 +56,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Continue to trigger the breakpoint with log messages
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint after loop line
|
||||
self.verify_breakpoint_hit([post_loop_breakpoint_id])
|
||||
@@ -94,7 +94,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
self.assertEquals(len(before_loop_breakpoint_ids), 1, "expect one breakpoint")
|
||||
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint before loop line
|
||||
self.verify_breakpoint_hit(before_loop_breakpoint_ids)
|
||||
@@ -117,7 +117,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Continue to trigger the breakpoint with log messages
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint after loop line
|
||||
self.verify_breakpoint_hit([post_loop_breakpoint_id])
|
||||
@@ -157,7 +157,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
self.assertEquals(len(before_loop_breakpoint_ids), 1, "expect one breakpoint")
|
||||
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint before loop line
|
||||
self.verify_breakpoint_hit(before_loop_breakpoint_ids)
|
||||
@@ -179,7 +179,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Continue to trigger the breakpoint with log messages
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint after loop line
|
||||
self.verify_breakpoint_hit([post_loop_breakpoint_id])
|
||||
@@ -222,7 +222,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
self.assertEquals(len(before_loop_breakpoint_ids), 1, "expect one breakpoint")
|
||||
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint before loop line
|
||||
self.verify_breakpoint_hit(before_loop_breakpoint_ids)
|
||||
@@ -244,7 +244,7 @@ class TestVSCode_logpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Continue to trigger the breakpoint with log messages
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit logpoint breakpoint if it's format has error.
|
||||
self.verify_breakpoint_hit([loop_breakpoint_id])
|
||||
@@ -1,20 +1,20 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
import shutil
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_setBreakpoints(lldbdap_testcase.DAPTestCaseBase):
|
||||
def setUp(self):
|
||||
lldbvscode_testcase.VSCodeTestCaseBase.setUp(self)
|
||||
lldbdap_testcase.DAPTestCaseBase.setUp(self)
|
||||
|
||||
self.main_basename = "main-copy.cpp"
|
||||
self.main_path = os.path.realpath(self.getBuildArtifact(self.main_basename))
|
||||
@@ -58,7 +58,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.launch(program, sourceMap=source_map)
|
||||
|
||||
# breakpoint in main.cpp
|
||||
response = self.vscode.request_setBreakpoints(new_main_path, [main_line])
|
||||
response = self.dap_server.request_setBreakpoints(new_main_path, [main_line])
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(len(breakpoints), 1)
|
||||
breakpoint = breakpoints[0]
|
||||
@@ -68,7 +68,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertEqual(new_main_path, breakpoint["source"]["path"])
|
||||
|
||||
# 2nd breakpoint, which is from a dynamically loaded library
|
||||
response = self.vscode.request_setBreakpoints(new_other_path, [other_line])
|
||||
response = self.dap_server.request_setBreakpoints(new_other_path, [other_line])
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
breakpoint = breakpoints[0]
|
||||
self.assertEqual(breakpoint["line"], other_line)
|
||||
@@ -77,11 +77,11 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertEqual(new_other_path, breakpoint["source"]["path"])
|
||||
other_breakpoint_id = breakpoint["id"]
|
||||
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.verify_breakpoint_hit([other_breakpoint_id])
|
||||
|
||||
# 2nd breakpoint again, which should be valid at this point
|
||||
response = self.vscode.request_setBreakpoints(new_other_path, [other_line])
|
||||
response = self.dap_server.request_setBreakpoints(new_other_path, [other_line])
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
breakpoint = breakpoints[0]
|
||||
self.assertEqual(breakpoint["line"], other_line)
|
||||
@@ -90,7 +90,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertEqual(new_other_path, breakpoint["source"]["path"])
|
||||
|
||||
# now we check the stack trace making sure that we got mapped source paths
|
||||
frames = self.vscode.request_stackTrace()["body"]["stackFrames"]
|
||||
frames = self.dap_server.request_stackTrace()["body"]["stackFrames"]
|
||||
|
||||
self.assertEqual(frames[0]["source"]["name"], other_basename)
|
||||
self.assertEqual(frames[0]["source"]["path"], new_other_path)
|
||||
@@ -125,7 +125,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.build_and_launch(program)
|
||||
|
||||
# Set 3 breakpoints and verify that they got set correctly
|
||||
response = self.vscode.request_setBreakpoints(self.main_path, lines)
|
||||
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
|
||||
line_to_id = {}
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
@@ -152,7 +152,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
lines.remove(second_line)
|
||||
# Set 2 breakpoints and verify that the previous breakpoints that were
|
||||
# set above are still set.
|
||||
response = self.vscode.request_setBreakpoints(self.main_path, lines)
|
||||
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -179,7 +179,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# we have only 2 breakpoints set. The response above could have told
|
||||
# us about 2 breakpoints, but we want to make sure we don't have the
|
||||
# third one still set in the target
|
||||
response = self.vscode.request_testGetTargetBreakpoints()
|
||||
response = self.dap_server.request_testGetTargetBreakpoints()
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -204,7 +204,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# Now clear all breakpoints for the source file by passing down an
|
||||
# empty lines array
|
||||
lines = []
|
||||
response = self.vscode.request_setBreakpoints(self.main_path, lines)
|
||||
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -214,7 +214,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Verify with the target that all breakpoints have been cleared
|
||||
response = self.vscode.request_testGetTargetBreakpoints()
|
||||
response = self.dap_server.request_testGetTargetBreakpoints()
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -226,7 +226,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# Now set a breakpoint again in the same source file and verify it
|
||||
# was added.
|
||||
lines = [second_line]
|
||||
response = self.vscode.request_setBreakpoints(self.main_path, lines)
|
||||
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -245,7 +245,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# we have only 2 breakpoints set. The response above could have told
|
||||
# us about 2 breakpoints, but we want to make sure we don't have the
|
||||
# third one still set in the target
|
||||
response = self.vscode.request_testGetTargetBreakpoints()
|
||||
response = self.dap_server.request_testGetTargetBreakpoints()
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -278,7 +278,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.build_and_launch(program)
|
||||
|
||||
# Set one breakpoint and verify that it got set correctly.
|
||||
response = self.vscode.request_setBreakpoints(self.main_path, lines)
|
||||
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
|
||||
line_to_id = {}
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -295,12 +295,12 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# Now clear all breakpoints for the source file by not setting the
|
||||
# lines array.
|
||||
lines = None
|
||||
response = self.vscode.request_setBreakpoints(self.main_path, lines)
|
||||
response = self.dap_server.request_setBreakpoints(self.main_path, lines)
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(len(breakpoints), 0, "expect no source breakpoints")
|
||||
|
||||
# Verify with the target that all breakpoints have been cleared.
|
||||
response = self.vscode.request_testGetTargetBreakpoints()
|
||||
response = self.dap_server.request_testGetTargetBreakpoints()
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(len(breakpoints), 0, "expect no source breakpoints")
|
||||
|
||||
@@ -317,13 +317,13 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# hitCondition
|
||||
breakpoint_ids = self.set_source_breakpoints(self.main_path, [loop_line])
|
||||
self.assertEquals(len(breakpoint_ids), 1, "expect one breakpoint")
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
|
||||
# Verify we hit the breakpoint we just set
|
||||
self.verify_breakpoint_hit(breakpoint_ids)
|
||||
|
||||
# Make sure i is zero at first breakpoint
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 0, "i != 0 after hitting breakpoint")
|
||||
|
||||
# Update the condition on our breakpoint
|
||||
@@ -337,7 +337,7 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 4, "i != 4 showing conditional works")
|
||||
|
||||
new_breakpoint_ids = self.set_source_breakpoints(
|
||||
@@ -352,11 +352,11 @@ class TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Continue with a hitCondition of 2 and expect it to skip 1 value
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 6, "i != 6 showing hitCondition works")
|
||||
|
||||
# continue after hitting our hitCondition and make sure it only goes
|
||||
# up by 1
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 7, "i != 7 showing post hitCondition hits every time")
|
||||
@@ -1,16 +1,16 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_setExceptionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_setExceptionBreakpoints(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_functionality(self):
|
||||
@@ -34,7 +34,7 @@ class TestVSCode_setExceptionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase)
|
||||
self.build_and_launch(program)
|
||||
|
||||
filters = ["cpp_throw", "cpp_catch"]
|
||||
response = self.vscode.request_setExceptionBreakpoints(filters)
|
||||
response = self.dap_server.request_setExceptionBreakpoints(filters)
|
||||
if response:
|
||||
self.assertTrue(response["success"])
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_setFunctionBreakpoints(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_set_and_clear(self):
|
||||
@@ -34,7 +34,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
bp_id_12 = None
|
||||
functions = ["twelve"]
|
||||
# Set a function breakpoint at 'twelve'
|
||||
response = self.vscode.request_setFunctionBreakpoints(functions)
|
||||
response = self.dap_server.request_setFunctionBreakpoints(functions)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -48,7 +48,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Add an extra name and make sure we have two breakpoints after this
|
||||
functions.append("thirteen")
|
||||
response = self.vscode.request_setFunctionBreakpoints(functions)
|
||||
response = self.dap_server.request_setFunctionBreakpoints(functions)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -62,7 +62,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# There is no breakpoint delete packet, clients just send another
|
||||
# setFunctionBreakpoints packet with the different function names.
|
||||
functions.remove("thirteen")
|
||||
response = self.vscode.request_setFunctionBreakpoints(functions)
|
||||
response = self.dap_server.request_setFunctionBreakpoints(functions)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -83,7 +83,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# we have only 1 breakpoints set. The response above could have told
|
||||
# us about 1 breakpoints, but we want to make sure we don't have the
|
||||
# second one still set in the target
|
||||
response = self.vscode.request_testGetTargetBreakpoints()
|
||||
response = self.dap_server.request_testGetTargetBreakpoints()
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -103,7 +103,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# Now clear all breakpoints for the source file by passing down an
|
||||
# empty lines array
|
||||
functions = []
|
||||
response = self.vscode.request_setFunctionBreakpoints(functions)
|
||||
response = self.dap_server.request_setFunctionBreakpoints(functions)
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -113,7 +113,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Verify with the target that all breakpoints have been cleared
|
||||
response = self.vscode.request_testGetTargetBreakpoints()
|
||||
response = self.dap_server.request_testGetTargetBreakpoints()
|
||||
if response:
|
||||
breakpoints = response["body"]["breakpoints"]
|
||||
self.assertEquals(
|
||||
@@ -140,7 +140,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
# Make sure i is zero at first breakpoint
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 0, "i != 0 after hitting breakpoint")
|
||||
|
||||
# Update the condition on our breakpoint
|
||||
@@ -152,7 +152,7 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 4, "i != 4 showing conditional works")
|
||||
new_breakpoint_ids = self.set_function_breakpoints(functions, hitCondition="2")
|
||||
|
||||
@@ -164,11 +164,11 @@ class TestVSCode_setFunctionBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Continue with a hitCondition of 2 and expect it to skip 1 value
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 6, "i != 6 showing hitCondition works")
|
||||
|
||||
# continue after hitting our hitCondition and make sure it only goes
|
||||
# up by 1
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
i = int(self.vscode.get_local_variable_value("i"))
|
||||
i = int(self.dap_server.get_local_variable_value("i"))
|
||||
self.assertEquals(i, 7, "i != 7 showing post hitCondition hits every time")
|
||||
@@ -11,10 +11,10 @@ int thirteen(int i) {
|
||||
}
|
||||
|
||||
namespace a {
|
||||
int fourteen(int i) {
|
||||
return 14 + i; // break 14
|
||||
}
|
||||
int fourteen(int i) {
|
||||
return 14 + i; // break 14
|
||||
}
|
||||
} // namespace a
|
||||
int main(int argc, char const *argv[]) {
|
||||
#if defined(__APPLE__)
|
||||
const char *libother_name = "libother.dylib";
|
||||
@@ -35,11 +35,11 @@ int main(int argc, char const *argv[]) {
|
||||
}
|
||||
foo(12); // before loop
|
||||
|
||||
for (int i=0; i<10; ++i) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
int x = twelve(i) + thirteen(i) + a::fourteen(i); // break loop
|
||||
}
|
||||
try {
|
||||
throw std::invalid_argument( "throwing exception for testing" );
|
||||
throw std::invalid_argument("throwing exception for testing");
|
||||
} catch (...) {
|
||||
puts("caught exception...");
|
||||
}
|
||||
1
lldb/test/API/tools/lldb-dap/categories
Normal file
1
lldb/test/API/tools/lldb-dap/categories
Normal file
@@ -0,0 +1 @@
|
||||
lldb-dap
|
||||
@@ -1,16 +1,16 @@
|
||||
"""
|
||||
Test lldb-vscode completions request
|
||||
Test lldb-dap completions request
|
||||
"""
|
||||
|
||||
|
||||
import lldbvscode_testcase
|
||||
import vscode
|
||||
import lldbdap_testcase
|
||||
import dap_server
|
||||
from lldbsuite.test import lldbutil
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
|
||||
|
||||
class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_completions(lldbdap_testcase.DAPTestCaseBase):
|
||||
def verify_completions(self, actual_list, expected_list, not_expected_list=[]):
|
||||
for expected_item in expected_list:
|
||||
self.assertIn(expected_item, actual_list)
|
||||
@@ -36,7 +36,7 @@ class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# shouldn't see variables inside main
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("var"),
|
||||
self.dap_server.get_completions("var"),
|
||||
[
|
||||
{
|
||||
"text": "var",
|
||||
@@ -54,7 +54,7 @@ class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# should see global keywords but not variables inside main
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("str"),
|
||||
self.dap_server.get_completions("str"),
|
||||
[{"text": "struct", "label": "struct"}],
|
||||
[{"text": "str1", "label": "str1 -- std::string &"}],
|
||||
)
|
||||
@@ -63,7 +63,7 @@ class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# should see variables from main but not from the other function
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("var"),
|
||||
self.dap_server.get_completions("var"),
|
||||
[
|
||||
{"text": "var1", "label": "var1 -- int &"},
|
||||
{"text": "var2", "label": "var2 -- int &"},
|
||||
@@ -77,7 +77,7 @@ class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("str"),
|
||||
self.dap_server.get_completions("str"),
|
||||
[
|
||||
{"text": "struct", "label": "struct"},
|
||||
{"text": "str1", "label": "str1 -- string &"},
|
||||
@@ -86,19 +86,19 @@ class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# should complete arbitrary commands including word starts
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("`log enable "),
|
||||
self.dap_server.get_completions("`log enable "),
|
||||
[{"text": "gdb-remote", "label": "gdb-remote"}],
|
||||
)
|
||||
|
||||
# should complete expressions with quotes inside
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions('`expr " "; typed'),
|
||||
self.dap_server.get_completions('`expr " "; typed'),
|
||||
[{"text": "typedef", "label": "typedef"}],
|
||||
)
|
||||
|
||||
# should complete an incomplete quoted token
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions('`setting "se'),
|
||||
self.dap_server.get_completions('`setting "se'),
|
||||
[
|
||||
{
|
||||
"text": "set",
|
||||
@@ -107,7 +107,7 @@ class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
],
|
||||
)
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("`'comm"),
|
||||
self.dap_server.get_completions("`'comm"),
|
||||
[
|
||||
{
|
||||
"text": "command",
|
||||
@@ -117,34 +117,34 @@ class TestVSCode_completions(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("foo1.v"),
|
||||
self.dap_server.get_completions("foo1.v"),
|
||||
[{"text": "var1", "label": "foo1.var1 -- int"}],
|
||||
)
|
||||
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("foo1.my_bar_object.v"),
|
||||
self.dap_server.get_completions("foo1.my_bar_object.v"),
|
||||
[{"text": "var1", "label": "foo1.my_bar_object.var1 -- int"}],
|
||||
)
|
||||
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("foo1.var1 + foo1.v"),
|
||||
self.dap_server.get_completions("foo1.var1 + foo1.v"),
|
||||
[{"text": "var1", "label": "foo1.var1 -- int"}],
|
||||
)
|
||||
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("foo1.var1 + v"),
|
||||
self.dap_server.get_completions("foo1.var1 + v"),
|
||||
[{"text": "var1", "label": "var1 -- int &"}],
|
||||
)
|
||||
|
||||
# should correctly handle spaces between objects and member operators
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("foo1 .v"),
|
||||
self.dap_server.get_completions("foo1 .v"),
|
||||
[{"text": "var1", "label": ".var1 -- int"}],
|
||||
[{"text": "var2", "label": ".var2 -- int"}],
|
||||
)
|
||||
|
||||
self.verify_completions(
|
||||
self.vscode.get_completions("foo1 . v"),
|
||||
self.dap_server.get_completions("foo1 . v"),
|
||||
[{"text": "var1", "label": "var1 -- int"}],
|
||||
[{"text": "var2", "label": "var2 -- int"}],
|
||||
)
|
||||
@@ -7,9 +7,9 @@ struct bar {
|
||||
|
||||
struct foo {
|
||||
int var1;
|
||||
bar* my_bar_pointer;
|
||||
bar *my_bar_pointer;
|
||||
bar my_bar_object;
|
||||
foo* next_foo;
|
||||
foo *next_foo;
|
||||
};
|
||||
|
||||
struct baz {
|
||||
@@ -28,7 +28,7 @@ int main(int argc, char const *argv[]) {
|
||||
std::vector<baz> vec;
|
||||
fun(vec);
|
||||
bar bar1 = {2};
|
||||
bar* bar2 = &bar1;
|
||||
foo foo1 = {3,&bar1, bar1, NULL};
|
||||
bar *bar2 = &bar1;
|
||||
foo foo1 = {3, &bar1, bar1, NULL};
|
||||
return 0; // breakpoint 2
|
||||
}
|
||||
@@ -1,17 +1,19 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_console(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_console(lldbdap_testcase.DAPTestCaseBase):
|
||||
def check_lldb_command(self, lldb_command, contains_string, assert_msg):
|
||||
response = self.vscode.request_evaluate("`%s" % (lldb_command), context="repl")
|
||||
response = self.dap_server.request_evaluate(
|
||||
"`%s" % (lldb_command), context="repl"
|
||||
)
|
||||
output = response["body"]["result"]
|
||||
self.assertIn(
|
||||
contains_string,
|
||||
@@ -29,8 +31,8 @@ class TestVSCode_console(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
"""
|
||||
Tests that the "scopes" request causes the currently selected
|
||||
thread and frame to be updated. There are no DAP packets that tell
|
||||
lldb-vscode which thread and frame are selected other than the
|
||||
"scopes" request. lldb-vscode will now select the thread and frame
|
||||
lldb-dap which thread and frame are selected other than the
|
||||
"scopes" request. lldb-dap will now select the thread and frame
|
||||
for the latest "scopes" request that it receives.
|
||||
|
||||
The LLDB command interpreter needs to have the right thread and
|
||||
@@ -52,7 +54,7 @@ class TestVSCode_console(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
# Cause a "scopes" to be sent for frame zero which should update the
|
||||
# selected thread and frame to frame 0.
|
||||
self.vscode.get_local_variables(frameIndex=0)
|
||||
self.dap_server.get_local_variables(frameIndex=0)
|
||||
# Verify frame #0 is selected in the command interpreter by running
|
||||
# the "frame select" command with no frame index which will print the
|
||||
# currently selected frame.
|
||||
@@ -60,7 +62,7 @@ class TestVSCode_console(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Cause a "scopes" to be sent for frame one which should update the
|
||||
# selected thread and frame to frame 1.
|
||||
self.vscode.get_local_variables(frameIndex=1)
|
||||
self.dap_server.get_local_variables(frameIndex=1)
|
||||
# Verify frame #1 is selected in the command interpreter by running
|
||||
# the "frame select" command with no frame index which will print the
|
||||
# currently selected frame.
|
||||
@@ -1,12 +1,12 @@
|
||||
import vscode
|
||||
import dap_server
|
||||
import json
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_redirection_to_console(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_redirection_to_console(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test(self):
|
||||
@@ -14,11 +14,11 @@ class TestVSCode_redirection_to_console(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
Without proper stderr and stdout redirection, the following code would throw an
|
||||
exception, like the following:
|
||||
|
||||
Exception: unexpected malformed message from lldb-vscode
|
||||
Exception: unexpected malformed message from lldb-dap
|
||||
"""
|
||||
program = self.getBuildArtifact("a.out")
|
||||
self.build_and_launch(
|
||||
program, lldbVSCodeEnv={"LLDB_VSCODE_TEST_STDOUT_STDERR_REDIRECTION": ""}
|
||||
program, lldbDAPEnv={"LLDB_DAP_TEST_STDOUT_STDERR_REDIRECTION": ""}
|
||||
)
|
||||
|
||||
source = "main.cpp"
|
||||
@@ -29,4 +29,6 @@ class TestVSCode_redirection_to_console(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertEqual(len(breakpoint_ids), 1, "expect correct number of breakpoints")
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
self.assertIn("argc", json.dumps(self.vscode.get_local_variables(frameIndex=1)))
|
||||
self.assertIn(
|
||||
"argc", json.dumps(self.dap_server.get_local_variables(frameIndex=1))
|
||||
)
|
||||
@@ -1,17 +1,17 @@
|
||||
"""
|
||||
Test lldb-vscode coreFile attaching
|
||||
Test lldb-dap coreFile attaching
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_coreFile(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_coreFile(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
@skipIfLLVMTargetMissing("X86")
|
||||
@@ -53,7 +53,7 @@ class TestVSCode_coreFile(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_next_stop()
|
||||
self.assertEquals(self.get_stackFrames(), expected_frames)
|
||||
|
||||
self.vscode.request_next(threadId=32259)
|
||||
self.dap_server.request_next(threadId=32259)
|
||||
self.assertEquals(self.get_stackFrames(), expected_frames)
|
||||
|
||||
@skipIfWindows
|
||||
@@ -1,15 +1,15 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_correct_thread(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_correct_thread(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_correct_thread(self):
|
||||
@@ -33,8 +33,8 @@ class TestVSCode_correct_thread(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# We're now stopped at the breakpoint in the first thread, thread #2.
|
||||
# Continue to join the first thread and hit the breakpoint in the
|
||||
# second thread, thread #3.
|
||||
self.vscode.request_continue()
|
||||
stopped_event = self.vscode.wait_for_stopped()
|
||||
self.dap_server.request_continue()
|
||||
stopped_event = self.dap_server.wait_for_stopped()
|
||||
# Verify that the description is the relevant breakpoint,
|
||||
# preserveFocusHint is False and threadCausedFocus is True
|
||||
self.assertTrue(
|
||||
@@ -3,14 +3,12 @@
|
||||
|
||||
int state_var;
|
||||
|
||||
void *thread (void *in)
|
||||
{
|
||||
void *thread(void *in) {
|
||||
state_var++; // break here
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int main(int argc, char **argv) {
|
||||
pthread_t t1, t2;
|
||||
|
||||
pthread_create(&t1, NULL, *thread, NULL);
|
||||
@@ -1,17 +1,17 @@
|
||||
"""
|
||||
Test lldb-vscode disassemble request
|
||||
Test lldb-dap disassemble request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_disassemble(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_disassemble(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_disassemble(self):
|
||||
30
lldb/test/API/tools/lldb-dap/disassemble/main.c
Normal file
30
lldb/test/API/tools/lldb-dap/disassemble/main.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int compare_ints(const void *a, const void *b) {
|
||||
int arg1 = *(const int *)a;
|
||||
int arg2 = *(const int *)b;
|
||||
|
||||
// breakpoint 1
|
||||
|
||||
if (arg1 < arg2)
|
||||
return -1;
|
||||
if (arg1 > arg2)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int ints[] = {-2, 99, 0, -743, 2, INT_MIN, 4};
|
||||
int size = sizeof ints / sizeof *ints;
|
||||
|
||||
qsort(ints, size, sizeof(int), compare_ints);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
printf("%d ", ints[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
"""
|
||||
Test lldb-vscode disconnect request
|
||||
Test lldb-dap disconnect request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import subprocess
|
||||
import time
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_launch(lldbdap_testcase.DAPTestCaseBase):
|
||||
source = "main.cpp"
|
||||
|
||||
def disconnect_and_assert_no_output_printed(self):
|
||||
self.vscode.request_disconnect()
|
||||
self.dap_server.request_disconnect()
|
||||
# verify we didn't get any input after disconnect
|
||||
time.sleep(2)
|
||||
output = self.get_stdout()
|
||||
@@ -40,7 +40,7 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
self.continue_to_next_stop()
|
||||
|
||||
self.vscode.request_disconnect()
|
||||
self.dap_server.request_disconnect()
|
||||
# verify we didn't produce the side effect file
|
||||
time.sleep(1)
|
||||
self.assertFalse(os.path.exists(program + ".side_effect"))
|
||||
@@ -69,13 +69,13 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
lldbutil.wait_for_file_on_target(self, sync_file_path)
|
||||
|
||||
self.attach(pid=self.process.pid, disconnectAutomatically=False)
|
||||
response = self.vscode.request_evaluate("wait_for_attach = false;")
|
||||
response = self.dap_server.request_evaluate("wait_for_attach = false;")
|
||||
self.assertTrue(response["success"])
|
||||
|
||||
# verify we haven't produced the side effect file yet
|
||||
self.assertFalse(os.path.exists(program + ".side_effect"))
|
||||
|
||||
self.vscode.request_disconnect()
|
||||
self.dap_server.request_disconnect()
|
||||
time.sleep(2)
|
||||
# verify we produced the side effect file, as the program continued after disconnecting
|
||||
self.assertTrue(os.path.exists(program + ".side_effect"))
|
||||
@@ -1,19 +1,19 @@
|
||||
"""
|
||||
Test lldb-vscode completions request
|
||||
Test lldb-dap completions request
|
||||
"""
|
||||
|
||||
|
||||
import lldbvscode_testcase
|
||||
import vscode
|
||||
import lldbdap_testcase
|
||||
import dap_server
|
||||
from lldbsuite.test import lldbutil
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
|
||||
|
||||
class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
|
||||
def assertEvaluate(self, expression, regex):
|
||||
self.assertRegexpMatches(
|
||||
self.vscode.request_evaluate(expression, context=self.context)["body"][
|
||||
self.dap_server.request_evaluate(expression, context=self.context)["body"][
|
||||
"result"
|
||||
],
|
||||
regex,
|
||||
@@ -22,7 +22,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
def assertEvaluateFailure(self, expression):
|
||||
self.assertNotIn(
|
||||
"result",
|
||||
self.vscode.request_evaluate(expression, context=self.context)["body"],
|
||||
self.dap_server.request_evaluate(expression, context=self.context)["body"],
|
||||
)
|
||||
|
||||
def isExpressionParsedExpected(self):
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "foo.h"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
static int static_int = 42;
|
||||
|
||||
@@ -43,7 +43,7 @@ int main(int argc, char const *argv[]) {
|
||||
std::vector<bool> my_bool_vec;
|
||||
my_bool_vec.push_back(true);
|
||||
my_bool_vec.push_back(false); // breakpoint 6
|
||||
my_bool_vec.push_back(true); // breakpoint 7
|
||||
my_bool_vec.push_back(true); // breakpoint 7
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
"""
|
||||
Test exception behavior in VSCode
|
||||
Test exception behavior in DAP
|
||||
"""
|
||||
|
||||
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_exception(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_exception(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
def test_stopped_description(self):
|
||||
"""
|
||||
@@ -19,5 +19,5 @@ class TestVSCode_exception(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
print("test_stopped_description called", flush=True)
|
||||
self.build_and_launch(program)
|
||||
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.assertTrue(self.verify_stop_exception_info("signal SIGABRT"))
|
||||
@@ -1,18 +1,18 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import time
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_launch(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_default(self):
|
||||
@@ -33,22 +33,22 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
@skipIfRemote
|
||||
def test_termination(self):
|
||||
"""
|
||||
Tests the correct termination of lldb-vscode upon a 'disconnect'
|
||||
Tests the correct termination of lldb-dap upon a 'disconnect'
|
||||
request.
|
||||
"""
|
||||
self.create_debug_adaptor()
|
||||
# The underlying lldb-vscode process must be alive
|
||||
self.assertEqual(self.vscode.process.poll(), None)
|
||||
# The underlying lldb-dap process must be alive
|
||||
self.assertEqual(self.dap_server.process.poll(), None)
|
||||
|
||||
# The lldb-vscode process should finish even though
|
||||
# The lldb-dap process should finish even though
|
||||
# we didn't close the communication socket explicitly
|
||||
self.vscode.request_disconnect()
|
||||
self.dap_server.request_disconnect()
|
||||
|
||||
# Wait until the underlying lldb-vscode process dies.
|
||||
self.vscode.process.wait(timeout=10)
|
||||
# Wait until the underlying lldb-dap process dies.
|
||||
self.dap_server.process.wait(timeout=10)
|
||||
|
||||
# Check the return code
|
||||
self.assertEqual(self.vscode.process.poll(), 0)
|
||||
self.assertEqual(self.dap_server.process.poll(), 0)
|
||||
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
@@ -102,7 +102,7 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
def test_debuggerRoot(self):
|
||||
"""
|
||||
Tests the "debuggerRoot" will change the working directory of
|
||||
the lldb-vscode debug adaptor.
|
||||
the lldb-dap debug adaptor.
|
||||
"""
|
||||
program = self.getBuildArtifact("a.out")
|
||||
program_parent_dir = os.path.realpath(os.path.dirname(os.path.dirname(program)))
|
||||
@@ -121,10 +121,10 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertEquals(
|
||||
program_parent_dir,
|
||||
line[len(prefix) :],
|
||||
"lldb-vscode working dir '%s' == '%s'"
|
||||
"lldb-dap working dir '%s' == '%s'"
|
||||
% (program_parent_dir, line[6:]),
|
||||
)
|
||||
self.assertTrue(found, "verified lldb-vscode working directory")
|
||||
self.assertTrue(found, "verified lldb-dap working directory")
|
||||
self.continue_to_exit()
|
||||
|
||||
@skipIfWindows
|
||||
@@ -148,7 +148,7 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertEquals(
|
||||
quoted_path,
|
||||
line[len(prefix) :],
|
||||
"lldb-vscode working dir %s == %s" % (quoted_path, line[6:]),
|
||||
"lldb-dap working dir %s == %s" % (quoted_path, line[6:]),
|
||||
)
|
||||
self.assertTrue(found, 'found "sourcePath" in console output')
|
||||
self.continue_to_exit()
|
||||
@@ -440,6 +440,6 @@ class TestVSCode_launch(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.get_console()
|
||||
# Once it's disconnected the console should contain the
|
||||
# "terminateCommands"
|
||||
self.vscode.request_disconnect(terminateDebuggee=True)
|
||||
self.dap_server.request_disconnect(terminateDebuggee=True)
|
||||
output = self.collect_console(duration=1.0)
|
||||
self.verify_commands("terminateCommands", output, terminateCommands)
|
||||
@@ -3,13 +3,13 @@
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char const *argv[], char const *envp[]) {
|
||||
for (int i=0; i<argc; ++i)
|
||||
for (int i = 0; i < argc; ++i)
|
||||
printf("arg[%i] = \"%s\"\n", i, argv[i]);
|
||||
for (int i=0; envp[i]; ++i)
|
||||
for (int i = 0; envp[i]; ++i)
|
||||
printf("env[%i] = \"%s\"\n", i, envp[i]);
|
||||
char *cwd = getcwd(NULL, 0);
|
||||
printf("cwd = \"%s\"\n", cwd); // breakpoint 1
|
||||
free(cwd);
|
||||
cwd = NULL;
|
||||
return 0; // breakpoint 2
|
||||
return 0; // breakpoint 2
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import re
|
||||
|
||||
|
||||
class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_module(lldbdap_testcase.DAPTestCaseBase):
|
||||
def run_test(self, symbol_basename, expect_debug_info_size):
|
||||
program_basename = "a.out.stripped"
|
||||
program = self.getBuildArtifact(program_basename)
|
||||
@@ -19,7 +19,7 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
breakpoint_ids = self.set_function_breakpoints(functions)
|
||||
self.assertEquals(len(breakpoint_ids), len(functions), "expect one breakpoint")
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
active_modules = self.vscode.get_modules()
|
||||
active_modules = self.dap_server.get_modules()
|
||||
program_module = active_modules[program_basename]
|
||||
self.assertIn(
|
||||
program_basename,
|
||||
@@ -36,13 +36,13 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
"Make sure a.out.stripped has no debug info",
|
||||
)
|
||||
symbols_path = self.getBuildArtifact(symbol_basename)
|
||||
self.vscode.request_evaluate(
|
||||
self.dap_server.request_evaluate(
|
||||
"`%s" % ('target symbols add -s "%s" "%s"' % (program, symbols_path)),
|
||||
context="repl",
|
||||
)
|
||||
|
||||
def checkSymbolsLoadedWithSize():
|
||||
active_modules = self.vscode.get_modules()
|
||||
active_modules = self.dap_server.get_modules()
|
||||
program_module = active_modules[program_basename]
|
||||
self.assertIn("symbolFilePath", program_module)
|
||||
self.assertIn(symbols_path, program_module["symbolFilePath"])
|
||||
@@ -51,7 +51,7 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
if expect_debug_info_size:
|
||||
self.waitUntil(checkSymbolsLoadedWithSize)
|
||||
active_modules = self.vscode.get_modules()
|
||||
active_modules = self.dap_server.get_modules()
|
||||
program_module = active_modules[program_basename]
|
||||
self.assertEqual(program_basename, program_module["name"])
|
||||
self.assertEqual(program, program_module["path"])
|
||||
@@ -95,8 +95,8 @@ class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
lines = [breakpoint1_line]
|
||||
breakpoint_ids = self.set_source_breakpoints(source, lines)
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
moduleId = self.vscode.get_modules()["a.out"]["id"]
|
||||
response = self.vscode.request_compileUnits(moduleId)
|
||||
moduleId = self.dap_server.get_modules()["a.out"]["id"]
|
||||
response = self.dap_server.request_compileUnits(moduleId)
|
||||
self.assertTrue(response["body"])
|
||||
cu_paths = [cu["compileUnitPath"] for cu in response["body"]["compileUnits"]]
|
||||
self.assertIn(main_source_path, cu_paths, "Real path to main.cpp matches")
|
||||
1
lldb/test/API/tools/lldb-dap/module/foo.cpp
Normal file
1
lldb/test/API/tools/lldb-dap/module/foo.cpp
Normal file
@@ -0,0 +1 @@
|
||||
int foo() { return 12; }
|
||||
@@ -1,15 +1,15 @@
|
||||
"""
|
||||
Test lldb-vscode variables/stackTrace request for optimized code
|
||||
Test lldb-dap variables/stackTrace request for optimized code
|
||||
"""
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_optimized(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_optimized(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_stack_frame_name(self):
|
||||
@@ -24,9 +24,9 @@ class TestVSCode_optimized(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
len(breakpoint_ids), len(lines), "expect correct number of breakpoints"
|
||||
)
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
leaf_frame = self.vscode.get_stackFrame(frameIndex=0)
|
||||
leaf_frame = self.dap_server.get_stackFrame(frameIndex=0)
|
||||
self.assertTrue(leaf_frame["name"].endswith(" [opt]"))
|
||||
parent_frame = self.vscode.get_stackFrame(frameIndex=1)
|
||||
parent_frame = self.dap_server.get_stackFrame(frameIndex=1)
|
||||
self.assertTrue(parent_frame["name"].endswith(" [opt]"))
|
||||
|
||||
@skipIfWindows
|
||||
@@ -44,6 +44,6 @@ class TestVSCode_optimized(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
len(breakpoint_ids), len(lines), "expect correct number of breakpoints"
|
||||
)
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
optimized_variable = self.vscode.get_local_variable("argc")
|
||||
optimized_variable = self.dap_server.get_local_variable("argc")
|
||||
|
||||
self.assertTrue(optimized_variable["value"].startswith("<error:"))
|
||||
@@ -1,13 +1,13 @@
|
||||
"""
|
||||
Test lldb-vscode RestartRequest.
|
||||
Test lldb-dap RestartRequest.
|
||||
"""
|
||||
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import line_number
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_restart(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_restart(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_basic_functionality(self):
|
||||
@@ -23,23 +23,23 @@ class TestVSCode_restart(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
[bp_A, bp_B] = self.set_source_breakpoints("main.c", [line_A, line_B])
|
||||
|
||||
# Verify we hit A, then B.
|
||||
self.vscode.request_configurationDone()
|
||||
self.dap_server.request_configurationDone()
|
||||
self.verify_breakpoint_hit([bp_A])
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.verify_breakpoint_hit([bp_B])
|
||||
|
||||
# Make sure i has been modified from its initial value of 0.
|
||||
self.assertEquals(
|
||||
int(self.vscode.get_local_variable_value("i")),
|
||||
int(self.dap_server.get_local_variable_value("i")),
|
||||
1234,
|
||||
"i != 1234 after hitting breakpoint B",
|
||||
)
|
||||
|
||||
# Restart then check we stop back at A and program state has been reset.
|
||||
self.vscode.request_restart()
|
||||
self.dap_server.request_restart()
|
||||
self.verify_breakpoint_hit([bp_A])
|
||||
self.assertEquals(
|
||||
int(self.vscode.get_local_variable_value("i")),
|
||||
int(self.dap_server.get_local_variable_value("i")),
|
||||
0,
|
||||
"i != 0 after hitting breakpoint A on restart",
|
||||
)
|
||||
@@ -53,11 +53,11 @@ class TestVSCode_restart(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
program = self.getBuildArtifact("a.out")
|
||||
self.build_and_launch(program, stopOnEntry=True)
|
||||
[bp_main] = self.set_function_breakpoints(["main"])
|
||||
self.vscode.request_configurationDone()
|
||||
self.dap_server.request_configurationDone()
|
||||
|
||||
# Once the "configuration done" event is sent, we should get a stopped
|
||||
# event immediately because of stopOnEntry.
|
||||
stopped_events = self.vscode.wait_for_stopped()
|
||||
stopped_events = self.dap_server.wait_for_stopped()
|
||||
for stopped_event in stopped_events:
|
||||
if "body" in stopped_event:
|
||||
body = stopped_event["body"]
|
||||
@@ -68,13 +68,13 @@ class TestVSCode_restart(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Then, if we continue, we should hit the breakpoint at main.
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.verify_breakpoint_hit([bp_main])
|
||||
|
||||
# Restart and check that we still get a stopped event before reaching
|
||||
# main.
|
||||
self.vscode.request_restart()
|
||||
stopped_events = self.vscode.wait_for_stopped()
|
||||
self.dap_server.request_restart()
|
||||
stopped_events = self.dap_server.wait_for_stopped()
|
||||
for stopped_event in stopped_events:
|
||||
if "body" in stopped_event:
|
||||
body = stopped_event["body"]
|
||||
@@ -90,7 +90,7 @@ class TestVSCode_restart(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
@skipIfRemote
|
||||
def test_arguments(self):
|
||||
"""
|
||||
Tests that lldb-vscode will use updated launch arguments included
|
||||
Tests that lldb-dap will use updated launch arguments included
|
||||
with a restart request.
|
||||
"""
|
||||
line_A = line_number("main.c", "// breakpoint A")
|
||||
@@ -100,20 +100,20 @@ class TestVSCode_restart(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
[bp_A] = self.set_source_breakpoints("main.c", [line_A])
|
||||
|
||||
# Verify we hit A, then B.
|
||||
self.vscode.request_configurationDone()
|
||||
self.dap_server.request_configurationDone()
|
||||
self.verify_breakpoint_hit([bp_A])
|
||||
|
||||
# We don't set any arguments in the initial launch request, so argc
|
||||
# should be 1.
|
||||
self.assertEquals(
|
||||
int(self.vscode.get_local_variable_value("argc")),
|
||||
int(self.dap_server.get_local_variable_value("argc")),
|
||||
1,
|
||||
"argc != 1 before restart",
|
||||
)
|
||||
|
||||
# Restart with some extra 'args' and check that the new argc reflects
|
||||
# the updated launch config.
|
||||
self.vscode.request_restart(
|
||||
self.dap_server.request_restart(
|
||||
restartArguments={
|
||||
"arguments": {
|
||||
"program": program,
|
||||
@@ -123,7 +123,7 @@ class TestVSCode_restart(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
self.verify_breakpoint_hit([bp_A])
|
||||
self.assertEquals(
|
||||
int(self.vscode.get_local_variable_value("argc")),
|
||||
int(self.dap_server.get_local_variable_value("argc")),
|
||||
5,
|
||||
"argc != 5 after restart",
|
||||
)
|
||||
@@ -1,22 +1,22 @@
|
||||
"""
|
||||
Test lldb-vscode RestartRequest.
|
||||
Test lldb-dap RestartRequest.
|
||||
"""
|
||||
|
||||
import os
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import line_number
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_restart_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_restart_runInTerminal(lldbdap_testcase.DAPTestCaseBase):
|
||||
def isTestSupported(self):
|
||||
try:
|
||||
# We skip this test for debug builds because it takes too long
|
||||
# parsing lldb's own debug info. Release builds are fine.
|
||||
# Checking the size of the lldb-vscode binary seems to be a decent
|
||||
# Checking the size of the lldb-dap binary seems to be a decent
|
||||
# proxy for a quick detection. It should be far less than 1 MB in
|
||||
# Release builds.
|
||||
return os.path.getsize(os.environ["LLDBVSCODE_EXEC"]) < 1000000
|
||||
return os.path.getsize(os.environ["LLDBDAP_EXEC"]) < 1000000
|
||||
except:
|
||||
return False
|
||||
|
||||
@@ -38,25 +38,25 @@ class TestVSCode_restart_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
[bp_A, bp_B] = self.set_source_breakpoints("main.c", [line_A, line_B])
|
||||
|
||||
# Verify we hit A, then B.
|
||||
self.vscode.request_configurationDone()
|
||||
self.dap_server.request_configurationDone()
|
||||
self.verify_breakpoint_hit([bp_A])
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.verify_breakpoint_hit([bp_B])
|
||||
|
||||
# Make sure i has been modified from its initial value of 0.
|
||||
self.assertEquals(
|
||||
int(self.vscode.get_local_variable_value("i")),
|
||||
int(self.dap_server.get_local_variable_value("i")),
|
||||
1234,
|
||||
"i != 1234 after hitting breakpoint B",
|
||||
)
|
||||
|
||||
# Restart.
|
||||
self.vscode.request_restart()
|
||||
self.dap_server.request_restart()
|
||||
|
||||
# Finally, check we stop back at A and program state has been reset.
|
||||
self.verify_breakpoint_hit([bp_A])
|
||||
self.assertEquals(
|
||||
int(self.vscode.get_local_variable_value("i")),
|
||||
int(self.dap_server.get_local_variable_value("i")),
|
||||
0,
|
||||
"i != 0 after hitting breakpoint A on restart",
|
||||
)
|
||||
@@ -76,11 +76,11 @@ class TestVSCode_restart_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
program = self.getBuildArtifact("a.out")
|
||||
self.build_and_launch(program, runInTerminal=True, stopOnEntry=True)
|
||||
[bp_main] = self.set_function_breakpoints(["main"])
|
||||
self.vscode.request_configurationDone()
|
||||
self.dap_server.request_configurationDone()
|
||||
|
||||
# When using stopOnEntry, configurationDone doesn't result in a running
|
||||
# process, we should immediately get a stopped event instead.
|
||||
stopped_events = self.vscode.wait_for_stopped()
|
||||
stopped_events = self.dap_server.wait_for_stopped()
|
||||
# We should be stopped at the entry point.
|
||||
for stopped_event in stopped_events:
|
||||
if "body" in stopped_event:
|
||||
@@ -92,13 +92,13 @@ class TestVSCode_restart_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Then, if we continue, we should hit the breakpoint at main.
|
||||
self.vscode.request_continue()
|
||||
self.dap_server.request_continue()
|
||||
self.verify_breakpoint_hit([bp_main])
|
||||
|
||||
# Restart and check that we still get a stopped event before reaching
|
||||
# main.
|
||||
self.vscode.request_restart()
|
||||
stopped_events = self.vscode.wait_for_stopped()
|
||||
self.dap_server.request_restart()
|
||||
stopped_events = self.dap_server.wait_for_stopped()
|
||||
for stopped_event in stopped_events:
|
||||
if "body" in stopped_event:
|
||||
body = stopped_event["body"]
|
||||
@@ -5,5 +5,5 @@ int main(int argc, char const *argv[], char const *envp[]) {
|
||||
printf("Do something\n"); // breakpoint A
|
||||
printf("Do something else\n");
|
||||
i = 1234;
|
||||
return 0; // breakpoint B
|
||||
return 0; // breakpoint B
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
"""
|
||||
Test lldb-vscode runInTerminal reverse request
|
||||
Test lldb-dap runInTerminal reverse request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import time
|
||||
import os
|
||||
import subprocess
|
||||
@@ -16,7 +16,7 @@ import json
|
||||
from threading import Thread
|
||||
|
||||
|
||||
class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_runInTerminal(lldbdap_testcase.DAPTestCaseBase):
|
||||
def readPidMessage(self, fifo_file):
|
||||
with open(fifo_file, "r") as file:
|
||||
self.assertIn("pid", file.readline())
|
||||
@@ -36,9 +36,9 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
try:
|
||||
# We skip this test for debug builds because it takes too long parsing lldb's own
|
||||
# debug info. Release builds are fine.
|
||||
# Checking the size of the lldb-vscode binary seems to be a decent proxy for a quick
|
||||
# Checking the size of the lldb-dap binary seems to be a decent proxy for a quick
|
||||
# detection. It should be far less than 1 MB in Release builds.
|
||||
if os.path.getsize(os.environ["LLDBVSCODE_EXEC"]) < 1000000:
|
||||
if os.path.getsize(os.environ["LLDBDAP_EXEC"]) < 1000000:
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
@@ -60,11 +60,13 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
len(self.vscode.reverse_requests), 1, "make sure we got a reverse request"
|
||||
len(self.dap_server.reverse_requests),
|
||||
1,
|
||||
"make sure we got a reverse request",
|
||||
)
|
||||
|
||||
request = self.vscode.reverse_requests[0]
|
||||
self.assertIn(self.lldbVSCodeExec, request["arguments"]["args"])
|
||||
request = self.dap_server.reverse_requests[0]
|
||||
self.assertIn(self.lldbDAPExec, request["arguments"]["args"])
|
||||
self.assertIn(program, request["arguments"]["args"])
|
||||
self.assertIn("foobar", request["arguments"]["args"])
|
||||
self.assertIn("FOO", request["arguments"]["env"])
|
||||
@@ -75,18 +77,18 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_next_stop()
|
||||
|
||||
# We verify we actually stopped inside the loop
|
||||
counter = int(self.vscode.get_local_variable_value("counter"))
|
||||
counter = int(self.dap_server.get_local_variable_value("counter"))
|
||||
self.assertTrue(counter > 0)
|
||||
|
||||
# We verify we were able to set the launch arguments
|
||||
argc = int(self.vscode.get_local_variable_value("argc"))
|
||||
argc = int(self.dap_server.get_local_variable_value("argc"))
|
||||
self.assertEqual(argc, 2)
|
||||
|
||||
argv1 = self.vscode.request_evaluate("argv[1]")["body"]["result"]
|
||||
argv1 = self.dap_server.request_evaluate("argv[1]")["body"]["result"]
|
||||
self.assertIn("foobar", argv1)
|
||||
|
||||
# We verify we were able to set the environment
|
||||
env = self.vscode.request_evaluate("foo")["body"]["result"]
|
||||
env = self.dap_server.request_evaluate("foo")["body"]["result"]
|
||||
self.assertIn("bar", env)
|
||||
|
||||
@skipIfWindows
|
||||
@@ -116,7 +118,7 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
if not self.isTestSupported():
|
||||
return
|
||||
proc = subprocess.run(
|
||||
[self.lldbVSCodeExec, "--launch-target", "INVALIDPROGRAM"],
|
||||
[self.lldbDAPExec, "--launch-target", "INVALIDPROGRAM"],
|
||||
capture_output=True,
|
||||
universal_newlines=True,
|
||||
)
|
||||
@@ -136,7 +138,7 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
proc = subprocess.Popen(
|
||||
[
|
||||
self.lldbVSCodeExec,
|
||||
self.lldbDAPExec,
|
||||
"--comm-file",
|
||||
comm_file,
|
||||
"--launch-target",
|
||||
@@ -164,7 +166,7 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
proc = subprocess.Popen(
|
||||
[
|
||||
self.lldbVSCodeExec,
|
||||
self.lldbDAPExec,
|
||||
"--comm-file",
|
||||
comm_file,
|
||||
"--launch-target",
|
||||
@@ -191,7 +193,7 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
os.mkfifo(comm_file)
|
||||
|
||||
proc = subprocess.Popen(
|
||||
[self.lldbVSCodeExec, "--comm-file", comm_file, "--launch-target", "env"],
|
||||
[self.lldbDAPExec, "--comm-file", comm_file, "--launch-target", "env"],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
env={**os.environ, "FOO": "BAR"},
|
||||
@@ -214,7 +216,7 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
proc = subprocess.Popen(
|
||||
[
|
||||
self.lldbVSCodeExec,
|
||||
self.lldbDAPExec,
|
||||
"--comm-file",
|
||||
comm_file,
|
||||
"--launch-target",
|
||||
@@ -223,7 +225,7 @@ class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
],
|
||||
universal_newlines=True,
|
||||
stderr=subprocess.PIPE,
|
||||
env={**os.environ, "LLDB_VSCODE_RIT_TIMEOUT_IN_MS": "1000"},
|
||||
env={**os.environ, "LLDB_DAP_RIT_TIMEOUT_IN_MS": "1000"},
|
||||
)
|
||||
|
||||
self.readPidMessage(comm_file)
|
||||
@@ -1,17 +1,17 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import os
|
||||
|
||||
|
||||
class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_stackTrace(lldbdap_testcase.DAPTestCaseBase):
|
||||
name_key_path = ["name"]
|
||||
source_key_path = ["source", "path"]
|
||||
line_key_path = ["line"]
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
int recurse(int x) {
|
||||
if (x <= 1)
|
||||
return 1; // recurse end
|
||||
return recurse(x-1) + x; // recurse call
|
||||
return 1; // recurse end
|
||||
return recurse(x - 1) + x; // recurse call
|
||||
}
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
@@ -1,17 +1,17 @@
|
||||
"""
|
||||
Test lldb-vscode stack trace response
|
||||
Test lldb-dap stack trace response
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
import os
|
||||
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
from lldbsuite.test import lldbtest, lldbutil
|
||||
|
||||
|
||||
class TestVSCode_stackTraceMissingFunctionName(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_stackTraceMissingFunctionName(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_missingFunctionName(self):
|
||||
@@ -1,16 +1,16 @@
|
||||
"""
|
||||
Test lldb-vscode startDebugging reverse request
|
||||
Test lldb-dap startDebugging reverse request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_startDebugging(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_startDebugging(lldbdap_testcase.DAPTestCaseBase):
|
||||
def test_startDebugging(self):
|
||||
"""
|
||||
Tests the "startDebugging" reverse request. It makes sure that the IDE can
|
||||
@@ -24,16 +24,18 @@ class TestVSCode_startDebugging(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
self.set_source_breakpoints(source, [breakpoint_line])
|
||||
self.continue_to_next_stop()
|
||||
self.vscode.request_evaluate(
|
||||
"`lldb-vscode startDebugging attach '{\"pid\":321}'", context="repl"
|
||||
self.dap_server.request_evaluate(
|
||||
"`lldb-dap startDebugging attach '{\"pid\":321}'", context="repl"
|
||||
)
|
||||
|
||||
self.continue_to_exit()
|
||||
|
||||
self.assertEqual(
|
||||
len(self.vscode.reverse_requests), 1, "make sure we got a reverse request"
|
||||
len(self.dap_server.reverse_requests),
|
||||
1,
|
||||
"make sure we got a reverse request",
|
||||
)
|
||||
|
||||
request = self.vscode.reverse_requests[0]
|
||||
request = self.dap_server.reverse_requests[0]
|
||||
self.assertEqual(request["arguments"]["configuration"]["pid"], 321)
|
||||
self.assertEqual(request["arguments"]["request"], "attach")
|
||||
@@ -1,16 +1,16 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_step(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_step(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_step(self):
|
||||
@@ -29,7 +29,7 @@ class TestVSCode_step(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
len(breakpoint_ids), len(lines), "expect correct number of breakpoints"
|
||||
)
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
threads = self.vscode.get_threads()
|
||||
threads = self.dap_server.get_threads()
|
||||
for thread in threads:
|
||||
if "reason" in thread:
|
||||
reason = thread["reason"]
|
||||
8
lldb/test/API/tools/lldb-dap/step/main.cpp
Normal file
8
lldb/test/API/tools/lldb-dap/step/main.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
int function(int x) {
|
||||
if ((x % 2) == 0)
|
||||
return function(x - 1) + x; // breakpoint 1
|
||||
else
|
||||
return x;
|
||||
}
|
||||
|
||||
int main(int argc, char const *argv[]) { return function(2); }
|
||||
@@ -5,14 +5,14 @@ Test stop hooks
|
||||
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
|
||||
|
||||
class TestVSCode_stop_hooks(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_stop_hooks(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfRemote
|
||||
def test_stop_hooks_before_run(self):
|
||||
"""
|
||||
Test that there is no race condition between lldb-vscode and
|
||||
Test that there is no race condition between lldb-dap and
|
||||
stop hooks executor
|
||||
"""
|
||||
program = self.getBuildArtifact("a.out")
|
||||
@@ -24,9 +24,9 @@ class TestVSCode_stop_hooks(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
breakpoint_ids = self.set_function_breakpoints(["main"])
|
||||
# This request hangs if the race happens, because, in that case, the
|
||||
# command interpreter is in synchronous mode while lldb-vscode expects
|
||||
# command interpreter is in synchronous mode while lldb-dap expects
|
||||
# it to be in asynchronous mode, so, the process doesn't send the stop
|
||||
# event to "lldb.Debugger" listener (which is monitored by lldb-vscode).
|
||||
# event to "lldb.Debugger" listener (which is monitored by lldb-dap).
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
self.continue_to_exit()
|
||||
@@ -1,17 +1,17 @@
|
||||
"""
|
||||
Test lldb-vscode terminated event
|
||||
Test lldb-dap terminated event
|
||||
"""
|
||||
|
||||
import vscode
|
||||
import dap_server
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
from lldbsuite.test import lldbutil
|
||||
import lldbvscode_testcase
|
||||
import lldbdap_testcase
|
||||
import re
|
||||
import json
|
||||
|
||||
|
||||
class TestVSCode_terminatedEvent(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_terminatedEvent(lldbdap_testcase.DAPTestCaseBase):
|
||||
@skipIfWindows
|
||||
@skipIfRemote
|
||||
def test_terminated_event(self):
|
||||
@@ -44,7 +44,7 @@ class TestVSCode_terminatedEvent(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
self.continue_to_exit()
|
||||
|
||||
statistics = self.vscode.wait_for_terminated()["statistics"]
|
||||
statistics = self.dap_server.wait_for_terminated()["statistics"]
|
||||
self.assertTrue(statistics["totalDebugInfoByteSize"] > 0)
|
||||
self.assertTrue(statistics["totalDebugInfoEnabled"] > 0)
|
||||
self.assertTrue(statistics["totalModuleCountHasDebugInfo"] > 0)
|
||||
@@ -52,7 +52,7 @@ class TestVSCode_terminatedEvent(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertIsNotNone(statistics["memory"])
|
||||
self.assertNotIn("modules", statistics.keys())
|
||||
|
||||
# lldb-vscode debugs one target at a time
|
||||
# lldb-dap debugs one target at a time
|
||||
target = json.loads(statistics["targets"])[0]
|
||||
self.assertTrue(target["totalBreakpointResolveTime"] > 0)
|
||||
|
||||
1
lldb/test/API/tools/lldb-dap/terminated-event/foo.cpp
Normal file
1
lldb/test/API/tools/lldb-dap/terminated-event/foo.cpp
Normal file
@@ -0,0 +1 @@
|
||||
int foo() { return 12; }
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "foo.h"
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
std::cout << "Hello World!" << std::endl; // main breakpoint 1
|
||||
@@ -1,11 +1,11 @@
|
||||
"""
|
||||
Test lldb-vscode setBreakpoints request
|
||||
Test lldb-dap setBreakpoints request
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import lldbvscode_testcase
|
||||
import vscode
|
||||
import lldbdap_testcase
|
||||
import dap_server
|
||||
from lldbsuite.test import lldbutil
|
||||
from lldbsuite.test.decorators import *
|
||||
from lldbsuite.test.lldbtest import *
|
||||
@@ -18,7 +18,7 @@ def make_buffer_verify_dict(start_idx, count, offset=0):
|
||||
return verify_dict
|
||||
|
||||
|
||||
class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
|
||||
def verify_values(self, verify_dict, actual, varref_dict=None, expression=None):
|
||||
if "equals" in verify_dict:
|
||||
verify = verify_dict["equals"]
|
||||
@@ -79,7 +79,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
("children verify values specified for " "variable without children"),
|
||||
)
|
||||
|
||||
response = self.vscode.request_variables(varRef)
|
||||
response = self.dap_server.request_variables(varRef)
|
||||
self.verify_variables(
|
||||
verify_dict["children"], response["body"]["variables"], varref_dict
|
||||
)
|
||||
@@ -111,7 +111,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.assertEquals(len(breakpoint_ids), len(functions), "expect one breakpoint")
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
locals = self.vscode.get_local_variables()
|
||||
locals = self.dap_server.get_local_variables()
|
||||
|
||||
verify_locals = {
|
||||
"<error>": {
|
||||
@@ -147,8 +147,8 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
len(breakpoint_ids), len(lines), "expect correct number of breakpoints"
|
||||
)
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
locals = self.vscode.get_local_variables()
|
||||
globals = self.vscode.get_global_variables()
|
||||
locals = self.dap_server.get_local_variables()
|
||||
globals = self.dap_server.get_global_variables()
|
||||
buffer_children = make_buffer_verify_dict(0, 32)
|
||||
verify_locals = {
|
||||
"argc": {"equals": {"type": "int", "value": "1"}},
|
||||
@@ -181,28 +181,28 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# has optional parameters like "start" and "count" to limit the number
|
||||
# of variables that are fetched
|
||||
varRef = varref_dict["pt.buffer"]
|
||||
response = self.vscode.request_variables(varRef)
|
||||
response = self.dap_server.request_variables(varRef)
|
||||
self.verify_variables(buffer_children, response["body"]["variables"])
|
||||
# Verify setting start=0 in the arguments still gets all children
|
||||
response = self.vscode.request_variables(varRef, start=0)
|
||||
response = self.dap_server.request_variables(varRef, start=0)
|
||||
self.verify_variables(buffer_children, response["body"]["variables"])
|
||||
# Verify setting count=0 in the arguments still gets all children.
|
||||
# If count is zero, it means to get all children.
|
||||
response = self.vscode.request_variables(varRef, count=0)
|
||||
response = self.dap_server.request_variables(varRef, count=0)
|
||||
self.verify_variables(buffer_children, response["body"]["variables"])
|
||||
# Verify setting count to a value that is too large in the arguments
|
||||
# still gets all children, and no more
|
||||
response = self.vscode.request_variables(varRef, count=1000)
|
||||
response = self.dap_server.request_variables(varRef, count=1000)
|
||||
self.verify_variables(buffer_children, response["body"]["variables"])
|
||||
# Verify setting the start index and count gets only the children we
|
||||
# want
|
||||
response = self.vscode.request_variables(varRef, start=5, count=5)
|
||||
response = self.dap_server.request_variables(varRef, start=5, count=5)
|
||||
self.verify_variables(
|
||||
make_buffer_verify_dict(5, 5), response["body"]["variables"]
|
||||
)
|
||||
# Verify setting the start index to a value that is out of range
|
||||
# results in an empty list
|
||||
response = self.vscode.request_variables(varRef, start=32, count=1)
|
||||
response = self.dap_server.request_variables(varRef, start=32, count=1)
|
||||
self.assertEqual(
|
||||
len(response["body"]["variables"]),
|
||||
0,
|
||||
@@ -253,7 +253,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
},
|
||||
}
|
||||
for expression in expressions:
|
||||
response = self.vscode.request_evaluate(expression)
|
||||
response = self.dap_server.request_evaluate(expression)
|
||||
self.verify_values(expressions[expression], response["body"])
|
||||
|
||||
# Test setting variables
|
||||
@@ -269,8 +269,8 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Set a variable value whose name is synthetic, like a variable index
|
||||
# and verify the value by reading it
|
||||
self.vscode.request_setVariable(varRef, "[0]", 100)
|
||||
response = self.vscode.request_variables(varRef, start=0, count=1)
|
||||
self.dap_server.request_setVariable(varRef, "[0]", 100)
|
||||
response = self.dap_server.request_variables(varRef, start=0, count=1)
|
||||
self.verify_variables(
|
||||
make_buffer_verify_dict(0, 1, 100), response["body"]["variables"]
|
||||
)
|
||||
@@ -278,8 +278,8 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
# Set a variable value whose name is a real child value, like "pt.x"
|
||||
# and verify the value by reading it
|
||||
varRef = varref_dict["pt"]
|
||||
self.vscode.request_setVariable(varRef, "x", 111)
|
||||
response = self.vscode.request_variables(varRef, start=0, count=1)
|
||||
self.dap_server.request_setVariable(varRef, "x", 111)
|
||||
response = self.dap_server.request_variables(varRef, start=0, count=1)
|
||||
value = response["body"]["variables"][0]["value"]
|
||||
self.assertEqual(
|
||||
value, "111", "verify pt.x got set to 111 (111 != %s)" % (value)
|
||||
@@ -301,40 +301,42 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
verify_locals["x @ main.cpp:19"] = {"equals": {"type": "int", "value": "42"}}
|
||||
verify_locals["x @ main.cpp:21"] = {"equals": {"type": "int", "value": "72"}}
|
||||
|
||||
self.verify_variables(verify_locals, self.vscode.get_local_variables())
|
||||
self.verify_variables(verify_locals, self.dap_server.get_local_variables())
|
||||
|
||||
# Now we verify that we correctly change the name of a variable with and without differentiator suffix
|
||||
self.assertFalse(self.vscode.request_setVariable(1, "x2", 9)["success"])
|
||||
self.assertFalse(self.dap_server.request_setVariable(1, "x2", 9)["success"])
|
||||
self.assertFalse(
|
||||
self.vscode.request_setVariable(1, "x @ main.cpp:0", 9)["success"]
|
||||
self.dap_server.request_setVariable(1, "x @ main.cpp:0", 9)["success"]
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
self.vscode.request_setVariable(1, "x @ main.cpp:17", 17)["success"]
|
||||
self.dap_server.request_setVariable(1, "x @ main.cpp:17", 17)["success"]
|
||||
)
|
||||
self.assertTrue(
|
||||
self.vscode.request_setVariable(1, "x @ main.cpp:19", 19)["success"]
|
||||
self.dap_server.request_setVariable(1, "x @ main.cpp:19", 19)["success"]
|
||||
)
|
||||
self.assertTrue(
|
||||
self.vscode.request_setVariable(1, "x @ main.cpp:21", 21)["success"]
|
||||
self.dap_server.request_setVariable(1, "x @ main.cpp:21", 21)["success"]
|
||||
)
|
||||
|
||||
# The following should have no effect
|
||||
self.assertFalse(
|
||||
self.vscode.request_setVariable(1, "x @ main.cpp:21", "invalid")["success"]
|
||||
self.dap_server.request_setVariable(1, "x @ main.cpp:21", "invalid")[
|
||||
"success"
|
||||
]
|
||||
)
|
||||
|
||||
verify_locals["x @ main.cpp:17"]["equals"]["value"] = "17"
|
||||
verify_locals["x @ main.cpp:19"]["equals"]["value"] = "19"
|
||||
verify_locals["x @ main.cpp:21"]["equals"]["value"] = "21"
|
||||
|
||||
self.verify_variables(verify_locals, self.vscode.get_local_variables())
|
||||
self.verify_variables(verify_locals, self.dap_server.get_local_variables())
|
||||
|
||||
# The plain x variable shold refer to the innermost x
|
||||
self.assertTrue(self.vscode.request_setVariable(1, "x", 22)["success"])
|
||||
self.assertTrue(self.dap_server.request_setVariable(1, "x", 22)["success"])
|
||||
verify_locals["x @ main.cpp:21"]["equals"]["value"] = "22"
|
||||
|
||||
self.verify_variables(verify_locals, self.vscode.get_local_variables())
|
||||
self.verify_variables(verify_locals, self.dap_server.get_local_variables())
|
||||
|
||||
# In breakpoint 3, there should be no shadowed variables
|
||||
breakpoint3_line = line_number(source, "// breakpoint 3")
|
||||
@@ -345,7 +347,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
locals = self.vscode.get_local_variables()
|
||||
locals = self.dap_server.get_local_variables()
|
||||
names = [var["name"] for var in locals]
|
||||
# The first shadowed x shouldn't have a suffix anymore
|
||||
verify_locals["x"] = {"equals": {"type": "int", "value": "17"}}
|
||||
@@ -389,7 +391,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
# Verify locals
|
||||
locals = self.vscode.get_local_variables()
|
||||
locals = self.dap_server.get_local_variables()
|
||||
buffer_children = make_buffer_verify_dict(0, 32)
|
||||
verify_locals = {
|
||||
"argc": {
|
||||
@@ -451,7 +453,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Evaluate from permanent UI.
|
||||
permanent_expr_varref_dict = {}
|
||||
response = self.vscode.request_evaluate(
|
||||
response = self.dap_server.request_evaluate(
|
||||
expandable_expression["name"], frameIndex=0, threadId=None, context="repl"
|
||||
)
|
||||
self.verify_values(
|
||||
@@ -463,7 +465,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
|
||||
# Evaluate from temporary UI.
|
||||
temporary_expr_varref_dict = {}
|
||||
response = self.vscode.request_evaluate(expandable_expression["name"])
|
||||
response = self.dap_server.request_evaluate(expandable_expression["name"])
|
||||
self.verify_values(
|
||||
expandable_expression["response"],
|
||||
response["body"],
|
||||
@@ -472,13 +474,13 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
)
|
||||
|
||||
# Evaluate locals again.
|
||||
locals = self.vscode.get_local_variables()
|
||||
locals = self.dap_server.get_local_variables()
|
||||
self.verify_variables(verify_locals, locals)
|
||||
|
||||
# Verify the evaluated expressions before second locals evaluation
|
||||
# can be expanded.
|
||||
var_ref = temporary_expr_varref_dict[expandable_expression["name"]]
|
||||
response = self.vscode.request_variables(var_ref)
|
||||
response = self.dap_server.request_variables(var_ref)
|
||||
self.verify_variables(
|
||||
expandable_expression["children"], response["body"]["variables"]
|
||||
)
|
||||
@@ -494,14 +496,14 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
var_ref = permanent_expr_varref_dict[expandable_expression["name"]]
|
||||
response = self.vscode.request_variables(var_ref)
|
||||
response = self.dap_server.request_variables(var_ref)
|
||||
self.verify_variables(
|
||||
expandable_expression["children"], response["body"]["variables"]
|
||||
)
|
||||
|
||||
# Test that frame scopes have corresponding presentation hints.
|
||||
frame_id = self.vscode.get_stackFrame()["id"]
|
||||
scopes = self.vscode.request_scopes(frame_id)["body"]["scopes"]
|
||||
frame_id = self.dap_server.get_stackFrame()["id"]
|
||||
scopes = self.dap_server.request_scopes(frame_id)["body"]["scopes"]
|
||||
|
||||
scope_names = [scope["name"] for scope in scopes]
|
||||
self.assertIn("Locals", scope_names)
|
||||
@@ -544,7 +546,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
self.continue_to_breakpoints(breakpoint_ids)
|
||||
|
||||
# Verify locals
|
||||
locals = self.vscode.get_local_variables()
|
||||
locals = self.dap_server.get_local_variables()
|
||||
# The vector variables might have one additional entry from the fake
|
||||
# "[raw]" child.
|
||||
raw_child_count = 1 if enableSyntheticChildDebugging else 0
|
||||
@@ -569,7 +571,7 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
if enableSyntheticChildDebugging:
|
||||
verify_children["[raw]"] = ({"contains": {"type": ["vector"]}},)
|
||||
|
||||
children = self.vscode.request_variables(locals[2]["variablesReference"])[
|
||||
children = self.dap_server.request_variables(locals[2]["variablesReference"])[
|
||||
"body"
|
||||
]["variables"]
|
||||
self.verify_variables(verify_children, children)
|
||||
@@ -620,11 +622,11 @@ class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
|
||||
if pc_name is None:
|
||||
return
|
||||
# Verify locals
|
||||
reg_sets = self.vscode.get_registers()
|
||||
reg_sets = self.dap_server.get_registers()
|
||||
for reg_set in reg_sets:
|
||||
if reg_set["name"] == "General Purpose Registers":
|
||||
varRef = reg_set["variablesReference"]
|
||||
regs = self.vscode.request_variables(varRef)["body"]["variables"]
|
||||
regs = self.dap_server.request_variables(varRef)["body"]["variables"]
|
||||
for reg in regs:
|
||||
if reg["name"] == pc_name:
|
||||
value = reg["value"]
|
||||
@@ -11,8 +11,8 @@ static int s_global = 234;
|
||||
int test_indexedVariables();
|
||||
int main(int argc, char const *argv[]) {
|
||||
static float s_local = 2.25;
|
||||
PointType pt = { 11,22, {0}};
|
||||
for (int i=0; i<BUFFER_SIZE; ++i)
|
||||
PointType pt = {11, 22, {0}};
|
||||
for (int i = 0; i < BUFFER_SIZE; ++i)
|
||||
pt.buffer[i] = i;
|
||||
int x = s_global - g_global - pt.y; // breakpoint 1
|
||||
{
|
||||
@@ -1 +0,0 @@
|
||||
lldb-vscode
|
||||
@@ -1,30 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
int compare_ints(const void* a, const void* b)
|
||||
{
|
||||
int arg1 = *(const int*)a;
|
||||
int arg2 = *(const int*)b;
|
||||
|
||||
// breakpoint 1
|
||||
|
||||
if (arg1 < arg2) return -1;
|
||||
if (arg1 > arg2) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ints[] = { -2, 99, 0, -743, 2, INT_MIN, 4 };
|
||||
int size = sizeof ints / sizeof *ints;
|
||||
|
||||
qsort(ints, size, sizeof(int), compare_ints);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
printf("%d ", ints[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
int foo() {
|
||||
return 12;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
int function(int x) {
|
||||
if ((x % 2) == 0)
|
||||
return function(x-1) + x; // breakpoint 1
|
||||
else
|
||||
return x;
|
||||
}
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
return function(2);
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
int foo() {
|
||||
return 12;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
# RUN: lldb-vscode --help | FileCheck %s
|
||||
# RUN: lldb-dap --help | FileCheck %s
|
||||
# CHECK: -g
|
||||
# CHECK: --help
|
||||
# CHECK: -h
|
||||
@@ -90,7 +90,7 @@ def use_lldb_substitutions(config):
|
||||
unresolved="ignore",
|
||||
),
|
||||
"lldb-test",
|
||||
"lldb-vscode",
|
||||
"lldb-dap",
|
||||
ToolSubst(
|
||||
"%build", command="'" + sys.executable + "'", extra_args=build_script_args
|
||||
),
|
||||
|
||||
@@ -9,7 +9,7 @@ add_subdirectory(lldb-test EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(lldb-fuzzer EXCLUDE_FROM_ALL)
|
||||
|
||||
add_lldb_tool_subdirectory(lldb-instr)
|
||||
add_lldb_tool_subdirectory(lldb-vscode)
|
||||
add_lldb_tool_subdirectory(lldb-dap)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_lldb_tool_subdirectory(darwin-debug)
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "BreakpointBase.h"
|
||||
#include "VSCode.h"
|
||||
#include "DAP.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
|
||||
using namespace lldb_vscode;
|
||||
using namespace lldb_dap;
|
||||
|
||||
BreakpointBase::BreakpointBase(const llvm::json::Object &obj)
|
||||
: condition(std::string(GetString(obj, "condition"))),
|
||||
@@ -270,7 +270,7 @@ void BreakpointBase::SetLogMessage() {
|
||||
void BreakpointBase::NotifyLogMessageError(llvm::StringRef error) {
|
||||
std::string message = "Log message has error: ";
|
||||
message += error;
|
||||
g_vsc.SendOutput(OutputType::Console, message);
|
||||
g_dap.SendOutput(OutputType::Console, message);
|
||||
}
|
||||
|
||||
/*static*/
|
||||
@@ -304,7 +304,7 @@ bool BreakpointBase::BreakpointHitCallback(
|
||||
}
|
||||
if (!output.empty() && output.back() != '\n')
|
||||
output.push_back('\n'); // Ensure log message has line break.
|
||||
g_vsc.SendOutput(OutputType::Console, output.c_str());
|
||||
g_dap.SendOutput(OutputType::Console, output.c_str());
|
||||
|
||||
// Do not stop.
|
||||
return false;
|
||||
@@ -328,7 +328,7 @@ void BreakpointBase::UpdateBreakpoint(const BreakpointBase &request_bp) {
|
||||
const char *BreakpointBase::GetBreakpointLabel() {
|
||||
// Breakpoints in LLDB can have names added to them which are kind of like
|
||||
// labels or categories. All breakpoints that are set through the IDE UI get
|
||||
// sent through the various VS code DAP set*Breakpoint packets, and these
|
||||
// sent through the various DAP set*Breakpoint packets, and these
|
||||
// breakpoints will be labeled with this name so if breakpoint update events
|
||||
// come in for breakpoints that the IDE doesn't know about, like if a
|
||||
// breakpoint is set manually using the debugger console, we won't report any
|
||||
@@ -338,5 +338,5 @@ const char *BreakpointBase::GetBreakpointLabel() {
|
||||
// in via LLDB breakpoint changed events and check the breakpoint by calling
|
||||
// "bool lldb::SBBreakpoint::MatchesName(const char *)" to check if a
|
||||
// breakpoint in one of the UI breakpoints that we should report changes for.
|
||||
return "vscode";
|
||||
return "dap";
|
||||
}
|
||||
@@ -6,8 +6,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLDB_TOOLS_LLDB_VSCODE_BREAKPOINTBASE_H
|
||||
#define LLDB_TOOLS_LLDB_VSCODE_BREAKPOINTBASE_H
|
||||
#ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
|
||||
#define LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
|
||||
|
||||
#include "JSONUtils.h"
|
||||
#include "lldb/API/SBBreakpoint.h"
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace lldb_vscode {
|
||||
namespace lldb_dap {
|
||||
|
||||
struct BreakpointBase {
|
||||
// logMessage part can be either a raw text or an expression.
|
||||
@@ -58,6 +58,6 @@ struct BreakpointBase {
|
||||
lldb::SBBreakpointLocation &location);
|
||||
};
|
||||
|
||||
} // namespace lldb_vscode
|
||||
} // namespace lldb_dap
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user