Commit Graph

650 Commits

Author SHA1 Message Date
David Spickett
16aa79d444 [lldb][docs] Fix table formatting in bytecode docs
Me adding extra backticks caused all these to be misaligned.

This didn't show up on the docs buildbot but did error in
CI on a later PR of mine.
2025-12-10 11:38:20 +00:00
David Spickett
0e7adf2d72 [lldb][docs] Describe how to check enabled features (#171468)
This makes use of `version -v` added by #170772,
along with fallback methods for LLDB prior to 22.

1. version --verbose (won't work prior to 22)
2. Scripting to call GetBuildConfiguration (won't work if you don't have
a scripting language
3. readelf/other platform's equivalent utility

readelf is recommended for Linux due to security concerns with ldd.

https://man7.org/linux/man-pages/man1/ldd.1.html
"some versions of ldd may attempt to obtain the
dependency information by attempting to directly
execute the program"

The drawback to that is it doesn't show dependencies of dependencies, so
I've noted that. People can use ldd if they trust the binary, but I've
made it clear how to avoid that and why you should avoid it.
2025-12-10 11:29:37 +00:00
David Spickett
86849629ae [lldb][docs] Remove dead link in toctree
Fixes warning:
index.rst:144: WARNING: toctree contains reference to nonexisting document 'use/python'

There used to be such a page but the URL now redirects
to "script-driven-debugging" which is in the "Python Reference"
section.
2025-12-10 09:59:12 +00:00
David Spickett
d9291f18ec [lldb][docs] Fix doc link syntax in bytecode formatter doc
This was flagged after the changes in 53674e2da4.

Fixes warning:
formatterbytecode.rst:7: WARNING: 'any' reference target not found: ). To use custom data formatters, developers need to edit the global ``~/.lldbinit`
2025-12-10 09:56:32 +00:00
David Spickett
680c20d1e3 [lldb] Document the behaviour of IsValid for SBError (#170862)
This reverts commit d20d84fec5.

Fixes #169788, but in a different way.

In which I changed an SBError use so that when the function succeeded,
IsValid on the SBError would be true.

This seemed to make sense but SBError acts differently to other SB
classes in this respect. For something like SBMemoryRegionInfo, if
IsValid() is false, you can't do anything with it.

However for SBError, IsValid() true only means there's some underlying
error object in there. If the SBError represents a success, there's no
need to put anything in there.

You can see this intent from a lot of its methods, many have handling
for IsValid() false.

This is not a bug but a misunderstanding of what IsValid means. Yes it
does function the way I expected for most classes, but it does not for
SBError and though that's not intuitive, it is consistent with how we
describe IsValid in the documentation.

So instead of changing that method's use of SBError I'm documenting this
initially counterintuitive behaviour in the SBError header and on the
website (https://lldb.llvm.org/resources/sbapi.html).
2025-12-10 09:43:36 +00:00
David Spickett
53674e2da4 [lldb][docs] Fix plaintext markers in Formatter bytecode doc (#171430)
RST uses double backtick for plain text. For single backtick it will try
to resolve it to a reference then fall back to plain text if it doesn't
resolve.

This leads to a lot of warnings like:
formatterbytecode.rst:7: WARNING: 'any' reference target not found:
~/.lldbinit

As seen on the publish-sphinx-docs bot.
2025-12-10 09:29:48 +00:00
David Spickett
0aa8b82923 [lldb][docs] Fix plaintext markers in command map
Single backticks RST tries to resolve to a reference.
Double means plaintext.

Fixes these warnings:
map.rst:803: WARNING: 'any' reference target not found: target.prefer-dynamic-value
map.rst:814: WARNING: 'any' reference target not found: expr
2025-12-09 17:28:29 +00:00
David Spickett
ab8208f4f1 [lldb][docs] Fix Visual Studio link in build doc
Fixes warning:
build.rst:107: WARNING: 'any' reference target not found: https://visualstudio.microsoft.com
2025-12-09 17:25:55 +00:00
David Spickett
b1ef2db4c6 [lldb][docs] Fix header level warnings in a few documents
All these are using H1 for the main heading but H3 for the
rest, Sphinx warns about this:
WARNING: Non-consecutive header level increase; H1 to H3 [myst.header]
2025-12-09 12:49:19 +00:00
David Spickett
afb3852c8b [lldb][docs] Fix title formatting in Variable document 2025-12-09 12:44:50 +00:00
David Spickett
2cb8e526f7 [lldb][docs] Fix plain text markers in Contributing
RST tries to resolve things in single backticks to a reference,
which is not the intention here. Double backticks indicates
plain text formatting.

Fixes warnings in the docs build:
contributing.rst:92: WARNING: 'any' reference target not found: A1
contributing.rst:92: WARNING: 'any' reference target not found: B1
contributing.rst:92: WARNING: 'any' reference target not found: B2
contributing.rst:92: WARNING: 'any' reference target not found: A2
contributing.rst:95: WARNING: 'any' reference target not found: A1->B1
contributing.rst:95: WARNING: 'any' reference target not found: B2->C2
contributing.rst:95: WARNING: 'any' reference target not found: C3->A3
contributing.rst💯 WARNING: 'any' reference target not found: LLDB_ACCEPTABLE_PLUGIN_DEPENDENCIES
contributing.rst💯 WARNING: 'any' reference target not found: LLDB_TOLERATED_PLUGIN_DEPENDENCIES
2025-12-09 12:44:00 +00:00
David Spickett
870aa89fbc [lldb][docs] Remove syntax hint from some output blocks
This tries to parse the block as that language but in these
cases fails because they aren't purely that language. This
falls back to a permissive mode which is fine, but highlights
the invalid tokens like errors which isn't great.

Instead don't try to highlight these blocks. This fixes 4
warnings seen in the docs build:
lldb/docs/use/tutorials/custom-frame-recognizers.md:43: WARNING: Lexing literal_block <...> as "c++" resulted in an error at token: '#'. Retrying in relaxed mode.
lldb/docs/use/tutorials/script-driven-debugging.md:175: WARNING: Lexing literal_block <...> as "c++" resulted in an error at token: '#'. Retrying in relaxed mode.
lldb/docs/use/tutorials/script-driven-debugging.md:426: WARNING: Lexing literal_block <...> as "c++" resulted in an error at token: '#'. Retrying in relaxed mode.
lldb/docs/use/tutorials/writing-custom-commands.md:416: WARNING: Lexing literal_block <...> as "python3" resulted in an error at token: '$'. Retrying in relaxed mode.
2025-12-09 12:41:19 +00:00
David Spickett
31c03c93b1 [lldb][docs] Fix plaintext marker in variables doc
Single backtick tries to make a reference to something
and if that fails, renders as plain text.

These 3 weren't finding a reference and so produced
a warning:
variable.rst:975: WARNING: 'any' reference target not found: max_children
2025-12-09 12:32:48 +00:00
Med Ismail Bennani
0dcbc870ed [lldb/docs] Add ScriptingFrameProvider documentation to the website
This patch adds the documentation for ScriptedFrameProviders to the
lldb website.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-03 03:11:10 -08:00
Med Ismail Bennani
4286a474b4 Revert "[lldb/docs] Add ScriptingFrameProvider documentation to the website"
This reverts commit bfde296d08.
2025-12-03 03:11:10 -08:00
Med Ismail Bennani
bfde296d08 [lldb/docs] Add ScriptingFrameProvider documentation to the website
This patch adds the documentation for ScriptedFrameProviders to the
lldb website.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-12-03 02:48:01 -08:00
Max Desiatov
94c8940f44 lldbgdbremote.md: Update qWasmLocal result description (#170393)
The current description mistakenly specified that an address of a local
value in some address space is returned. When testing this with Wasm
runtimes that already implement this command, it can be observed that
the value itself is returned. The value itself may be an address for
languages that use shadow stack in Wasm linear memory, but the value of
an arbitrary local does not always contain that address.
2025-12-02 16:27:14 -08:00
cmtice
728cada359 [LLDB] Add type casting to DIL, part 1 of 3. (#165199)
This is an alternative to
https://github.com/llvm/llvm-project/pull/159500, breaking that PR down
into three separate PRs, to make it easier to review.

This first PR of the three adds the basic framework for doing type
casing to the DIL code, but it does not actually do any casting: In this
PR the DIL parser only recognizes builtin type names, and the DIL
interpreter does not do anything except return the original operand (no
casting). The second and third PRs will add most of the type parsing,
and do the actual type casting, respectively.
2025-12-01 20:08:19 -08:00
Ilia Kuklin
d5927a6172 [LLDB] Add unary plus and minus to DIL (#155617)
This patch adds unary nodes plus and minus, introduces unary type
conversions, and adds integral promotion to the type system.
2025-11-24 19:08:53 +05:00
Jonas Devlieghere
0f12abe47c [lldb] Building the documentation should not depend on libLLDB (#168962)
The only thing the docs should depend on is on the SWIG wrapper
(lldb.py) which only requires parsing the API headers. It should not
depend on building libLLDB.

The dependency was (I believe accidentally) introduced by 59f4267.

Fixes #123316
2025-11-20 14:51:34 -08:00
David Spickett
19bf0adfd0 [lldb][docs] Add troubleshooting section to scripting introduction
Logs just helped someone on Discord debug an issue in a way that would
not have been possible just by stepping the Python script. It was that
LLDB could not find the lldb-server binary.

We do talk about logs elsewhere but I think it's fine to repeat
here since it's a lot of people's first experience with scripting.
2025-10-31 14:02:30 +00:00
Charles Zablit
c2aa22f3ce [docs][lldb] update the Windows tools instructions (#164491)
This patch updates the instructions explaining how to install the
required tools for building `lldb` on Windows, mostly removing the
duplication and removing references to `GnuWin32` which still has
executables built in 2009 and is no longer functional per their website.
2025-10-28 16:26:04 -07:00
David Spickett
33185e7d43 [lldb][docs] Add example output for standalone debugging script
Varies by host but I think it's useful to give some expectation.
2025-10-27 10:13:09 +00:00
Max Desiatov
e960f1ec47 Refine qWasmCallStack documentation (#163803)
`qWasmCallStack` documentation is not clear enough in how the list of PC
values is delimited and the size of these values.
2025-10-21 13:26:28 -07:00
Jason Molenda
32b534b192 [lldb][doc NFC] fix typeo in reason:watchpoint desc 2025-10-20 15:30:43 -07:00
Felipe de Azevedo Piovezan
e91786a849 [gdbremote] Document MultiMemRead packet in protocol extensions (#162675)
This adds a specification for the new packet discussed in the RFC [1].

[1]:
https://discourse.llvm.org/t/rfc-a-new-vectorized-memory-read-packet/88441/12
2025-10-15 08:02:39 -07:00
David Spickett
fca40b3b6f [lldb][docs] State that the extension packets doc should be alphabetised
I did this when I converted it but never stated so. Adding a comment
stating so. We'll probably forget at some point but might as well.

Also moved the x packet to the last place, after wasm which was
added to the end recently.
2025-10-10 15:03:54 +00:00
jimingham
36bce68b97 Add a scripted way to re-present a stop location (#158128)
This patch adds the notion of "Facade" locations which can be reported
from a ScriptedResolver instead of the actual underlying breakpoint
location for the breakpoint. Also add a "was_hit" method to the scripted
resolver that allows the breakpoint to say which of these "Facade"
locations was hit, and "get_location_description" to provide a
description for the facade locations.

I apologize in advance for the size of the patch. Almost all of what's
here was necessary to (a) make the feature testable and (b) not break
any of the current behavior.

The motivation for this feature is given in the "Providing Facade
Locations" section that I added to the python-reference.rst so I won't
repeat it here.

rdar://152112327
2025-10-09 08:37:21 -07:00
Michael Buch
8889377f5c [lldb][docs] DW_AT_APPLE_major_runtime_version -> DW_AT_APPLE_major_runtime_vers (#162062)
`DW_AT_APPLE_major_runtime_version` doesn't exist. This should be
`DW_AT_APPLE_major_runtime_vers`.
2025-10-06 18:23:07 +01:00
cmtice
9855d546a4 [LLDB] Add boolean literals to DIL. (#157992)
This adds the ability to recognize (and create ValueObjects for) boolean
literals ("true", "false") to DIL. This is a preliminary step to adding
type casting (and also for the ternary op).
2025-09-16 16:04:42 -07:00
Med Ismail Bennani
261000760f [lldb/docs] Breakdown python reference into multiple files (#158331)
This pages improve the LLDB website documentation readability and
discoverability by breaking down the very long python-reference page
into multiple subpages each explaining a specific topic.

The long term goal is to have tutorials for every scripting extension.

This also converts the pages to markdown, since it's easier to write.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-09-12 20:03:36 -07:00
David Spickett
868e596f40 [lldb][docs] Fix misplaced backticks in remote debugging guide 2025-08-29 12:23:02 +00:00
David Spickett
d25b2c868e [lldb][docs] Plain text format some things in remote debug guide
This emphasises that lldb-server and debugserver are binaries
rather than generic terms.

Format some option values too while I'm here.
2025-08-29 09:43:22 +00:00
Ilia Kuklin
bae177241c Reapply "[LLDB] Add ScalarLiteralNode and literal parsing in DIL" (#155610)
This patch introduces `ScalarLiteralNode` without any uses by other
nodes yet. It also includes lexing and parsing for integer and floating
point numbers.
Reapplies #152308 with a fix.
2025-08-27 17:49:55 +05:00
Ilia Kuklin
241d1601b4 Revert "[LLDB] Add ScalarLiteralNode and literal parsing in DIL" (#155605)
Reverts llvm/llvm-project#152308
2025-08-27 17:14:44 +05:00
Ilia Kuklin
51230d9e1e [LLDB] Add ScalarLiteralNode and literal parsing in DIL (#152308)
This patch introduces `ScalarLiteralNode` without any uses by other
nodes yet. It also includes lexing and parsing for integer and floating
point numbers.
2025-08-27 16:28:11 +05:00
⭐️NINIKA⭐️
ce0bc3aa70 [lldb][docs] document an analogue for info proc mappings (#153559) 2025-08-15 12:01:52 +00:00
royitaqi
0e0ea714f3 [vscode-lldb] Add VS Code commands for high level debug workflow (#151827)
This allows other debugger extensions to leverage the `lldb-dap`
extension's settings and logic (e.g. "Server Mode").

Other debugger extensions can invoke these commands to resolve
configuration, create adapter descriptor, and get the `lldb-dap` process
for state tracking, additional interaction, and telemetry.

VS Code commands added:
* `lldb-dap.resolveDebugConfiguration`
* `lldb-dap.resolveDebugConfigurationWithSubstitutedVariables`
* `lldb-dap.createDebugAdapterDescriptor`
* `lldb-dap.getServerProcess`
2025-08-06 11:42:21 -07:00
Charles Zablit
ab6923b9b7 [lldb] add TemplateRange and NameQualifiersRange to DemangledNameInfo (#150999)
This patch adds 2 new attributes to `DemangledNameInfo`: `TemplateRange`
and `NameQualifiersRange`. It also introduces the
`function.name-qualifiers` entity formatter which allows tracking
qualifiers between the name of a function and its arguments/template.

This will be used downstream in Swift but may have applications in C++:
https://github.com/swiftlang/llvm-project/pull/11068.
2025-08-05 14:07:35 +02:00
beetrees
e15b3ef704 [lldb] Add support for displaying __float128 variables (#98369) 2025-07-31 18:04:48 -07:00
Michael Buch
c31cb8b9b8 [lldb][docs] Fix typo in frame-format docs 2025-07-31 09:00:40 +01:00
Jonas Devlieghere
f62370290a [lldb] Implement RegisterContextWasm (#151056)
This PR implements a register context for Wasm, which uses virtual
registers to resolve Wasm local, globals and stack values. The registers
are used to implement support for `DW_OP_WASM_location` in the DWARF
expression evaluator (#151010). This also adds a more comprehensive
test, showing that we can use this to show local variables.
2025-07-30 19:51:09 -07:00
Jonas Devlieghere
a28e7f1aad [lldb] Add WebAssembly Process Plugin (#150143)
Extend support in LLDB for WebAssembly. This PR adds a new Process
plugin (ProcessWasm) that extends ProcessGDBRemote for WebAssembly
targets. It adds support for WebAssembly's memory model with separate
address spaces, and the ability to fetch the call stack from the
WebAssembly runtime.

I have tested this change with the WebAssembly Micro Runtime (WAMR,
https://github.com/bytecodealliance/wasm-micro-runtime) which implements
a GDB debug stub and supports the qWasmCallStack packet.

```
(lldb) process connect --plugin wasm connect://localhost:4567
Process 1 stopped
* thread #1, name = 'nobody', stop reason = trace
    frame #0: 0x40000000000001ad
wasm32_args.wasm`main:
->  0x40000000000001ad <+3>:  global.get 0
    0x40000000000001b3 <+9>:  i32.const 16
    0x40000000000001b5 <+11>: i32.sub
    0x40000000000001b6 <+12>: local.set 0
(lldb) b add
Breakpoint 1: where = wasm32_args.wasm`add + 28 at test.c:4:12, address = 0x400000000000019c
(lldb) c
Process 1 resuming
Process 1 stopped
* thread #1, name = 'nobody', stop reason = breakpoint 1.1
    frame #0: 0x400000000000019c wasm32_args.wasm`add(a=<unavailable>, b=<unavailable>) at test.c:4:12
   1    int
   2    add(int a, int b)
   3    {
-> 4        return a + b;
   5    }
   6
   7    int
(lldb) bt
* thread #1, name = 'nobody', stop reason = breakpoint 1.1
  * frame #0: 0x400000000000019c wasm32_args.wasm`add(a=<unavailable>, b=<unavailable>) at test.c:4:12
    frame #1: 0x40000000000001e5 wasm32_args.wasm`main at test.c:12:12
    frame #2: 0x40000000000001fe wasm32_args.wasm
```

This PR is based on an unmerged patch from Paolo Severini:
https://reviews.llvm.org/D78801. I intentionally stuck to the
foundations to keep this PR small. I have more PRs in the pipeline to
support the other features/packets.

My motivation for supporting Wasm is to support debugging Swift compiled
to WebAssembly:
https://www.swift.org/documentation/articles/wasm-getting-started.html
2025-07-29 10:07:13 -07:00
David Spickett
6adbbcc7db [lldb][docs] Correct link syntax for wasm tracking issue 2025-07-25 14:53:28 +00:00
David Spickett
c63c2f4972 [lldb][docs] Add WASM support issue link to website 2025-07-25 08:41:16 +00:00
Chelsea Cassanova
4396c87bfe [lldb][docs] Update instructions to build standalone (#137383)
The instructions to build LLDB standalone contain a CMake configure step
to build LLVM standalone. This configure step needs to also have the
CMake build type in order to work.
2025-07-24 12:43:52 -07:00
Kazu Hirata
19e2991209 [lldb] Proofread formatting.rst (#149768) 2025-07-21 07:24:15 -07:00
Kazu Hirata
c045caae86 [lldb] Proofread python-reference.rst (#149643) 2025-07-20 11:23:57 -07:00
David Spickett
9f364fe9c4 [lldb][docs] Add section on testing with QEMU user (#149057)
This is not recommended to basically anyone but on occasion it's useful
and could be used for testing with other simulator programs for example
bare metal simulators.

It is not something we do officially support or make any quality
guarantees for.

Adding this is also an excuse to document the limitations and make the
time spent setting up system mode look more worthwhile and might be good
to cite in future discussions about testing in simulation.
2025-07-16 17:47:21 +01:00
David Spickett
97922a7d40 [lldb][docs] Add CAMKE_BUILD_TYPE to standlone build instructions
The first stage requires it, the second appears to default to
debug mode, which works but it's better we advise release mode
to match.
2025-07-16 16:44:40 +00:00