|
17 | 17 | </Expand> |
18 | 18 | </Type> |
19 | 19 |
|
20 | | - <!-- Development notes: there is no way to just ask AI to generate natvis entry for each `godot::` type |
21 | | - Each type required evaluation with LLDB console |
| 20 | + <!-- Development notes: At the current state no AI can directly generate a natvis entry for each `godot::` type. |
22 | 21 | The testdata used for evaluation https://github.com/JetBrains/godot-support/wiki/Developing-godot%E2%80%90cpp.natvis |
23 | 22 | The change of the memory layout would require adjustments of the natvis |
| 23 | +
|
| 24 | + Approach: |
| 25 | + 1. For each type, inspect `opaque` bytes in LLDB using `memory read -size 8 -count N -format address` on |
| 26 | + the address stored in opaque (e.g. `*(void**)demo_type.opaque`) to map the actual field layout. |
| 27 | + 2. Verify specific field values match known test data (e.g. array size=1, int value=42, string content). |
| 28 | + 3. Write natvis expressions only after the field offsets are confirmed. |
| 29 | +
|
| 30 | + Evaluator constraints (JetBrains natvis engine, I haven't checked anything else): |
| 31 | + - Supports: reinterpret_cast, pointer arithmetic on built-in types, array indexing ([n]), Intrinsics |
| 32 | + - Does NOT support: calling member functions (e.g. size()) |
| 33 | + - Nested type visualizers work: `{*(godot::String*)(opaque+8)}` delegates to the String natvis entry |
| 34 | +
|
| 35 | + Patterns used: |
| 36 | + - Opaque wrapper types (String, StringName, Array, Dictionary, ...): cast opaque slice to the |
| 37 | + godot-cpp type pointer — `*(godot::TypeName*)(opaque+N)` — and let that type's natvis handle display |
| 38 | + - Engine heap-allocated types stored as pointer (Transform2D, AABB, Basis, ...): double-deref — |
| 39 | + `**(godot::TypeName**)(opaque+N)` |
| 40 | + - Engine internals without a godot-cpp wrapper (ArrayPrivate, CowData, HashMap): use raw |
| 41 | + reinterpret_cast + index arithmetic, document offsets with a comment verified by LLDB |
| 42 | +
|
| 43 | + Future upcomming improvements: |
| 44 | + - JetBrains natvis support is doing to become x-plat https://youtrack.jetbrains.com/issue/CPP-35297 |
24 | 45 | --> |
25 | 46 |
|
26 | 47 | <!-- opaque[0..7] holds ArrayPrivate*. Dereference as unsigned long long* to read ArrayPrivate |
|
0 commit comments