9 Commits

Author SHA1 Message Date
Jonas Devlieghere
6539481c8e
[lldb] Account for DWARF 5 sections in TestCTF.py
Update the TestCTF Makefile to remove the DWARF 5 sections.
2024-10-14 16:57:33 -07:00
Jonas Devlieghere
fd4399cb11
[lldb] Fix crash in SymbolFileCTF::ParseFunctions (#89845)
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
2024-04-23 16:50:22 -07:00
Jonas Devlieghere
12f3d97fc6
[lldb] Support recursive record types in CTF
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
2023-07-29 22:32:24 -07:00
Jonas Devlieghere
b9867df64a
[lldb] Fix CTF parsing of large structs
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
2023-07-29 19:37:08 -07:00
Jonas Devlieghere
9c70a3d917
[lldb] Support CTF forward declarations
Add support for parsing CTF forward declarations and converting them
into LLDB types.

Differential revision: https://reviews.llvm.org/D156483
2023-07-28 19:10:36 -07:00
Jonas Devlieghere
0a5e0d3fad
[lldb] Split CTF parsing and type creation (NFC)
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
2023-07-28 09:41:47 -07:00
Jonas Devlieghere
b716d4e585
[lldb] Move decorators to test method
Make sure TestCTF only run on Darwin when ctfconvert and llvm-objdump
are available.
2023-07-13 15:43:59 -07:00
Jonas Devlieghere
0e285a13eb
[lldb] Support compressed CTF
Add support for compressed CTF data. The flags in the header can
indicate whether the CTF body is compressed with zlib deflate. This
patch supports inflating the data before parsing.

Differential revision: https://reviews.llvm.org/D155221
2023-07-13 15:10:25 -07:00
Jonas Devlieghere
ee44310a48
[lldb] Support Compact C Type Format (CTF)
Add support for the Compact C Type Format (CTF) in LLDB. The format
describes the layout and sizes of C types. It is most commonly consumed
by dtrace.

We generate CTF for the XNU kernel and want to be able to use this in
LLDB to debug kernels for which we don't have dSYMs (anymore). CTF is a
much more limited debug format than DWARF which allows is to be an order
of magnitude smaller: a 1GB dSYM can be converted to a handful of
megabytes of CTF. For XNU, the goal is not to replace DWARF, but rather
to have CTF serve as a "better than nothing" debug info format when
DWARF is not available.

It's worth noting that the LLVM toolchain does not support emitting CTF.
XNU uses ctfconvert to generate CTF from DWARF which is used for
testing.

Differential revision: https://reviews.llvm.org/D154862
2023-07-13 11:30:52 -07:00