10 Commits

Author SHA1 Message Date
Ebuka Ezike
0b8a656ba1
[lldb-dap] Fix source references (#144364)
The
[protocol](https://microsoft.github.io/debug-adapter-protocol//specification.html#Types_Source)
expects that `sourceReference` be less than `(2^31)-1`, but we currently
represent memory address as source reference, this can be truncated
either when sending through json or by the client. Instead, generate new
source references based on the memory address.

Make the `ResolveSource` function return an optional source.
2025-06-26 18:22:47 +01:00
Ely Ronnen
e972d8cbbf
[lldb-dap] assembly breakpoints (#139969)
* Support assembly source breakpoints
* Change `sourceReference` to be the symbol load address for simplicity
and consistency across threads/frames

[Screencast From 2025-05-17
23-57-30.webm](https://github.com/user-attachments/assets/2e7c181d-42c1-4121-8f13-b180c19d0e33)
2025-05-21 21:13:32 +02:00
Ely Ronnen
51dc0cc7a4
[lldb-dap] Handle stack frames without a module (#136777)
* Fix error in lldb-dap when the stack trace contains a frame without a
module by simply showing the first 32 assembly instructions after the PC.
* Adds a test with a simple example that triggers this case.
2025-04-25 09:30:09 -07:00
Ely Ronnen
563ab56497
[lldb-dap] Show load addresses in disassembly (#136755)
Improves the lldb-dap disassembly by showing load addresses in
disassembly, same as in a regular LLDB `disassemble` command by default.

Before:

![Screenshot From 2025-04-22
21-33-56](https://github.com/user-attachments/assets/c3febd48-8335-4932-a270-5a87f48122fe)


After:

![Screenshot From 2025-04-22
21-54-51](https://github.com/user-attachments/assets/b2f44595-8ab2-4f28-aded-9233c53a589b)
2025-04-23 13:04:39 -07:00
John Harrison
30bb0c443e
[lldb-dap] Adding a DAPError for showing users error messages. (#132255)
The `DAPError` can be used to craft an error message that is displayed
to a user (with showUser=true).

Any request handler implementation using subclassing `RequestHandler<>`
should be able to use this.

I updated SourceRequestHandler to report DAPError's specifically.
2025-03-20 15:33:05 -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
Jonas Devlieghere
b53e75711c
[lldb-dap] Replace Get{Signed,Unsigned} with GetInteger<T> (NFC) (#129823)
Replace Get{Signed,Unsigned} with GetInteger<T> and return std::optional
so you can distinguish between the value not being present and it being
explicitly set to the previous fail_value. All existing uses are
replaced by calling value_or(fail_value).

Continuation of #129818
2025-03-05 09:06:14 -08:00
John Harrison
162eb32e74
[lldb-dap] Add 'source' references to stack frames without source files. (#128268)
This adds 'source' references to all stack frames. When opening a stack
frame users will see the disassembly of the frame if the source is not
available.

This works around the odd behavior of navigating frames without the
VSCode disassembly view open, which causes 'step' to step in the first
frame with a source instead of the active frame.

This fixes #128260

Old behavior:

https://github.com/user-attachments/assets/3f40582d-ac96-451a-a5ae-498a323bf30e

New behavior:

https://github.com/user-attachments/assets/3a3f9ac6-3e6c-4795-9bb2-1132b3916b6f

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-02-24 14:56:28 -08:00
Jonas Devlieghere
911e94c651
[lldb-dap] Finish refactoring the request handlers (NFC) (#128553)
Completes the work started in #128262. This PR removes the
old way of register request handlers with callbacks and makes
the operator const.
2025-02-24 16:46:12 -06:00
Jonas Devlieghere
38d7cf1a81
[lldb-dap] Refactor remaining request handlers (NFC)Remaining request handlers (#128551)
Continuation of the work started in #128262. Builds on top of #128550.
2025-02-24 15:56:13 -06:00