[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/vogelsgesang edited https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r e146c1867e8decfd423034f63a3a863733e03f04...af45bc2e24623d7225d24a4680a28630d67d636e lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py `` View the diff from darker here. ``diff --- packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2024-10-27 03:38:16.00 + +++ packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2024-10-27 03:42:10.061762 + @@ -610,24 +610,30 @@ if gdbRemoteHostname is not None: args_dict["gdb-remote-hostname"] = gdbRemoteHostname command_dict = {"command": "attach", "type": "request", "arguments": args_dict} return self.send_recv(command_dict) -def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None): +def request_breakpointLocations( +self, file_path, line, end_line=None, column=None, end_column=None +): (dir, base) = os.path.split(file_path) source_dict = {"name": base, "path": file_path} args_dict = {} args_dict["source"] = source_dict if line is not None: - args_dict["line"] = line +args_dict["line"] = line if end_line is not None: args_dict["endLine"] = end_line if column is not None: args_dict["column"] = column if end_column is not None: args_dict["endColumn"] = end_column -command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict} +command_dict = { +"command": "breakpointLocations", +"type": "request", +"arguments": args_dict, +} return self.send_recv(command_dict) def request_configurationDone(self): command_dict = { "command": "configurationDone", --- test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py 2024-10-27 03:38:16.00 + +++ test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py 2024-10-27 03:42:10.140032 + @@ -26,49 +26,60 @@ self.build_and_launch(program, stopOnEntry=True) loop_line = line_number(self.main_path, "// break loop") self.dap_server.request_continue() # Ask for the breakpoint locations based only on the line number -response = self.dap_server.request_breakpointLocations(self.main_path, loop_line) +response = self.dap_server.request_breakpointLocations( +self.main_path, loop_line +) self.assertTrue(response["success"]) -self.assertEqual(response["body"]["breakpoints"], [ -{ "line": loop_line, "column": 9 }, -{ "line": loop_line, "column": 13 }, -{ "line": loop_line, "column": 20 }, -{ "line": loop_line, "column": 23 }, -{ "line": loop_line, "column": 25 }, -{ "line": loop_line, "column": 34 }, -{ "line": loop_line, "column": 37 }, -{ "line": loop_line, "column": 39 }, -{ "line": loop_line, "column": 51 } -]) +self.assertEqual( +response["body"]["breakpoints"], +[ +{"line": loop_line, "column": 9}, +{"line": loop_line, "column": 13}, +{"line": loop_line, "column": 20}, +{"line": loop_line, "column": 23}, +{"line": loop_line, "column": 25}, +{"line": loop_line, "column": 34}, +{"line": loop_line, "column": 37}, +{"line": loop_line, "column": 39}, +{"line": loop_line, "column": 51}, +], +) # Ask for the breakpoint locations for a column range response = self.dap_server.request_breakpointLocations( self.main_path, loop_line, -column = 24, -end_column = 46, +column=24, +end_column=46, ) self.assertTrue(response["success"]) -self.assertEqual(response["body"]["breakpoints"], [ -{ "line": loop_line, "column": 25 }, -{ "line": loop_line, "column": 34 }, -{ "line": loop_line, "column": 37 }, -{ "line": loop_line, "column": 39 }, -]) +self.assertEqual( +response["body"]["breakpoints"], +[ +{"line": loop_line, "column": 25}, +{"line": loop_line, "column": 34}, +{"line": loop_line, "column": 37}, +{"line": loop_line, "column": 39}, +], +) # Ask for the breakpoint
[Lldb-commits] [clang] [compiler-rt] [flang] [libc] [libcxx] [lld] [lldb] [llvm] [mlir] Optimize __insert_with_sentinel Function in std::vector (PR #113727)
Martin =?utf-8?q?Storsjö?= ,Thomas Fransham ,davidtrevelyan , Andrzej =?utf-8?q?Warzyński?= ,Louis Dionne ,Alex =?utf-8?q?Rønne?= Petersen ,lntue ,Shih-Po Hung ,Peng Liu ,Peng Liu Message-ID: In-Reply-To: github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 8c4bc1e75de27adfbaead34b895b0efbaf17bd02 3b5b692134d48ce4ebc2f21b9a4b569d24ddf9a3 --extensions ,cpp,cppm,c,h -- clang/test/Format/error-unfound-files.cpp flang/include/flang/Optimizer/Transforms/CUFCommon.h flang/lib/Optimizer/Transforms/CUFCommon.cpp libcxx/include/__locale_dir/locale_base_api/freebsd.h clang/include/clang/Lex/Preprocessor.h clang/include/clang/Serialization/ASTBitCodes.h clang/lib/Basic/Targets/WebAssembly.cpp clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/Lex/HeaderSearch.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/CodeGen/rtsan_attribute_inserted.c clang/test/CodeGen/rtsan_no_attribute_sanitizer_disabled.c clang/test/Modules/no-external-type-id.cppm clang/test/Preprocessor/wasm-target-features.c clang/tools/clang-format/ClangFormat.cpp compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp flang/lib/Optimizer/Transforms/CUFAddConstructor.cpp libc/src/math/generic/atan2.cpp libc/src/math/generic/cbrt.cpp libc/src/math/generic/cbrtf.cpp libc/src/math/generic/log.cpp libc/src/math/generic/log10.cpp libc/src/math/generic/log10f.cpp libc/src/math/generic/log1p.cpp libc/src/math/generic/log2.cpp libc/src/math/generic/log2f.cpp libc/src/math/generic/logf.cpp libc/src/math/generic/pow.cpp libc/src/math/generic/powf.cpp libc/src/math/generic/sin.cpp libc/src/math/generic/tan.cpp libc/test/src/math/cbrt_test.cpp libc/test/src/math/smoke/HypotTest.h libc/test/src/math/smoke/acosf_test.cpp libc/test/src/math/smoke/acoshf_test.cpp libc/test/src/math/smoke/asinf_test.cpp libc/test/src/math/smoke/asinhf_test.cpp libc/test/src/math/smoke/atan2_test.cpp libc/test/src/math/smoke/atanf_test.cpp libc/test/src/math/smoke/atanhf_test.cpp libc/test/src/math/smoke/cbrt_test.cpp libc/test/src/math/smoke/cbrtf_test.cpp libc/test/src/math/smoke/cos_test.cpp libc/test/src/math/smoke/cosf_test.cpp libc/test/src/math/smoke/coshf_test.cpp libc/test/src/math/smoke/cospif_test.cpp libc/test/src/math/smoke/erff_test.cpp libc/test/src/math/smoke/exp10_test.cpp libc/test/src/math/smoke/exp10f_test.cpp libc/test/src/math/smoke/exp2_test.cpp libc/test/src/math/smoke/exp2f_test.cpp libc/test/src/math/smoke/exp2m1f_test.cpp libc/test/src/math/smoke/exp_test.cpp libc/test/src/math/smoke/expf_test.cpp libc/test/src/math/smoke/expm1_test.cpp libc/test/src/math/smoke/expm1f_test.cpp libc/test/src/math/smoke/hypotf_test.cpp libc/test/src/math/smoke/log10_test.cpp libc/test/src/math/smoke/log10f_test.cpp libc/test/src/math/smoke/log1p_test.cpp libc/test/src/math/smoke/log1pf_test.cpp libc/test/src/math/smoke/log2_test.cpp libc/test/src/math/smoke/log2f_test.cpp libc/test/src/math/smoke/log_test.cpp libc/test/src/math/smoke/logf_test.cpp libc/test/src/math/smoke/pow_test.cpp libc/test/src/math/smoke/powf_test.cpp libc/test/src/math/smoke/sin_test.cpp libc/test/src/math/smoke/sinf_test.cpp libc/test/src/math/smoke/sinhf_test.cpp libc/test/src/math/smoke/sinpif_test.cpp libc/test/src/math/smoke/tan_test.cpp libc/test/src/math/smoke/tanf_test.cpp libc/test/src/math/smoke/tanhf_test.cpp libcxx/include/__locale_dir/locale_base_api.h libcxx/include/__vector/vector.h libcxx/include/version libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp libcxx/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp libcxx/test/support/test_macros.h lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp llvm/include/llvm/ADT/StringRef.h llvm/include/llvm/Analysis/TargetLibraryInfo.h llvm/include/llvm/Bitcode/LLVMBitCodes.h llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/lib/IR/Verifier.cpp llvm/lib/Support/StringRef.cpp llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp llvm/lib/Target/X86/X86TargetTransformInfo.cpp llvm/lib/Target/X86/X86TargetTransformInfo.h llvm/lib/Transforms/Instrumentation/RealtimeSanitizer.cpp llvm/lib/Transforms/Utils/CodeExtractor.cpp llvm/lib/Transforms/Vectorize/Loo
[Lldb-commits] [clang] [compiler-rt] [flang] [libc] [libcxx] [lld] [lldb] [llvm] [mlir] Optimize __insert_with_sentinel Function in std::vector (PR #113727)
Martin =?utf-8?q?Storsjö?= ,Thomas Fransham ,davidtrevelyan , Andrzej =?utf-8?q?Warzyński?= ,Louis Dionne ,Alex =?utf-8?q?Rønne?= Petersen ,lntue ,Shih-Po Hung ,Peng Liu ,Peng Liu Message-ID: In-Reply-To: https://github.com/winner245 closed https://github.com/llvm/llvm-project/pull/113727 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/vogelsgesang created https://github.com/llvm/llvm-project/pull/113787 This commit adds support for column breakpoints to lldb-dap. To do so, support for `breakpointLocations` was added. To find all available breakpoint positions, we iterate over the line table. The `setBreakpoints` request already forwarded the column correctly to `SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap` did not keep track of multiple breakpoints in the same line. To do so, the `SourceBreakpointMap` is now indexed by line+column instead of by line only. See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a high-level introduction to column breakpoints. >From af45bc2e24623d7225d24a4680a28630d67d636e Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang Date: Sat, 26 Oct 2024 14:34:31 + Subject: [PATCH] [lldb-dap] Support column breakpoints This commit adds support for column breakpoints to lldb-dap. To do so, support for `breakpointLocations` was added. To find all available breakpoint positions, we iterate over the line table. The `setBreakpoints` request already forwarded the column correctly to `SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap` did not keep track of multiple breakpoints in the same line. To do so, the `SourceBreakpointMap` is now indexed by line+column instead of by line only. See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a high-level introduction to column breakpoints. --- .../test/tools/lldb-dap/dap_server.py | 30 ++- .../API/tools/lldb-dap/breakpoint/Makefile| 2 +- .../breakpoint/TestDAP_breakpointLocations.py | 74 +++ .../breakpoint/TestDAP_setBreakpoints.py | 172 +-- lldb/tools/lldb-dap/DAP.h | 2 +- lldb/tools/lldb-dap/lldb-dap.cpp | 197 +- .../llvm/DebugInfo/DWARF/DWARFDebugLine.h | 2 +- 7 files changed, 393 insertions(+), 86 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 63748a71f1122d..659408c709a249 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -612,6 +612,22 @@ def request_attach( command_dict = {"command": "attach", "type": "request", "arguments": args_dict} return self.send_recv(command_dict) +def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None): +(dir, base) = os.path.split(file_path) +source_dict = {"name": base, "path": file_path} +args_dict = {} +args_dict["source"] = source_dict +if line is not None: + args_dict["line"] = line +if end_line is not None: +args_dict["endLine"] = end_line +if column is not None: +args_dict["column"] = column +if end_column is not None: +args_dict["endColumn"] = end_column +command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict} +return self.send_recv(command_dict) + def request_configurationDone(self): command_dict = { "command": "configurationDone", @@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, data=None): breakpoint_data = data[i] bp = {"line": line} if breakpoint_data is not None: -if "condition" in breakpoint_data and breakpoint_data["condition"]: +if breakpoint_data.get("condition"): bp["condition"] = breakpoint_data["condition"] -if ( -"hitCondition" in breakpoint_data -and breakpoint_data["hitCondition"] -): +if breakpoint_data.get("hitCondition"): bp["hitCondition"] = breakpoint_data["hitCondition"] -if ( -"logMessage" in breakpoint_data -and breakpoint_data["logMessage"] -): +if breakpoint_data.get("logMessage"): bp["logMessage"] = breakpoint_data["logMessage"] +if breakpoint_data.get("column"): +bp["column"] = breakpoint_data["column"] breakpoints.append(bp) args_dict["breakpoints"] = breakpoints diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile index 7634f513e85233..06438b3e6e3139 100644 --- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile +++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile @@ -16,4 +16,4 @@ main-copy.cpp
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
llvmbot wrote: @llvm/pr-subscribers-lldb @llvm/pr-subscribers-debuginfo Author: Adrian Vogelsgesang (vogelsgesang) Changes This commit adds support for column breakpoints to lldb-dap. To do so, support for `breakpointLocations` was added. To find all available breakpoint positions, we iterate over the line table. The `setBreakpoints` request already forwarded the column correctly to `SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap` did not keep track of multiple breakpoints in the same line. To do so, the `SourceBreakpointMap` is now indexed by line+column instead of by line only. See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a high-level introduction to column breakpoints. --- Patch is 27.58 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/113787.diff 7 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (+21-9) - (modified) lldb/test/API/tools/lldb-dap/breakpoint/Makefile (+1-1) - (added) lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py (+74) - (modified) lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py (+104-68) - (modified) lldb/tools/lldb-dap/DAP.h (+1-1) - (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+191-6) - (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (+1-1) ``diff diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 63748a71f1122d..659408c709a249 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -612,6 +612,22 @@ def request_attach( command_dict = {"command": "attach", "type": "request", "arguments": args_dict} return self.send_recv(command_dict) +def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None): +(dir, base) = os.path.split(file_path) +source_dict = {"name": base, "path": file_path} +args_dict = {} +args_dict["source"] = source_dict +if line is not None: + args_dict["line"] = line +if end_line is not None: +args_dict["endLine"] = end_line +if column is not None: +args_dict["column"] = column +if end_column is not None: +args_dict["endColumn"] = end_column +command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict} +return self.send_recv(command_dict) + def request_configurationDone(self): command_dict = { "command": "configurationDone", @@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, data=None): breakpoint_data = data[i] bp = {"line": line} if breakpoint_data is not None: -if "condition" in breakpoint_data and breakpoint_data["condition"]: +if breakpoint_data.get("condition"): bp["condition"] = breakpoint_data["condition"] -if ( -"hitCondition" in breakpoint_data -and breakpoint_data["hitCondition"] -): +if breakpoint_data.get("hitCondition"): bp["hitCondition"] = breakpoint_data["hitCondition"] -if ( -"logMessage" in breakpoint_data -and breakpoint_data["logMessage"] -): +if breakpoint_data.get("logMessage"): bp["logMessage"] = breakpoint_data["logMessage"] +if breakpoint_data.get("column"): +bp["column"] = breakpoint_data["column"] breakpoints.append(bp) args_dict["breakpoints"] = breakpoints diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile index 7634f513e85233..06438b3e6e3139 100644 --- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile +++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile @@ -16,4 +16,4 @@ main-copy.cpp: main.cpp # The following shared library will be used to test breakpoints under dynamic loading libother: other-copy.c "$(MAKE)" -f $(MAKEFILE_RULES) \ - DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other + DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py new file mode 100644 index 00..d84ce843e3fba8 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py @@ -0,0 +1,74 @@ +""" +Test lld
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff e146c1867e8decfd423034f63a3a863733e03f04 af45bc2e24623d7225d24a4680a28630d67d636e --extensions h,cpp -- lldb/tools/lldb-dap/DAP.h lldb/tools/lldb-dap/lldb-dap.cpp llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h `` View the diff from clang-format here. ``diff diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h index 49c2b5b34a..8ca46a7ea7 100644 --- a/lldb/tools/lldb-dap/DAP.h +++ b/lldb/tools/lldb-dap/DAP.h @@ -67,7 +67,8 @@ namespace lldb_dap { -typedef llvm::DenseMap, SourceBreakpoint> SourceBreakpointMap; +typedef llvm::DenseMap, SourceBreakpoint> +SourceBreakpointMap; typedef llvm::StringMap FunctionBreakpointMap; typedef llvm::DenseMap InstructionBreakpointMap; `` https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
vogelsgesang wrote: Screen recording showing the behavior: https://github.com/user-attachments/assets/ee5129e1-b9af-44e3-acd3-c6e9bbe65a06 https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/vogelsgesang updated https://github.com/llvm/llvm-project/pull/113787 >From af45bc2e24623d7225d24a4680a28630d67d636e Mon Sep 17 00:00:00 2001 From: Adrian Vogelsgesang Date: Sat, 26 Oct 2024 14:34:31 + Subject: [PATCH 1/2] [lldb-dap] Support column breakpoints This commit adds support for column breakpoints to lldb-dap. To do so, support for `breakpointLocations` was added. To find all available breakpoint positions, we iterate over the line table. The `setBreakpoints` request already forwarded the column correctly to `SBTarget::BreakpointCreateByLocation`. However, `SourceBreakpointMap` did not keep track of multiple breakpoints in the same line. To do so, the `SourceBreakpointMap` is now indexed by line+column instead of by line only. See http://jonasdevlieghere.com/post/lldb-column-breakpoints/ for a high-level introduction to column breakpoints. --- .../test/tools/lldb-dap/dap_server.py | 30 ++- .../API/tools/lldb-dap/breakpoint/Makefile| 2 +- .../breakpoint/TestDAP_breakpointLocations.py | 74 +++ .../breakpoint/TestDAP_setBreakpoints.py | 172 +-- lldb/tools/lldb-dap/DAP.h | 2 +- lldb/tools/lldb-dap/lldb-dap.cpp | 197 +- .../llvm/DebugInfo/DWARF/DWARFDebugLine.h | 2 +- 7 files changed, 393 insertions(+), 86 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 63748a71f1122d..659408c709a249 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -612,6 +612,22 @@ def request_attach( command_dict = {"command": "attach", "type": "request", "arguments": args_dict} return self.send_recv(command_dict) +def request_breakpointLocations(self, file_path, line, end_line=None, column=None, end_column=None): +(dir, base) = os.path.split(file_path) +source_dict = {"name": base, "path": file_path} +args_dict = {} +args_dict["source"] = source_dict +if line is not None: + args_dict["line"] = line +if end_line is not None: +args_dict["endLine"] = end_line +if column is not None: +args_dict["column"] = column +if end_column is not None: +args_dict["endColumn"] = end_column +command_dict = {"command": "breakpointLocations", "type": "request", "arguments": args_dict} +return self.send_recv(command_dict) + def request_configurationDone(self): command_dict = { "command": "configurationDone", @@ -912,18 +928,14 @@ def request_setBreakpoints(self, file_path, line_array, data=None): breakpoint_data = data[i] bp = {"line": line} if breakpoint_data is not None: -if "condition" in breakpoint_data and breakpoint_data["condition"]: +if breakpoint_data.get("condition"): bp["condition"] = breakpoint_data["condition"] -if ( -"hitCondition" in breakpoint_data -and breakpoint_data["hitCondition"] -): +if breakpoint_data.get("hitCondition"): bp["hitCondition"] = breakpoint_data["hitCondition"] -if ( -"logMessage" in breakpoint_data -and breakpoint_data["logMessage"] -): +if breakpoint_data.get("logMessage"): bp["logMessage"] = breakpoint_data["logMessage"] +if breakpoint_data.get("column"): +bp["column"] = breakpoint_data["column"] breakpoints.append(bp) args_dict["breakpoints"] = breakpoints diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile index 7634f513e85233..06438b3e6e3139 100644 --- a/lldb/test/API/tools/lldb-dap/breakpoint/Makefile +++ b/lldb/test/API/tools/lldb-dap/breakpoint/Makefile @@ -16,4 +16,4 @@ main-copy.cpp: main.cpp # The following shared library will be used to test breakpoints under dynamic loading libother: other-copy.c "$(MAKE)" -f $(MAKEFILE_RULES) \ - DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other + DYLIB_ONLY=YES DYLIB_C_SOURCES=other-copy.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py new file mode 100644 index 00..d84ce843e3fba8 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_b