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
51 lines
762 B
C
51 lines
762 B
C
#include <stdio.h>
|
|
|
|
typedef int MyInt;
|
|
|
|
void populate(MyInt i);
|
|
|
|
typedef enum MyEnum {
|
|
eOne = 1,
|
|
eTwo =2,
|
|
eThree = 3,
|
|
} MyEnumT;
|
|
|
|
typedef union MyUnion {
|
|
MyInt i;
|
|
const char* s;
|
|
} MyUnionT;
|
|
|
|
typedef struct MyNestedStruct {
|
|
MyInt i;
|
|
const char* s;
|
|
volatile char c;
|
|
char a[4];
|
|
MyEnumT e;
|
|
MyUnionT u;
|
|
} MyNestedStructT;
|
|
|
|
typedef struct MyStruct {
|
|
MyNestedStructT n;
|
|
void (*f)(int);
|
|
} MyStructT;
|
|
|
|
MyStructT foo;
|
|
|
|
void populate(MyInt i) {
|
|
foo.n.i = i;
|
|
foo.n.s = "foo";
|
|
foo.n.c = 'c';
|
|
foo.n.a[0] = 'a';
|
|
foo.n.a[1] = 'b';
|
|
foo.n.a[2] = 'c';
|
|
foo.n.a[3] = 'd';
|
|
foo.n.e = eOne;
|
|
foo.f = NULL;
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
populate(argc);
|
|
printf("foo is at address: %p\n", (void*)&foo); // Break here
|
|
return 0;
|
|
}
|