]> git.saurik.com Git - apple/objc4.git/blob - test/gdb.m
objc4-756.2.tar.gz
[apple/objc4.git] / test / gdb.m
1 // TEST_CFLAGS -Wno-deprecated-declarations
2
3 #include "test.h"
4 #include "testroot.i"
5 #include <objc/objc-gdb.h>
6 #include <objc/runtime.h>
7
8 int main()
9 {
10 // Class hashes
11 Class result;
12
13 // Class should not be realized yet
14 // fixme not true during class hash rearrangement
15 // result = NXMapGet(gdb_objc_realized_classes, "TestRoot");
16 // testassert(!result);
17
18 [TestRoot class];
19 // Now class should be realized
20
21 result = (__bridge Class)(NXMapGet(gdb_objc_realized_classes, "TestRoot"));
22 testassert(result);
23 testassert(result == [TestRoot class]);
24
25 result = (__bridge Class)(NXMapGet(gdb_objc_realized_classes, "DoesNotExist"));
26 testassert(!result);
27
28 // Class structure decoding
29
30 uintptr_t *maskp = (uintptr_t *)dlsym(RTLD_DEFAULT, "objc_debug_class_rw_data_mask");
31 testassert(maskp);
32
33 succeed(__FILE__);
34 }