35 Commits

Author SHA1 Message Date
cmtice
f43ee18e98
[LLDB] Add allow_var_updates to DIL and CanUpdateVar to SetValueFromInteger (#186421)
In preparation for updating DIL to handle assignments, this adds a
member variable to the DIL Interpreter indicating whether or not
updating program variables is allowed. For invocations from the LLDB
command prompt (through "frame variable") we want to allow it, but from
other places we might not. Therefore we also add new StackFrame
ExpressionPathOption, eExpressionPathOptionsAllowVarUpdates, which we
add to calls from CommandObjectFrame, and which is checked in
GetValueForVariableExpressionPath. Finally, we also add a parameter,
can_update_vars, with a default value of true, to
ValueObject::SetValueFromInteger, as that will be the main function used
to by assignment in DIL.
2026-03-31 14:13:48 -07:00
Ilia Kuklin
9f4fbe86a5
[lldb] Add pointer arithmetics for addition and subtraction to DIL (#184652) 2026-03-17 18:10:29 +05:00
Adrian Prantl
94819cc7b1
[LLDB] Modify CreateValueObjectFrom* to take an ExecutionContext (#185547)
Currently these functions take a target pointer. In Cross-language
projects this means it's down to chance what typesystem the resulting
value will be in, since the implementation returns the first scratch
type system in the target, which depends on the order of images and
their implementation language.

By passing in an execution context the selected frame is used to
determine the typesystem, which is usually the expected outcome when
using DIL.

This should be entirely NFC for Clang-only LLDBs, but is a necessity for
LLDBs with additional type system plugins such as the Swift plugin.

Assisted by Claude to patch the call sites.
2026-03-12 16:08:04 -07:00
Ilia Kuklin
14af5be5da
[lldb] Add arithmetic binary subtraction to DIL (#184017) 2026-03-04 15:12:48 +05:00
Ilia Kuklin
55d62abadb
[lldb] Add arithmetic binary addition to DIL (#177208) 2026-02-27 22:59:03 +05:00
cmtice
6ffbb320d7
[LLDB] Add type casting to DIL, part 3 of 3 (#175061)
This PR updates type parsing in DIL to recognize user-defined types
(classes, namespaces, etc.), and allows this to be used in type casting.
2026-02-11 15:51:53 -08:00
Michael Buch
1c41b9a81f
[lldb][TypeSystemClang] Don't treat float vector types as floating point types (#179213)
This patch re-implements `TypeSystemClang::IsFloatingPointType` by
forwarding it to `clang::Type::isFloatingType`. The main difference is
that the latter returns false for float vector types. The motovation
here (apart from implementation simplicity) is that this is currently a
foot-gun because most callsites probably don't consider treating float
vector types. Callers should test for vectors explicitly using
`IsVectorType` (or use `GetTypeInfo`).

This patch makes all the callers of `IsFloatingPointType` now check
`GetTypeInfo() & eTypeIsFloat`. This is set for float vector types too,
so behaviour doesn't change.

To make sure we audit all the call-sites in `ValueObject.cpp`, I added a
helper `HasFloatRepresentation` (named after the
`clang::Type::hasFloatingRepresentation` API), which does the
`GetTypeInfo` check, and added a FIXME to it.
2026-02-03 20:27:23 +00:00
Michael Buch
e0fb6d7f6b
[lldb][CompilerType] Remove CompilerType::IsFloat (#179212)
Depends on:
* https://github.com/llvm/llvm-project/pull/178906

Ever since https://github.com/llvm/llvm-project/pull/178906 this API is
the same as `IsFloatingPointType`. There's no compelling reason for this
to exist.
2026-02-03 11:11:12 +00:00
Ebuka Ezike
088f88d6fd
[lldb] Fix crash when there is no compile unit. (#177278)
The crash occurred in lldb-dap when we are in a shared library with no
debug information and we are trying to get the expression path for an
address.
2026-01-22 12:29:52 +00:00
Ilia Kuklin
66bf4e0c58
[lldb] Change bitfield range character from '-' to ':' in DIL (#173410)
Change the bitfield extraction range character from '-' to a more common
':'. Add a deprecation error when '-' is used.
2026-01-16 16:35:16 +05:00
Austin Jiang
e6cdfb75ac
Fix typos and spelling errors across codebase (#156270)
Corrected various spelling mistakes such as 'occurred', 'receiver',
'initialized', 'length', and others in comments, variable names,
function names, and documentation throughout the project. These
changes improve code readability and maintain consistency in naming
and documentation.

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2026-01-13 11:52:46 -05:00
cmtice
539cf92944
[LLDB] Add type casting to DIL, part 2 or 3 (#170332)
This PR implements the actual type casting part. With this, type casting
to builtin types should work. The third PR, which will be put up after
this one is merged, will expand the type name parsing to allow casting
to user-defined types.
2026-01-07 15:04:13 -08:00
Ilia Kuklin
a3c8b090c3
[lldb][NFC] Assert ASTNodeUPs and pass ASTNodes by reference in DIL (#173240)
1. Every `ASTNodeUP` is asserted before being used in creating another
`ASTNodeUP`.
2. Removed returning `nullptr` in `ParseIntegerLiteral` and
`ParseFloatingPointLiteral` to avoid confusion.
3. All `ASTNodes` are now passed by reference instead of pointer.
2025-12-23 19:18:19 +05:00
Ilia Kuklin
f4e941b209
[lldb] Use AST nodes as Subscript and BitExtraction arguments in DIL (#169363)
Use AST nodes as Subscript and BitExtraction arguments instead of bare
integers. This enables using any supported expression as an array or bit
index.
2025-12-18 16:04:31 +05: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
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
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
cmtice
d85069c3d0
[LLDB] Re-land 'Update DIL handling of array subscripting' (#154269)
This attempts to fix the issues with the original PR (#151605), updating
the DIL code for handling array subscripting to more closely match and
handle all the casees from the original 'frame var' implementation. The
first PR did not include special-case code for objc pointers, which
apparently caused a test failure on the green-dragon buildbot. Hopefully
this PR, which includes the objc pointer special code, fixes that issue.
2025-08-26 07:40:35 -07:00
Shubham Sandeep Rastogi
cd0bf2735b Revert "[LLDB] Update DIL handling of array subscripting. (#151605)"
This reverts commit 6d3ad9d9fd830eef0ac8a9d558e826b8b624e17d.

This was reverted because it broke the LLDB greendragon bot.
2025-08-15 09:17:33 -07:00
cmtice
6d3ad9d9fd
[LLDB] Update DIL handling of array subscripting. (#151605)
This updates the DIL code for handling array subscripting to more
closely match and handle all the cases from the original 'frame var'
implementation. Also updates the DIL array subscripting test. This
particularly fixes some issues with handling synthetic children, objc
pointers, and accessing specific bits within scalar data types.
2025-08-15 08:26:45 -07:00
cmtice
f5c676d6d9
[LLDB] Switch to using DIL as default implementation for 'frame var'. (#147887) 2025-07-15 08:19:10 -07:00
Ilia Kuklin
09fb20ec7d
[LLDB] Check comp_unit before accessing it in DIL (#147955)
Check `symbol_context.comp_unit` before accessing it to avoid `nullptr`
dereferencing.
2025-07-10 20:34:23 +05:00
Ilia Kuklin
03aa5c0a9e
[LLDB] Optimize identifier lookup in DIL (#146094)
Remove unused code and unnecessary function calls, optimize global
variable search.
Add more test cases.
2025-07-03 19:15:16 +05:00
cmtice
11ecd4742b
[LLDB] Update DIL to pass current 'frame var' tests. (#145055)
As a preliminary to making DIL the default implementation for
 'frame var', ran check-lldb forcing 'frame var' to always use DIL, 
and discovered a few failing tests. This fixes most of them. The only
remaining failing test is TestDAP_evaluate.py, which now passes
a test case that the test says should fail (still investigating this).

Changes in this PR:
- Sets correct VariableSP, as well as returning ValueObjectSP (needed
for several watchpoint tests).
- Updates error messages, when looking up members, to match what the
rest of LLDB expects. Also update appropriate DIL tests to expect the
updated error messages.
- Updates DIL parser to look for and accept "(anonymous namespace)::" at
the front of a variable name.
2025-07-01 07:30:47 -07:00
cmtice
da2969b105
[LLDB] Update DIL to handle smart pointers; add more tests. (#143786)
This updates the DIL implementation to handle smart pointers (accessing
field members and dereferencing) in the same way the current 'frame
variable' implementation does. It also adds tests for handling smart
pointers, as well as some additional DIL tests.
2025-06-27 07:30:14 -07:00
Ilia Kuklin
4236423ee8
[LLDB] Add bit extraction to DIL (#141422) 2025-06-13 16:31:25 +05:00
Ilia Kuklin
fe51d8ae57
[LLDB] Add array subscription and integer parsing to DIL (#141102)
Reapply #138551 with an xfailed test on Windows
2025-05-25 21:09:33 +05:00
cmtice
53d7b1d9e0
[LLDB] Add field member operators to DIL (#138093)
Add the arrow and period operators, allowing DIL to find and access
member fields.
2025-05-23 07:30:10 -07:00
Ilia Kuklin
5df819ffb3
Revert "[LLDB] Add array subscription and integer parsing to DIL" (#141059)
Reverts llvm/llvm-project#138551
2025-05-22 17:33:01 +05:00
Ilia Kuklin
491619a250
[LLDB] Add array subscription and integer parsing to DIL (#138551) 2025-05-22 16:15:11 +05:00
Ilia Kuklin
d637038429
[LLDB] Add unary operators Dereference and AddressOf to DIL (#134428) 2025-04-29 21:29:52 +05:00
cmtice
46e2c07fa2
[LLDB] Add DIL code for handling plain variable names. (#120971)
Add the Data Inspection Language (DIL) implementation pieces for
handling plain local and global variable names.

See https://discourse.llvm.org/t/rfc-data-inspection-language/69893 for
information about DIL.

This change includes the basic AST, Lexer, Parser and Evaluator pieces,
as well as some tests.
2025-04-03 21:39:30 -07:00