1 |
efrain |
1 |
// Copyright 2019 Google
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#pragma once
|
|
|
16 |
|
|
|
17 |
#include <stdint.h>
|
|
|
18 |
#include <sys/cdefs.h>
|
|
|
19 |
|
|
|
20 |
#ifdef __OBJC__
|
|
|
21 |
#import <Foundation/Foundation.h>
|
|
|
22 |
@class FIRStackFrame;
|
|
|
23 |
@class FIRExceptionModel;
|
|
|
24 |
#endif
|
|
|
25 |
|
|
|
26 |
#define CLS_EXCEPTION_STRING_LENGTH_MAX (1024 * 16)
|
|
|
27 |
|
|
|
28 |
typedef enum {
|
|
|
29 |
FIRCLSExceptionTypeUnknown = 0,
|
|
|
30 |
FIRCLSExceptionTypeObjectiveC = 1,
|
|
|
31 |
FIRCLSExceptionTypeCpp = 2,
|
|
|
32 |
// 3 was FIRCLSExceptionTypeJavascript
|
|
|
33 |
// Keeping these numbers the same just to be safe
|
|
|
34 |
FIRCLSExceptionTypeCustom = 4
|
|
|
35 |
} FIRCLSExceptionType;
|
|
|
36 |
|
|
|
37 |
typedef struct {
|
|
|
38 |
const char* path;
|
|
|
39 |
|
|
|
40 |
void (*originalTerminateHandler)(void);
|
|
|
41 |
|
|
|
42 |
#if !TARGET_OS_IPHONE
|
|
|
43 |
void* originalNSApplicationReportException;
|
|
|
44 |
#endif
|
|
|
45 |
|
|
|
46 |
uint32_t maxCustomExceptions;
|
|
|
47 |
} FIRCLSExceptionReadOnlyContext;
|
|
|
48 |
|
|
|
49 |
typedef struct {
|
|
|
50 |
uint32_t customExceptionCount;
|
|
|
51 |
} FIRCLSExceptionWritableContext;
|
|
|
52 |
|
|
|
53 |
__BEGIN_DECLS
|
|
|
54 |
|
|
|
55 |
void FIRCLSExceptionInitialize(FIRCLSExceptionReadOnlyContext* roContext,
|
|
|
56 |
FIRCLSExceptionWritableContext* rwContext);
|
|
|
57 |
void FIRCLSExceptionCheckHandlers(void* delegate);
|
|
|
58 |
|
|
|
59 |
void FIRCLSExceptionRaiseTestObjCException(void) __attribute((noreturn));
|
|
|
60 |
void FIRCLSExceptionRaiseTestCppException(void) __attribute((noreturn));
|
|
|
61 |
|
|
|
62 |
#ifdef __OBJC__
|
|
|
63 |
void FIRCLSExceptionRecordModel(FIRExceptionModel* exceptionModel);
|
|
|
64 |
NSString* FIRCLSExceptionRecordOnDemandModel(FIRExceptionModel* exceptionModel,
|
|
|
65 |
int previousRecordedOnDemandExceptions,
|
|
|
66 |
int previousDroppedOnDemandExceptions);
|
|
|
67 |
void FIRCLSExceptionRecordNSException(NSException* exception);
|
|
|
68 |
void FIRCLSExceptionRecord(FIRCLSExceptionType type,
|
|
|
69 |
const char* name,
|
|
|
70 |
const char* reason,
|
|
|
71 |
NSArray<FIRStackFrame*>* frames);
|
|
|
72 |
NSString* FIRCLSExceptionRecordOnDemand(FIRCLSExceptionType type,
|
|
|
73 |
const char* name,
|
|
|
74 |
const char* reason,
|
|
|
75 |
NSArray<FIRStackFrame*>* frames,
|
|
|
76 |
BOOL fatal,
|
|
|
77 |
int previousRecordedOnDemandExceptions,
|
|
|
78 |
int previousDroppedOnDemandExceptions);
|
|
|
79 |
#endif
|
|
|
80 |
|
|
|
81 |
__END_DECLS
|