Skip to content

Conversation

@malor
Copy link
Owner

@malor malor commented Dec 7, 2025

Depending on the OS and the LLDB version, casting between different struct types can fail. The rule of thumb is to always cast between pointer types first and dereference later (GetChildMemberWithName() should handle this transparentely and remove the need for derefs in most cases).

Similarly, more care should be taken when casting between different variants of the PyUnicodeObject type that all have different size: we should always start with the "base" object that they all have in common (i.e. PyASCIIObject) and use the internal state to figure out which variant of the struct is being inspected.

Finally, debugging symbols may resolve the CPython object type as _object instead of PyObject in some cases, but the two are synonymous.

This fixes pretty-printing of PyObject types on Windows (though, we will need to start running tests on that platform before we can claim it is supported).

Depending on the OS and the LLDB version, casting between different
struct types can fail. The rule of thumb is to always cast between
pointer types first and dereference later (`GetChildMemberWithName()`
should handle this transparentely and remove the need for derefs in
most cases).

Similarly, more care should be taken when casting between different
variants of the `PyUnicodeObject` type that all have different size:
we should always start with the "base" object that they all have in
common (i.e. `PyASCIIObject`) and use the internal state to figure out
which variant of the struct is being inspected.

Finally, debugging symbols may resolve the CPython object type as `_object`
instead of `PyObject` in some cases, but the two are synonymous.

This fixes pretty-printing of `PyObject` types on Windows (though, we
will need to start running tests on that platform before we can claim
it is supported).
@malor malor merged commit bde9771 into master Dec 7, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants