Skip to content

Cherry pick source map fixes #9770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
537251e
[lldb][lldb-dap][test] Enable Launch tests
DavidSpickett Aug 29, 2024
baba5cd
Make env and source map dictionaries #95137 (#106919)
da-viper Oct 7, 2024
2634c07
[lldb-dap] Skip the lldb-dap output test on windows, it seems all the…
ashgti Aug 22, 2024
efee648
[lldb-dap] Enabling instruction breakpoint support to lldb-dap. (#105…
santhoshe447 Aug 26, 2024
d42065a
[lldb][lldb-dap] Fix for TestDAP_instruction_breakpoint.py test failu…
santhoshe447 Aug 27, 2024
795f404
[lldb][lldb-dap][test] Enable variable tests on Windows
DavidSpickett Aug 28, 2024
15850c7
[lldb][lldb-dap][test] Enable more attach tests on Windows
DavidSpickett Aug 28, 2024
b8aa10f
[lldb][lldb-dap][test] Enable more tests on Windows
DavidSpickett Aug 29, 2024
3589e99
[lldb][lldb-dap][test] Skip logpoint test on Windows again
DavidSpickett Aug 29, 2024
52fdf22
[lldb][lldb-dap] Enable more tests on Windows
DavidSpickett Aug 29, 2024
601418e
[lldb-dap][test] Fix: Typo in unresolved test (#107030)
da-viper Sep 3, 2024
529b9a7
[lldb] Make sure TestDAP_subtleFrames actually uses libc++ (#108227)
labath Sep 13, 2024
542fd8b
[lldb] Deflake TestDAP_attach (#108226)
labath Sep 13, 2024
d6861d3
[lldb][lldb-dap] Remove unused includes in memory test
DavidSpickett Sep 17, 2024
037eab2
[lldb][lldb-dap] Disable read memory test on Windows
DavidSpickett Sep 17, 2024
2c329bb
[lldb-dap][test] Fix `readMemory` test (#109057)
vogelsgesang Sep 18, 2024
94b21fc
[lldb-dap] Disable TestDAP_optimized under ASAN (#111063)
augusto2112 Oct 3, 2024
3610511
[lldb][test] Disable new lldb-dap test on non-x86
DavidSpickett Oct 8, 2024
ffa1fb9
[lldb][test] Enable TestDAP_runInTerminal on non-x86 architectures (#…
DavidSpickett Oct 9, 2024
9aa8b56
Revert "[lldb][test] Enable TestDAP_runInTerminal on non-x86 architec…
DavidSpickett Oct 9, 2024
35b1430
[lldb-dap] Creating an API for sending dap events from a script in ll…
ashgti Oct 17, 2024
0366fae
[lldb] Skip TestDAP_completions on older versions of libcxx
felipepiovezan Nov 1, 2024
cb55405
[lldb] s/assertEquals/assertEqual TestDAP_sendEvent
labath Nov 8, 2024
fbcabb4
[lldb-dap] Adjust the evaluate test to use a different lldb command. …
ashgti Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ def run_vscode(dbg, args, options):
def main():
parser = optparse.OptionParser(
description=(
"A testing framework for the Visual Studio Code Debug " "Adaptor protocol"
"A testing framework for the Visual Studio Code Debug Adaptor protocol"
)
)

Expand Down
15 changes: 4 additions & 11 deletions lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def set_and_hit_breakpoint(self, continueToExit=True):
if continueToExit:
self.continue_to_exit()

@skipIfWindows
@skipIfNetBSD # Hangs on NetBSD as well
def test_by_pid(self):
"""
Expand All @@ -56,7 +55,6 @@ def test_by_pid(self):
self.attach(pid=self.process.pid)
self.set_and_hit_breakpoint(continueToExit=True)

@skipIfWindows
@skipIfNetBSD # Hangs on NetBSD as well
def test_by_name(self):
"""
Expand Down Expand Up @@ -116,12 +114,8 @@ def test_by_name_waitFor(self):
self.attach(program=program, waitFor=True)
self.set_and_hit_breakpoint(continueToExit=True)

@skipIfWindows
@skipIfDarwin
@skipIfNetBSD # Hangs on NetBSD as well
@skipIf(
archs=["arm", "aarch64"]
) # Example of a flaky run http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5527/steps/test/logs/stdio
def test_commands(self):
"""
Tests the "initCommands", "preRunCommands", "stopCommands",
Expand Down Expand Up @@ -155,7 +149,7 @@ def test_commands(self):
initCommands = ["target list", "platform list"]
preRunCommands = ["image list a.out", "image dump sections a.out"]
postRunCommands = ["help trace", "help process trace"]
stopCommands = ["frame variable", "bt"]
stopCommands = ["frame variable", "thread backtrace"]
exitCommands = ["expr 2+3", "expr 3+4"]
terminateCommands = ["expr 4+2"]
self.attach(
Expand All @@ -182,7 +176,7 @@ def test_commands(self):
breakpoint_ids = self.set_function_breakpoints(functions)
self.assertEqual(len(breakpoint_ids), len(functions), "expect one breakpoint")
self.continue_to_breakpoints(breakpoint_ids)
output = self.get_console(timeout=1.0)
output = self.collect_console(timeout_secs=10, pattern=stopCommands[-1])
self.verify_commands("stopCommands", output, stopCommands)

# Continue after launch and hit the "pause()" call and stop the target.
Expand All @@ -192,7 +186,7 @@ def test_commands(self):
time.sleep(0.5)
self.dap_server.request_pause()
self.dap_server.wait_for_stopped()
output = self.get_console(timeout=1.0)
output = self.collect_console(timeout_secs=10, pattern=stopCommands[-1])
self.verify_commands("stopCommands", output, stopCommands)

# Continue until the program exits
Expand All @@ -201,13 +195,12 @@ def test_commands(self):
# "exitCommands" that were run after the second breakpoint was hit
# and the "terminateCommands" due to the debugging session ending
output = self.collect_console(
timeout_secs=1.0,
timeout_secs=10.0,
pattern=terminateCommands[0],
)
self.verify_commands("exitCommands", output, exitCommands)
self.verify_commands("terminateCommands", output, terminateCommands)

@skipIfWindows
@skipIfDarwin
@skipIfNetBSD # Hangs on NetBSD as well
@skipIf(
Expand Down
9 changes: 9 additions & 0 deletions lldb/test/API/tools/lldb-dap/attach/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include <stdio.h>
#ifdef _WIN32
#include <process.h>
#include <windows.h>
#else
#include <unistd.h>
#endif

int main(int argc, char const *argv[]) {
lldb_enable_attach();
Expand All @@ -15,6 +20,10 @@ int main(int argc, char const *argv[]) {
}

printf("pid = %i\n", getpid());
#ifdef _WIN32
Sleep(10 * 1000);
#else
sleep(10);
#endif
return 0; // breakpoint 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
variable_var1_completion = {"text": "var1", "label": "var1 -- int &"}
variable_var2_completion = {"text": "var2", "label": "var2 -- int &"}

# Older version of libcxx produce slightly different typename strings for
# templates like vector.
@skipIf(compiler="clang", compiler_version=["<", "16.0"])
class TestDAP_completions(lldbdap_testcase.DAPTestCaseBase):
def verify_completions(self, actual_list, expected_list, not_expected_list=[]):
for expected_item in expected_list:
Expand Down
4 changes: 0 additions & 4 deletions lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def check_lldb_command(
),
)

@skipIfWindows
def test_scopes_variables_setVariable_evaluate(self):
"""
Tests that the "scopes" request causes the currently selected
Expand Down Expand Up @@ -80,7 +79,6 @@ def test_scopes_variables_setVariable_evaluate(self):

self.check_lldb_command("frame select", "frame #1", "frame 1 is selected")

@skipIfWindows
def test_custom_escape_prefix(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program, commandEscapePrefix="::")
Expand All @@ -96,7 +94,6 @@ def test_custom_escape_prefix(self):
command_escape_prefix="::",
)

@skipIfWindows
def test_empty_escape_prefix(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program, commandEscapePrefix="")
Expand Down Expand Up @@ -151,7 +148,6 @@ def test_exit_status_message_sigterm(self):
"Exit status does not contain message 'exited with status'",
)

@skipIfWindows
def test_exit_status_message_ok(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program, commandEscapePrefix="")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class TestDAP_redirection_to_console(lldbdap_testcase.DAPTestCaseBase):
@skipIfWindows
def test(self):
"""
Without proper stderr and stdout redirection, the following code would throw an
Expand Down
18 changes: 15 additions & 3 deletions lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class TestDAP_coreFile(lldbdap_testcase.DAPTestCaseBase):
@skipIfWindows
@skipIfLLVMTargetMissing("X86")
def test_core_file(self):
current_dir = os.path.dirname(__file__)
Expand Down Expand Up @@ -58,9 +57,8 @@ def test_core_file(self):
self.dap_server.request_next(threadId=32259)
self.assertEqual(self.get_stackFrames(), expected_frames)

@skipIfWindows
@skipIfLLVMTargetMissing("X86")
def test_core_file_source_mapping(self):
def test_core_file_source_mapping_array(self):
"""Test that sourceMap property is correctly applied when loading a core"""
current_dir = os.path.dirname(__file__)
exe_file = os.path.join(current_dir, "linux-x86_64.out")
Expand All @@ -72,3 +70,17 @@ def test_core_file_source_mapping(self):
self.attach(exe_file, coreFile=core_file, sourceMap=source_map)

self.assertIn(current_dir, self.get_stackFrames()[0]["source"]["path"])

@skipIfLLVMTargetMissing("X86")
def test_core_file_source_mapping_object(self):
"""Test that sourceMap property is correctly applied when loading a core"""
current_dir = os.path.dirname(__file__)
exe_file = os.path.join(current_dir, "linux-x86_64.out")
core_file = os.path.join(current_dir, "linux-x86_64.core")

self.create_debug_adaptor()

source_map = {"/home/labath/test": current_dir}
self.attach(exe_file, coreFile=core_file, sourceMap=source_map)

self.assertIn(current_dir, self.get_stackFrames()[0]["source"]["path"])
10 changes: 5 additions & 5 deletions lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def run_test_evaluate_expressions(
if context == "repl":
# In the repl context expressions may be interpreted as lldb
# commands since no variables have the same name as the command.
self.assertEvaluate("var", r"\(lldb\) var\n.*")
self.assertEvaluate("list", r"\(lldb\) list\n.*")
else:
self.assertEvaluateFailure("var") # local variable of a_function
self.assertEvaluateFailure("list") # local variable of a_function

self.assertEvaluateFailure("my_struct") # type name
self.assertEvaluateFailure("int") # type name
Expand Down Expand Up @@ -162,7 +162,7 @@ def run_test_evaluate_expressions(

# Expressions at breakpoint 3, which is inside a_function
self.continue_to_next_stop()
self.assertEvaluate("var", "42")
self.assertEvaluate("list", "42")
self.assertEvaluate("static_int", "42")
self.assertEvaluate("non_static_int", "43")

Expand All @@ -176,13 +176,13 @@ def run_test_evaluate_expressions(
if self.isExpressionParsedExpected():
self.assertEvaluate("a_function", "0x.*a.out`a_function.*")
self.assertEvaluate("a_function(1)", "1")
self.assertEvaluate("var + 1", "43")
self.assertEvaluate("list + 1", "43")
self.assertEvaluate("foo_func", "0x.*a.out`foo_func.*")
self.assertEvaluate("foo_var", "44")
else:
self.assertEvaluateFailure("a_function")
self.assertEvaluateFailure("a_function(1)")
self.assertEvaluateFailure("var + 1")
self.assertEvaluateFailure("list + 1")
self.assertEvaluateFailure("foo_func")
self.assertEvaluateFailure("foo_var")

Expand Down
4 changes: 2 additions & 2 deletions lldb/test/API/tools/lldb-dap/evaluate/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ static int static_int = 42;

int non_static_int = 43;

int a_function(int var) {
return var; // breakpoint 3
int a_function(int list) {
return list; // breakpoint 3
}

struct my_struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def setUp(self):
self.main_basename = "main-copy.cpp"
self.main_path = os.path.realpath(self.getBuildArtifact(self.main_basename))

@skipIfWindows
def test_instruction_breakpoint(self):
self.build()
self.instruction_breakpoint_test()
Expand All @@ -34,7 +35,7 @@ def instruction_breakpoint_test(self):
# Set source breakpoint 1
response = self.dap_server.request_setBreakpoints(self.main_path, [main_line])
breakpoints = response["body"]["breakpoints"]
self.assertEquals(len(breakpoints), 1)
self.assertEqual(len(breakpoints), 1)
breakpoint = breakpoints[0]
self.assertEqual(
breakpoint["line"], main_line, "incorrect breakpoint source line"
Expand Down
Loading