Skip to content

Commit 6e3b46d

Browse files
author
husihua
committed
objc runtime 906.2
1 parent 07bde11 commit 6e3b46d

File tree

428 files changed

+30963
-19727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

428 files changed

+30963
-19727
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# objc-runtime
2-
objc runtime 787.1
2+
objc runtime 906.2

debug-objc/main.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// main.m
33
// debug-objc
44
//
5-
// Created by Closure on 2018/12/4.
5+
// Created by Closure on 2024/3/13.
66
//
77

88
#import <Foundation/Foundation.h>
99

1010
int main(int argc, const char * argv[]) {
1111
@autoreleasepool {
1212
// insert code here...
13-
NSLog(@"Hello, World! %@", [NSString class]);
13+
NSLog(@"Hello, World!");
1414
}
1515
return 0;
1616
}

include/CrashReporterClient.h

+26-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,32 @@
3838
#else /* !LIBC_NO_LIBCRASHREPORTERCLIENT */
3939

4040
/* Include the real CrashReporterClient.h */
41-
#include_next <CrashReporterClient.h>
41+
#include <stdint.h>
42+
43+
#define CRASHREPORTER_ANNOTATIONS_SECTION "__crash_info"
44+
#define CRASHREPORTER_ANNOTATIONS_VERSION 5
45+
#define CRASH_REPORTER_CLIENT_HIDDEN __attribute__((visibility("hidden")))
46+
47+
#define _crc_make_getter(attr) ((const char *)(unsigned long)gCRAnnotations.attr)
48+
#define _crc_make_setter(attr, arg) (gCRAnnotations.attr = (uint64_t)(unsigned long)(arg))
49+
#define CRGetCrashLogMessage() _crc_make_getter(message)
50+
#define CRSetCrashLogMessage(m) _crc_make_setter(message, m)
51+
#define CRGetCrashLogMessage2() _crc_make_getter(message2)
52+
#define CRSetCrashLogMessage2(m) _crc_make_setter(message2, m)
53+
54+
struct crashreporter_annotations_t {
55+
uint64_t version;
56+
uint64_t message;
57+
uint64_t signature_string;
58+
uint64_t backtrace;
59+
uint64_t message2;
60+
uint64_t thread;
61+
uint64_t dialog_mode;
62+
uint64_t abort_cause;
63+
};
64+
65+
CRASH_REPORTER_CLIENT_HIDDEN
66+
extern struct crashreporter_annotations_t gCRAnnotations;
4267

4368
#endif /* !LIBC_NO_LIBCRASHREPORTERCLIENT */
4469

include/arm/Makefile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
2+
export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
3+
export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
4+
export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
5+
6+
include $(MakeInc_cmd)
7+
include $(MakeInc_def)
8+
9+
DATAFILES = \
10+
endian.h fasttrap_isa.h param.h \
11+
profile.h signal.h limits.h _limits.h \
12+
types.h vmparam.h _types.h _param.h \
13+
_mcontext.h
14+
15+
DRIVERKIT_DATAFILES = \
16+
limits.h _limits.h types.h _types.h endian.h
17+
18+
PRIVATE_DATAFILES = \
19+
disklabel.h
20+
21+
KERNELFILES = \
22+
endian.h param.h \
23+
profile.h signal.h limits.h _limits.h \
24+
types.h vmparam.h _types.h _param.h \
25+
_mcontext.h
26+
27+
# These are covered by ../machine/machine.modulemap.
28+
INSTALL_MD_LIST = ${DATAFILES}
29+
INSTALL_DRIVERKIT_MD_LIST = ${DRIVERKIT_DATAFILES}
30+
INSTALL_SF_MD_LCL_LIST = ${DATAFILES} ${PRIVATE_DATAFILES}
31+
32+
INSTALL_MD_DIR = arm
33+
34+
EXPORT_MD_LIST = ${KERNELFILES}
35+
36+
EXPORT_MD_DIR = arm
37+
38+
include $(MakeInc_rule)
39+
include $(MakeInc_dir)

include/arm/_limits.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
3+
*/
4+
#ifndef _ARM__LIMITS_H_
5+
#define _ARM__LIMITS_H_
6+
7+
#if defined (__arm__) || defined (__arm64__)
8+
9+
#define __DARWIN_CLK_TCK 100 /* ticks per second */
10+
11+
#endif /* defined (__arm__) || defined (__arm64__) */
12+
13+
#endif /* _ARM__LIMITS_H_ */

include/arm/_mcontext.h

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3+
*
4+
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5+
*
6+
* This file contains Original Code and/or Modifications of Original Code
7+
* as defined in and that are subject to the Apple Public Source License
8+
* Version 2.0 (the 'License'). You may not use this file except in
9+
* compliance with the License. The rights granted to you under the License
10+
* may not be used to create, or enable the creation or redistribution of,
11+
* unlawful or unlicensed copies of an Apple operating system, or to
12+
* circumvent, violate, or enable the circumvention or violation of, any
13+
* terms of an Apple operating system software license agreement.
14+
*
15+
* Please obtain a copy of the License at
16+
* http://www.opensource.apple.com/apsl/ and read it before using this file.
17+
*
18+
* The Original Code and all software distributed under the License are
19+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23+
* Please see the License for the specific language governing rights and
24+
* limitations under the License.
25+
*
26+
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27+
*/
28+
29+
#ifndef __ARM_MCONTEXT_H_
30+
#define __ARM_MCONTEXT_H_
31+
32+
#if defined (__arm__) || defined (__arm64__)
33+
34+
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
35+
#include <sys/appleapiopts.h>
36+
#include <mach/machine/_structs.h>
37+
38+
#ifndef _STRUCT_MCONTEXT32
39+
#if __DARWIN_UNIX03
40+
#define _STRUCT_MCONTEXT32 struct __darwin_mcontext32
41+
_STRUCT_MCONTEXT32
42+
{
43+
_STRUCT_ARM_EXCEPTION_STATE __es;
44+
_STRUCT_ARM_THREAD_STATE __ss;
45+
_STRUCT_ARM_VFP_STATE __fs;
46+
};
47+
48+
#else /* !__DARWIN_UNIX03 */
49+
#define _STRUCT_MCONTEXT32 struct mcontext32
50+
_STRUCT_MCONTEXT32
51+
{
52+
_STRUCT_ARM_EXCEPTION_STATE es;
53+
_STRUCT_ARM_THREAD_STATE ss;
54+
_STRUCT_ARM_VFP_STATE fs;
55+
};
56+
57+
#endif /* __DARWIN_UNIX03 */
58+
#endif /* _STRUCT_MCONTEXT32 */
59+
60+
61+
#ifndef _STRUCT_MCONTEXT64
62+
#if __DARWIN_UNIX03
63+
#define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
64+
_STRUCT_MCONTEXT64
65+
{
66+
_STRUCT_ARM_EXCEPTION_STATE64 __es;
67+
_STRUCT_ARM_THREAD_STATE64 __ss;
68+
_STRUCT_ARM_NEON_STATE64 __ns;
69+
};
70+
71+
#else /* !__DARWIN_UNIX03 */
72+
#define _STRUCT_MCONTEXT64 struct mcontext64
73+
_STRUCT_MCONTEXT64
74+
{
75+
_STRUCT_ARM_EXCEPTION_STATE64 es;
76+
_STRUCT_ARM_THREAD_STATE64 ss;
77+
_STRUCT_ARM_NEON_STATE64 ns;
78+
};
79+
#endif /* __DARWIN_UNIX03 */
80+
#endif /* _STRUCT_MCONTEXT32 */
81+
82+
#ifndef _MCONTEXT_T
83+
#define _MCONTEXT_T
84+
#if defined(__arm64__)
85+
typedef _STRUCT_MCONTEXT64 *mcontext_t;
86+
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
87+
#else
88+
typedef _STRUCT_MCONTEXT32 *mcontext_t;
89+
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32
90+
#endif
91+
#endif /* _MCONTEXT_T */
92+
93+
#endif /* defined (__arm__) || defined (__arm64__) */
94+
95+
#endif /* __ARM_MCONTEXT_H_ */

include/arm/_param.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2006-2007 Apple Inc. All rights reserved.
3+
*/
4+
5+
#ifndef _ARM__PARAM_H_
6+
#define _ARM__PARAM_H_
7+
8+
#if defined (__arm__) || defined (__arm64__)
9+
10+
#include <arm/_types.h>
11+
12+
/*
13+
* Round p (pointer or byte index) up to a correctly-aligned value for all
14+
* data types (int, long, ...). The result is unsigned int and must be
15+
* cast to any desired pointer type.
16+
*/
17+
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
18+
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
19+
20+
#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
21+
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
22+
23+
#endif /* defined (__arm__) || defined (__arm64__) */
24+
25+
#endif /* _ARM__PARAM_H_ */

include/arm/_types.h

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3+
*/
4+
#ifndef _BSD_ARM__TYPES_H_
5+
#define _BSD_ARM__TYPES_H_
6+
7+
#if defined (__arm__) || defined (__arm64__)
8+
9+
/*
10+
* This header file contains integer types. It's intended to also contain
11+
* flotaing point and other arithmetic types, as needed, later.
12+
*/
13+
14+
#ifdef __GNUC__
15+
typedef __signed char __int8_t;
16+
#else /* !__GNUC__ */
17+
typedef char __int8_t;
18+
#endif /* !__GNUC__ */
19+
typedef unsigned char __uint8_t;
20+
typedef short __int16_t;
21+
typedef unsigned short __uint16_t;
22+
typedef int __int32_t;
23+
typedef unsigned int __uint32_t;
24+
typedef long long __int64_t;
25+
typedef unsigned long long __uint64_t;
26+
27+
typedef long __darwin_intptr_t;
28+
typedef unsigned int __darwin_natural_t;
29+
30+
/*
31+
* The rune type below is declared to be an ``int'' instead of the more natural
32+
* ``unsigned long'' or ``long''. Two things are happening here. It is not
33+
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
34+
* it looks like 10646 will be a 31 bit standard. This means that if your
35+
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
36+
* chosen over a long is that the is*() and to*() routines take ints (says
37+
* ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it
38+
* here, you lose a bit of ANSI conformance, but your programs will still
39+
* work.
40+
*
41+
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
42+
* be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
43+
* rune_t must be the same type. Also wint_t must be no narrower than
44+
* wchar_t, and should also be able to hold all members of the largest
45+
* character set plus one extra value (WEOF). wint_t must be at least 16 bits.
46+
*/
47+
48+
typedef int __darwin_ct_rune_t; /* ct_rune_t */
49+
50+
/*
51+
* mbstate_t is an opaque object to keep conversion state, during multibyte
52+
* stream conversions. The content must not be referenced by user programs.
53+
*/
54+
typedef union {
55+
char __mbstate8[128];
56+
long long _mbstateL; /* for alignment */
57+
} __mbstate_t;
58+
59+
typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */
60+
61+
#if defined(__PTRDIFF_TYPE__)
62+
typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */
63+
#elif defined(__LP64__)
64+
typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */
65+
#else
66+
typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */
67+
#endif /* __GNUC__ */
68+
69+
#if defined(__SIZE_TYPE__)
70+
typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */
71+
#else
72+
typedef unsigned long __darwin_size_t; /* sizeof() */
73+
#endif
74+
75+
#if (__GNUC__ > 2)
76+
typedef __builtin_va_list __darwin_va_list; /* va_list */
77+
#else
78+
typedef void * __darwin_va_list; /* va_list */
79+
#endif
80+
81+
#if defined(__WCHAR_TYPE__)
82+
typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */
83+
#else
84+
typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */
85+
#endif
86+
87+
typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
88+
89+
#if defined(__WINT_TYPE__)
90+
typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
91+
#else
92+
typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
93+
#endif
94+
95+
typedef unsigned long __darwin_clock_t; /* clock() */
96+
typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
97+
typedef long __darwin_ssize_t; /* byte count or error */
98+
typedef long __darwin_time_t; /* time() */
99+
100+
#endif /* defined (__arm__) || defined (__arm64__) */
101+
102+
#endif /* _BSD_ARM__TYPES_H_ */

include/arm/disklabel.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3+
*/
4+
#ifndef _MACHINE_DISKLABEL_H_
5+
#define _MACHINE_DISKLABEL_H_
6+
7+
#include <sys/appleapiopts.h>
8+
9+
#ifdef __APPLE_API_OBSOLETE
10+
#define LABELSECTOR (1024 / DEV_BSIZE) /* sector containing label */
11+
#define LABELOFFSET 0 /* offset of label in sector */
12+
#define MAXPARTITIONS 8 /* number of partitions */
13+
#define RAW_PART 2 /* raw partition: xx?c */
14+
15+
/* Just a dummy */
16+
struct cpu_disklabel {
17+
int cd_dummy; /* must have one element. */
18+
};
19+
#endif /* __APPLE_API_OBSOLETE */
20+
21+
#endif /* _MACHINE_DISKLABEL_H_ */

0 commit comments

Comments
 (0)