17 Commits

Author SHA1 Message Date
Ilia Kuklin
80fffd527c
[lldb] Add evaluation modes to DIL (#178747)
Adding more supported operators to DIL breaks tests in `DWIMPrint` and
`lldb-dap`, which shouldn't be simply adjusted for new DIL capabilities.
They act as a check for the boundaries of what subset of expressions
`DWIMPrint` and `lldb-dap` expect to be evaluated when using
`GetValueForVariableExpressionPath` function. With this patch, the
caller can now pick a mode that limits the expressions DIL can evaluate,
which ensures the expected preexisting behavior. More operators can now
be safely added to DIL, which can still be evaluated by DIL when using
`frame var` command or the API call with Full mode selected (or not
specified at all).

DIL will only attempt evaluating expressions that contain operations
allowed by a selected mode:
 - Simple: identifiers, operators: '.'
 - Legacy: identifiers, integers, operators: '.', '->', '*', '&', '[]'
 - Full: everything supported by DIL
2026-02-13 18:34:58 +05: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
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
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
David Spickett
d87170211d [lldb][test] Remove XFAIL from some Windows tests
These are now passing on Windows x86_64 and Arm64.
2025-07-17 09:17:25 +00:00
Ilia Kuklin
83381ba832
[LLDB] Add negative number parsing to DIL (#144557) 2025-06-19 18:10:56 +05:00
Ilia Kuklin
4236423ee8
[LLDB] Add bit extraction to DIL (#141422) 2025-06-13 16:31:25 +05:00
David Spickett
0ac3f5e901
[lldb][test] Fix flaky DIL array subscript test by reducing array indexes (#141738)
This test has been flaky on Linaro's Windows on Arm bot and I was 
able to reproduce it within 10 or so runs locally.

When it fails it's because we failed to read the value of int_arr[100].
When that happens the memory looks like this:
```
[0x0000006bf88fd000-0x0000006bf8900000) rw-      <-- sp (0x0000006bf88ffe20)
[0x0000006bf8900000-0x0000025fec900000) ---      <-- int_arr[100] (0x0000006bf8900070)
```
The first region is the stack and the stack pointer is pointing
within that region, as expected.

The second region is where we are trying to read int_arr[100] from
and this is not mapped because we're trying to read above the start
of the stack.

Sometimes the test passes I think because ASLR / DYNAMICBASE moves
the start of the stack down enough so there is some readable memory
at the top.

https://learn.microsoft.com/en-us/cpp/build/reference/dynamicbase?view=msvc-170

Note "Because ASLR can't be disabled on ARM, ARM64, or ARM64EC
architectures,
/DYNAMICBASE:NO isn't supported for these targets.". Which means on this
bot,
the layout is definitely being randomised.

We don't need to be testing indexes this large. So I've changed the two 
test indexes to 3 (1 beyond the end) and 10 (a larger distance beyond
the end).
We know that index 42 always worked on the bot, so 10 should be fine,
and
did not fail locally.
2025-05-28 16:29:48 +01:00
David Spickett
8b6e98559d [lldb][test] Skip DIL array subscript test on Windows
This has been flaky on Linaro's Windows on Arm bot, failing
with errors all along these lines:

Traceback (most recent call last):
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\frame\var-dil\basics\ArraySubscript\TestFrameVarDILArraySubscript.py", line 56, in test_subscript
    self.expect_var_path("int_arr[100]", True, type="int")
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\frame\var-dil\basics\ArraySubscript\TestFrameVarDILArraySubscript.py", line 15, in expect_var_path
    value_dil = super().expect_var_path(expr, value=value, type=type)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 2589, in expect_var_path
    value_check.check_value(self, eval_result, str(eval_result))
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 301, in check_value
    test_base.assertSuccess(val.GetError())
  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 2597, in assertSuccess
    self.fail(self._formatMessage(msg, "'{}' is not success".format(error)))

AssertionError: 'read memory from 0x68119c00b0 failed (0 of 4 bytes read)' is not success

I think this is because we are trying to read off of the top of the
stack which is unmapped memory on Windows.

I have a fix I'm going to put in review shortly.
2025-05-28 10:14:28 +00: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
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