Skip to content

🍒 Compact C Type Format Cherrypicks #8637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 26, 2024

Conversation

JDevlieghere
Copy link

Cherrypicks to the CTF support in lldb for rdar://126943722.

JDevlieghere and others added 9 commits April 24, 2024 11:19
Separate parsing CTF and creating LLDB types. This is a prerequisite to
parsing forward references and recursive types.

Differential revision: https://reviews.llvm.org/D156447

(cherry picked from commit 0a5e0d3)
Add support for parsing CTF forward declarations and converting them
into LLDB types.

Differential revision: https://reviews.llvm.org/D156483

(cherry picked from commit 9c70a3d)
Fix parsing of large structs. If the size of a struct exceeds a certain
threshold, the offset is encoded using two 32-bit integers instead of
one.

Differential revision: https://reviews.llvm.org/D156490

(cherry picked from commit b9867df)
Support recursive record types in CTF, for example a struct that
contains a pointer to itself:

  struct S {
    struct S *n;
  };

We are now more lazy when creating LLDB types. When encountering a
record type (struct or union) we create a forward declaration and only
complete it when requested.

Differential revision: https://reviews.llvm.org/D156498

(cherry picked from commit 12f3d97)
Improve memory usage by reducing the lifetime of CTF types. Once a CTF
type has been converted to a (complete) LLDB type, there's no need to
keep it in memory anymore. For most types, we can free them right after
creating the corresponding LLDB types. The only exception is record
types, which are only completed lazily.

Differential revision: https://reviews.llvm.org/D156606

(cherry picked from commit 6891812)
Fixes:
```
[3465/3822] Building CXX object tools\lldb\source\Plugins\SymbolFile\CTF\CMakeFiles\lldbPluginSymbolFileCTF.dir\SymbolFileCTF.cpp.obj
C:\git\llvm-project\lldb\source\Plugins\SymbolFile\CTF\SymbolFileCTF.cpp(606) : warning C4715: 'lldb_private::SymbolFileCTF::CreateType': not all control paths return a value
```

(cherry picked from commit bafdaa1)
Make SymbolFileCTF::ParseFunctions resilient against not being able to
resolve the argument or return type of a function. ResolveTypeUID can
fail for a variety of reasons so we should always check its result.

The type that caused the crash was `_Bool` which we didn't recognize
as a basic type. This commit also fixes the underlying issue and adds
a test.

rdar://126943722
(cherry picked from commit fd4399c)
@JDevlieghere
Copy link
Author

@swift-ci please test

@JDevlieghere JDevlieghere merged commit b83e97e into swift/release/6.0 Apr 26, 2024
3 checks passed
@JDevlieghere JDevlieghere deleted the jdevlieghere/CTF branch April 26, 2024 16:17
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.

3 participants