28 Commits

Author SHA1 Message Date
Muhammad Omair Javaid
2b8e806942 Revert "[lldb-dap] Add module symbol table viewer to VS Code extension #140626 (#153836)"
This reverts commit 8b64cd8be29da9ea74db5a1a21f7cd6e75f9e9d8.

This breaks lldb-aarch64-* bots causing a crash in lldb-dap while
running test TestDAP_moduleSymbols.py

https://lab.llvm.org/buildbot/#/builders/59/builds/22959
https://lab.llvm.org/buildbot/#/builders/141/builds/10975
2025-08-22 13:02:52 +05:00
Ely Ronnen
8b64cd8be2
[lldb-dap] Add module symbol table viewer to VS Code extension #140626 (#153836)
- VS Code extension:
- Add module symbol table viewer using
[Tabulator](https://tabulator.info/) for sorting and formatting rows.
  - Add context menu action to the modules tree.
 - lldb-dap
   -  Add `DAPGetModuleSymbolsRequest` to get symbols from a module.
 
Fixes #140626

[Screencast From 2025-08-15
19-12-33.webm](https://github.com/user-attachments/assets/75e2f229-ac82-487c-812e-3ea33a575b70)
2025-08-21 00:31:48 +02:00
John Harrison
93d94690c9
[lldb-dap] Updating protocol memory references to lldb::addr_t. (#148037)
This updates all the existing memory reference fields to use
`lldb::addr_t` directly.

A few places were using `std::string` and decoding the value in the
request handler and other places had unique ways of parsing addresses.

This unifies all of these references with the `DecodeMemoryReference`
helper in JSONUtils.h.

Additionally, for the types I updated, I tried to simplify the POD types
some and moved default values out of RequestHandlers and into the
protocol POD types.
2025-07-11 16:14:52 -07:00
Druzhkov Sergei
9098bffb03
[lldb-dap] Add external terminal support (#146950)
This patch deprecates the `runInTerminal` option in favour of `console`
which allow the user the specify an integrated or external option.
2025-07-11 11:14:59 +01:00
John Harrison
4b6e54a8cf
[lldb-dap] Migrate variables request protocol types. (#147611)
This adds new protocol types for the 'variables' request.

While implementing this, I removed the '$__lldb_extension' field we
returned on the 'variables' request, since I think all the data can be
retrieved from other DAP requests.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-07-10 10:10:00 -07:00
Santhosh Kumar Ellendula
76b1dcfac5
[lldb][lldb-dap] Added support for "WriteMemory" request. (#131820)
Added debug adapter support for write memory.

---------

Co-authored-by: Santhosh Kumar Ellendula <sellendu@hu-sellendu-hyd.qualcomm.com>
Co-authored-by: Santhosh Kumar Ellendula <sellendu@hu-sellendu-lv.qualcomm.com>
2025-07-10 01:59:20 +05:30
Ebuka Ezike
03a27230c9
[lldb-dap] Use protocol types for modules request and events. (#146966)
Update tests to fix silently failing test and handle when a module is
removed.
2025-07-08 22:43:53 +01:00
Ebuka Ezike
51aa6a4993
[lldb-dap] Use protocol types for ReadMemory request (#144552)
Read memory from process instead of target.
2025-06-18 22:48:24 +01:00
John Harrison
6421bd94ea
[lldb-dap] Creating protocol types for setExceptionBreakpoints. (#144153)
This adds new types for setExceptionBreakpoints and adds support for
`supportsExceptionFilterOptions`, which allows exception breakpoints to
set a condition.

While testing this, I noticed that obj-c exception catch breakpoints may
not be working correctly in lldb-dap.
2025-06-16 17:24:48 -07:00
Ebuka Ezike
539cf82425
[lldb-dap] Use structured types for stepInTargets request (#144072)
uses the `SendTargetCapabilities` from #142831
2025-06-16 19:24:59 +01:00
John Harrison
52075f01a7
[lldb-dap] Migrating 'threads' request to structured types. (#142510)
Moving `threads` request to structured types. Adding helper types for
this and moving helpers from JSONUtils to ProtocolUtils.

---------

Co-authored-by: Ebuka Ezike <yerimyah1@gmail.com>
Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-06-05 15:58:30 -07:00
Jonas Devlieghere
d8ba707b0c
Revert "[lldb-dap] Use structured types for stepInTargets request (#142439)" (#142891)
This reverts commit 4b6c608615a285d81132acf8e33b81b2ec2c9bf9 and
follow-up commits 159de3633640a5cb2d322ebe8cc4ec0c1c9a896d and
c9e1c52e2e75a91a44a98df818cc9bd11655e51d because this breaks
TestDAP_stepInTargets.py on Darwin.

https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake
2025-06-04 20:19:56 -07:00
Ebuka Ezike
4b6c608615
[lldb-dap] Use structured types for stepInTargets request (#142439) 2025-06-04 08:05:31 +01:00
Ely Ronnen
30c9909909
[lldb-dap] Migrate disassemble request to structured handler (#140482) 2025-05-19 22:13:58 +02:00
Ebuka Ezike
4ba8f4e213
[lldb][lldb-dap] Migrate ScopesRequest to structured types (#138116)
Migrate ScopesRequest To use the Protocol Types
2025-05-15 10:16:05 +01:00
Ely Ronnen
8630c22083
[lldb-dap] migrate set breakpoint requests (#137448)
- Migrate set breakpoint requests to use typed RequestHandler
  - `SetBreakpointsRequestHandler`
  - `SetDataBreakpointsRequestHandler`
  - `SetFunctionBreakpointsRequestHandler`
  - `SetInstructionBreakpointsRequestHandler`
  - `DataBreakpointInfoRequestHandler`
- Decouple JSON from lldb-dap `Breakpoint` classes
2025-05-10 00:05:59 +02:00
Ely Ronnen
98181200db
[lldb-dap] Migrating breakpointLocations request to use typed RequestHandler (#137426)
* Migrating breakpointLocations request to use typed RequestHandle 
* Preliminary step in order to implement assembly source breakpoints
2025-05-09 18:29:06 +02:00
John Harrison
03896403d3
[lldb-dap] Migrate attach to typed RequestHandler. (#137911)
This updates the `attach` request to the typed
`RequestHandler<protocol::AttachRequestArguments,
protocol::AttachResponse>`.

Added a few more overlapping configurations to
`lldb_dap::protocol::Configuration` that are shared between launching
and attaching.

There may be some additional code we could clean-up that is no longer
referenced now that this has migrated to use well defined types.
2025-05-08 14:12:49 -07:00
John Harrison
155bf37ad9
[lldb-dap] Migrate 'continue' request to new RequestHandler. (#138987)
This adds types for the 'continue' request and updates the existing
handler to the new base class.
2025-05-08 08:43:41 -07:00
Ebuka Ezike
e8adb3add5
[lldb][lldb-dap] use the new protocol for setVariable requests. (#137803)
```cpp

// The "id" is the unique integer ID that is unique within the enclosing
// variablesReference. It is optionally added to any "interface
Variable"
  // objects to uniquely identify a variable within an enclosing
// variablesReference. It helps to disambiguate between two variables
that
// have the same name within the same scope since the "setVariables"
request
// only specifies the variable reference of the enclosing
scope/variable, and
// the name of the variable. We could have two shadowed variables with
the
// same name in "Locals" or "Globals". In our case the "id" absolute
index
  // of the variable within the dap.variables list.
  const auto id_value =
      GetInteger<uint64_t>(arguments, "id").value_or(UINT64_MAX);
  if (id_value != UINT64_MAX) {
```
I dropped this part because. variables that have the same name has a ` @path` suffix on both of them. 
and the setVariableArguments does not have a field called `id`.
2025-05-06 13:41:45 +01:00
John Harrison
695769971d
[lldb-dap] Migrating the 'stepOut' request to use typed RequestHandler. (#137362)
This moves the 'stepOut' request to the typed RequestHandler.
2025-04-25 13:34:52 -07:00
John Harrison
a0aa5f8933
[lldb-dap] Refactoring lldb-dap 'launch' request to use typed RequestHandler<>. (#133624)
This converts a number of json::Value's into well defined types that are
used throughout lldb-dap and updates the 'launch' command to use the new
well defined types.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-04-25 09:50:42 -07:00
John Harrison
6ba704a7f4
[lldb-dap] Migrate 'stepIn' request to well structured types. (#137071)
Migrates the 'stepIn' request handler to have well structured types
instead of raw json values.

I also noticed in the 'next' request handler we were not passing the
'RunMode' flag. Updated the 'next' request handler as well.
2025-04-23 17:13:03 -07:00
John Harrison
1041d54bd4
[lldb-dap] Updating the 'next' request handler use well structured types (#136642)
This updates the 'next' request to use well structured types. While
working on this I also simplified the 'RequestHandler' implementation to
better handle void responses by allowing requests to return a
'llvm::Error' instead of an 'llvm::Expected<std::monostate>'. This makes
it easier to write and understand request handles that have simple ack
responses.
2025-04-23 10:18:31 -07:00
John Harrison
14cb6566d6
[lldb-dap] Improve error reporting for dap command arguments. (#135684)
Previously the error only contained the failed to parse JSON message,
which has no additional context.

This improves the error messages and improves the consistency of
handling properties in protocol structures. Updating the fields to use
'ObjectMapper.map' instead of 'ObjectMapper.mapOptional' caught that
adapterID was misspelled as well.

For example, previously:

```
$ echo 'Content-Length: 81\r\n\r\n{"type":"request","command":"initialize","seq":1,"arguments":{"adapterID":12345}} | lldb-dap
```

Worked without an error but now it reports:

```
invalid arguments for request 'initialize': expected string at arguments.adapterID
{
  "adapterID": /* error: expected string */ 12345
}
```
2025-04-15 13:30:33 -07:00
John Harrison
2d30a60e9f
[lldb-dap] Adding support for cancelling a request. (#130169)
Adding support for cancelling requests.

There are two forms of request cancellation.

* Preemptively cancelling a request that is in the queue.
* Actively cancelling the in progress request as a best effort attempt
using `SBDebugger.RequestInterrupt()`.
2025-04-14 08:29:02 -07:00
John Harrison
6526cda5d8
[lldb-dap] Migrating DAP 'initialize' to new typed RequestHandler. (#133007)
This adds new types and helpers to support the 'initialize' request with
the new typed RequestHandler. While working on this I found there were a
few cases where we incorrectly treated initialize arguments as
capabilities. The new `lldb_dap::protocol::InitializeRequestArguments`
and `lldb_dap::protocol::Capabilities` uncovered the inconsistencies.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-03-28 09:13:10 -07:00
John Harrison
fbb8929c9d
[lldb-dap] Updating RequestHandler to encode/decode arguments and response. (#130090)
This is a work in progress refactor to add explicit types instead of
generic 'llvm::json::Value' types to the DAP protocol.

This updates RequestHandler to have take the type of the arguments and
response body for serialization for requests.

The 'source' and 'disconnect' request is updated to show how the new
flow
works and includes serialization handling for optional arguments and
'void'
responses.

This is built on top of #130026

---------

Co-authored-by: Adrian Vogelsgesang <adrian.vogelsgesang@tum.de>
2025-03-17 10:13:11 -07:00