[Lldb-commits] [lldb] LLDB: correct event when removing all watchpoints (PR #125312)

2025-02-01 Thread Ben Jackson via lldb-commits

puremourning wrote:

Yes, on it. Sorry I should have marked this PR [wip].

https://github.com/llvm/llvm-project/pull/125312
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [WIP] LLDB: correct event when removing all watchpoints (PR #125312)

2025-02-01 Thread Ben Jackson via lldb-commits

https://github.com/puremourning edited 
https://github.com/llvm/llvm-project/pull/125312
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Store the command in the CommandReturnObject (PR #125132)

2025-02-01 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

> This looks good. I wonder if we ought to do something a little less ad hoc 
> about the cases where our command return objects are from HandleCommands, so 
> they won't necessarily have the result of a single command. In the case where 
> a UI is parsing these, it might very well need to know that fact. They all 
> currently have `<>` around the command name, but sadly we don't outlaw `<` as 
> the initial character of a command, so you can't 100% tell from that.

I can add an enum to indicate whether the command was a user command or 
something LLDB put together and have two constructors that each do the 
appropriate thing. `GetCommand` could then return a predefined value for 
non-user commands. 

https://github.com/llvm/llvm-project/pull/125132
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [WIP] LLDB: correct event when removing all watchpoints (PR #125312)

2025-02-01 Thread Ben Jackson via lldb-commits

https://github.com/puremourning updated 
https://github.com/llvm/llvm-project/pull/125312

>From 6af277d30baaa1c8ff56bb4da13a6687dfa0c729 Mon Sep 17 00:00:00 2001
From: Ben Jackson 
Date: Fri, 31 Jan 2025 22:38:04 +
Subject: [PATCH] LLDB: correct event when removing all watchpoints

Previously we incorrectly checked for a "breakpoint changed" event
listener removing all watchpoints (e.g. via
SBTarget::DeleteAllWatchpoints()), although we would emit a "watchpoint
changed" event if there were a listener for 'breakpoint changed'.

This meant that we might not emit a "watchpoint changed" event if there
was a listener for this event.

Correct it to check for the "watchpoint changed" event.
---
 lldb/source/Breakpoint/WatchpointList.cpp |  2 +-
 .../watchpoint_events/TestWatchpointEvents.py | 52 +--
 2 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/lldb/source/Breakpoint/WatchpointList.cpp 
b/lldb/source/Breakpoint/WatchpointList.cpp
index f7564483e6f1fcd..57369b76c03aff0 100644
--- a/lldb/source/Breakpoint/WatchpointList.cpp
+++ b/lldb/source/Breakpoint/WatchpointList.cpp
@@ -236,7 +236,7 @@ void WatchpointList::RemoveAll(bool notify) {
   wp_collection::iterator pos, end = m_watchpoints.end();
   for (pos = m_watchpoints.begin(); pos != end; ++pos) {
 if ((*pos)->GetTarget().EventTypeHasListeners(
-Target::eBroadcastBitBreakpointChanged)) {
+Target::eBroadcastBitWatchpointChanged)) {
   auto data_sp = std::make_shared(
   eWatchpointEventTypeRemoved, *pos);
   (*pos)->GetTarget().BroadcastEvent(
diff --git 
a/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py 
b/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
index 726a9d93c29d460..6e05cf06204a7d5 100644
--- 
a/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
+++ 
b/lldb/test/API/commands/watchpoints/watchpoint_events/TestWatchpointEvents.py
@@ -82,27 +82,45 @@ def test_with_python_api(self):
 'make sure watchpoint condition is "' + condition + '"',
 )
 
-def GetWatchpointEvent(self, event_type):
-# We added a watchpoint so we should get a watchpoint added event.
-event = lldb.SBEvent()
-success = self.listener.WaitForEvent(1, event)
-self.assertTrue(success, "Successfully got watchpoint event")
-self.assertTrue(
-lldb.SBWatchpoint.EventIsWatchpointEvent(event),
-"Event is a watchpoint event.",
+target.DeleteWatchpoint(local_watch.GetID())
+self.GetWatchpointEvent(
+lldb.eWatchpointEventTypeDisabled, lldb.eWatchpointEventTypeRemoved
 )
-found_type = lldb.SBWatchpoint.GetWatchpointEventTypeFromEvent(event)
-self.assertEqual(
-found_type,
-event_type,
-"Event is not correct type, expected: %d, found: %d"
-% (event_type, found_type),
+
+# Re-create it so that we can check DeleteAllWatchpoints
+local_watch = local_var.Watch(True, False, True, error)
+if not error.Success():
+self.fail(
+"Failed to make watchpoint for local_var: %s" % 
(error.GetCString())
+)
+self.GetWatchpointEvent(lldb.eWatchpointEventTypeAdded)
+target.DeleteAllWatchpoints()
+self.GetWatchpointEvent(
+lldb.eWatchpointEventTypeDisabled, lldb.eWatchpointEventTypeRemoved
 )
+
+def GetWatchpointEvent(self, *event_types):
+# We added a watchpoint so we should get a watchpoint added event.
+event = lldb.SBEvent()
+for event_type in event_types:
+success = self.listener.WaitForEvent(1, event)
+self.assertTrue(success, "Successfully got watchpoint event")
+self.assertTrue(
+lldb.SBWatchpoint.EventIsWatchpointEvent(event),
+"Event is a watchpoint event.",
+)
+found_type = 
lldb.SBWatchpoint.GetWatchpointEventTypeFromEvent(event)
+self.assertEqual(
+found_type,
+event_type,
+"Event is not correct type, expected: %d, found: %d"
+% (event_type, found_type),
+)
 # There shouldn't be another event waiting around:
 found_event = self.listener.PeekAtNextEventForBroadcasterWithType(
-self.target_bcast, lldb.SBTarget.eBroadcastBitBreakpointChanged, 
event
+self.target_bcast, lldb.SBTarget.eBroadcastBitWatchpointChanged, 
event
 )
 if found_event:
-print("Found an event I didn't expect: ", event)
+print("Found an event I didn't expect: ", event.GetType())
 
-self.assertTrue(not found_event, "Only one event per change.")
+self.assertTrue(not found_event, f"Only expected {len(event_types)} 
events.")

_

[Lldb-commits] [lldb] LLDB: correct event when removing all watchpoints (PR #125312)

2025-02-01 Thread Ben Jackson via lldb-commits

https://github.com/puremourning edited 
https://github.com/llvm/llvm-project/pull/125312
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [WIP] LLDB: correct event when removing all watchpoints (PR #125312)

2025-02-01 Thread Ben Jackson via lldb-commits

puremourning wrote:

Done. The test fails (expectedly) at the line following "DeleteAllWatchpoints" 
prior to this patch, and passes after.

https://github.com/llvm/llvm-project/pull/125312
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [WIP] LLDB: correct event when removing all watchpoints (PR #125312)

2025-02-01 Thread Ben Jackson via lldb-commits

https://github.com/puremourning edited 
https://github.com/llvm/llvm-project/pull/125312
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] WatchAddress ignores modify option (PR #124847)

2025-02-01 Thread Ben Jackson via lldb-commits

https://github.com/puremourning edited 
https://github.com/llvm/llvm-project/pull/124847
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] correct event when removing all watchpoints (PR #125312)

2025-02-01 Thread Ben Jackson via lldb-commits

https://github.com/puremourning edited 
https://github.com/llvm/llvm-project/pull/125312
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add logging for missing `.dwo` files (PR #116436)

2025-02-01 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang closed 
https://github.com/llvm/llvm-project/pull/116436
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add logging for missing `.dwo` files (PR #116436)

2025-02-01 Thread Adrian Vogelsgesang via lldb-commits

vogelsgesang wrote:

yes, that is sufficient. Didn't know about `image dump separate-debug-info`

https://github.com/llvm/llvm-project/pull/116436
___
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 #125347)

2025-02-01 Thread Adrian Vogelsgesang via lldb-commits

https://github.com/vogelsgesang created 
https://github.com/llvm/llvm-project/pull/125347

This commit adds support for column breakpoints to lldb-dap.

To do so, support for the `breakpointLocations` request 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.

This was previously submitted as #113787, but got reverted due to failures
on ARM and macOS. This second attempt has less strict test case
expectations. Also, I added a release note.

>From 88134b8e891008715ca8ea90e809cac04f5b60f5 Mon Sep 17 00:00:00 2001
From: Adrian Vogelsgesang 
Date: Sat, 16 Nov 2024 19:01:12 +0100
Subject: [PATCH 1/3] [lldb-dap] Support column breakpoints (#113787)

This commit adds support for column breakpoints to lldb-dap.

To do so, support for the `breakpointLocations` request 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 |  38 +++-
 .../test/tools/lldb-dap/lldbdap_testcase.py   |   3 +-
 .../API/tools/lldb-dap/breakpoint/Makefile|   2 +-
 .../breakpoint/TestDAP_breakpointLocations.py |  85 
 .../breakpoint/TestDAP_setBreakpoints.py  | 170 +--
 lldb/tools/lldb-dap/DAP.h |   3 +-
 lldb/tools/lldb-dap/lldb-dap.cpp  | 199 +-
 7 files changed, 418 insertions(+), 82 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 c29992ce9c7848..043d82e2e2c7d1 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,28 @@ 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",
@@ -851,6 +873,8 @@ def request_next(self, threadId, granularity="statement"):
 def request_stepIn(self, threadId, targetId, granularity="statement"):
 if self.exit_status is not None:
 raise ValueError("request_stepIn called after process exited")
+if threadId is None:
+threadId = self.get_thread_id()
 args_dict = {
 "threadId": threadId,
 "targetId": targetId,
@@ -911,18 +935,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_da

[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #125347)

2025-02-01 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Vogelsgesang (vogelsgesang)


Changes

This commit adds support for column breakpoints to lldb-dap.

To do so, support for the `breakpointLocations` request 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.

This was previously submitted as #113787, but got reverted due to 
failures
on ARM and macOS. This second attempt has less strict test case
expectations. Also, I added a release note.

---

Patch is 28.44 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/125347.diff


8 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
(+29-9) 
- (modified) 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (+2-1) 
- (modified) lldb/test/API/tools/lldb-dap/breakpoint/Makefile (+1-1) 
- (added) 
lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py (+88) 
- (modified) lldb/test/API/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py 
(+102-68) 
- (modified) lldb/tools/lldb-dap/DAP.h (+2-1) 
- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+197-2) 
- (modified) llvm/docs/ReleaseNotes.md (+4) 


``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 c29992ce9c7848..043d82e2e2c7d1 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,28 @@ 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",
@@ -851,6 +873,8 @@ def request_next(self, threadId, granularity="statement"):
 def request_stepIn(self, threadId, targetId, granularity="statement"):
 if self.exit_status is not None:
 raise ValueError("request_stepIn called after process exited")
+if threadId is None:
+threadId = self.get_thread_id()
 args_dict = {
 "threadId": threadId,
 "targetId": targetId,
@@ -911,18 +935,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/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index a25466f07fa557..34e9b96dbcc3f5 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lld

[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #125347)

2025-02-01 Thread Adrian Vogelsgesang via lldb-commits

vogelsgesang wrote:

@Micahel137 Do you know if there is any way I could manually trigger the 
`lldb-aarch64-ubuntu` and the MacOS CI before merging this, to get CI feedback 
before merging this?

https://github.com/llvm/llvm-project/pull/125347
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Bugfix: Not showing the synthetic children of values behind pointers (PR #117755)

2025-02-01 Thread Sergey Kuznetsov via lldb-commits

skuznetsov wrote:

> > @clayborg Thank you, Greg! Lots of that info is not described anywhere, no 
> > wonder I missed it. Let me try your fixes in my provider, and I will get 
> > back to you.
> > By some reason my provider works in CLI lldb, but not in lldb-dap, but I 
> > will check if your suggestions will help to fix that.
> 
> Let me know if this fixes things. I believe it will.

I tried your approach and your recommended code changes, but it does not work 
without my patch for some strange reason. :(

https://github.com/llvm/llvm-project/pull/117755
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits