Skip to content

Commit 5581334

Browse files
committed
fixed RAISE_UNSUPPORTED_MACOS_EXCEPTION to add more debug info
1 parent 3da0daa commit 5581334

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

virtualization_helper.h

+13-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33
#import <Availability.h>
44
#import <Foundation/Foundation.h>
55

6-
#define RAISE_UNSUPPORTED_MACOS_EXCEPTION() \
7-
do { \
8-
[[NSException exceptionWithName:@"UnhandledException" reason:@"bug" userInfo:nil] raise]; \
9-
__builtin_unreachable(); \
6+
NSDictionary *dumpProcessinfo();
7+
8+
#define RAISE_REASON_MESSAGE \
9+
"This may possibly be a bug due to library handling errors.\n" \
10+
"I would appreciate it if you could report it to https://github.com/Code-Hex/vz/issues/new/choose\n\n" \
11+
"Information: %@\n"
12+
13+
#define RAISE_UNSUPPORTED_MACOS_EXCEPTION() \
14+
do { \
15+
[NSException \
16+
raise:@"UnhandledAvailabilityException" \
17+
format:@RAISE_REASON_MESSAGE, dumpProcessinfo()]; \
18+
__builtin_unreachable(); \
1019
} while (0)
1120

1221
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000

virtualization_helper.m

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// virtualization_helper.m
3+
//
4+
// Created by codehex.
5+
//
6+
7+
#import "virtualization_helper.h"
8+
9+
#ifdef __arm64__
10+
#define TARGET_ARM64 1
11+
#else
12+
#define TARGET_ARM64 0
13+
#endif
14+
15+
NSDictionary *dumpProcessinfo()
16+
{
17+
NSString *osVersionString = [[NSProcessInfo processInfo] operatingSystemVersionString];
18+
return @{
19+
@"LLVM (Clang) Version" : @__VERSION__,
20+
@"Target for arm64" : @TARGET_ARM64,
21+
// The version of the macOS on which the process is executing.
22+
@"Running OS Version" : osVersionString,
23+
#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
24+
@"Max Allowed OS Version" : @__MAC_OS_X_VERSION_MAX_ALLOWED,
25+
#endif
26+
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
27+
@"Min Required OS Version" : @__MAC_OS_X_VERSION_MIN_REQUIRED,
28+
#endif
29+
};
30+
}

0 commit comments

Comments
 (0)