1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 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 16 #ifndef DFX_CRASHER_H 17 #define DFX_CRASHER_H 18 19 #include <stdint.h> 20 21 #define NOINLINE __attribute__((noinline)) 22 23 #define GEN_TEST_FUNCTION(FuncNumA, FuncNumB) \ 24 __attribute__((noinline)) int TestFunc##FuncNumA() \ 25 { \ 26 return TestFunc##FuncNumB(); \ 27 } 28 29 30 int RaiseAbort(void); 31 int Abort(void); 32 int RaiseBusError(void); 33 int RaiseFloatingPointException(void); 34 int RaiseIllegalInstructionException(void); 35 int IllegalInstructionException(void); 36 int RaiseSegmentFaultException(void); 37 int SegmentFaultException(void); 38 int RaiseTrapException(void); 39 int CrashTest(void); 40 41 42 void PrintUsage(void); 43 void *DoCrashInThread(void *inputArg); 44 void *SleepThread(void *argv); 45 46 uint64_t DoActionOnSubThread(const char *arg); 47 uint64_t ParseAndDoCrash(const char *arg); 48 int MaxStackDepth(void); 49 50 // 1 2 3 4 5 6 7 51 // 1234567890123456789012345678901234567890123456789012345678901234567890 52 int MaxMethodNameTest12345678901234567890123456789012345678901234567890ABC(void); 53 54 int TriggerSegmentFaultException(void); 55 int TriggerTrapException(void); 56 57 // test functions for callstack depth test 58 int TestFunc0(void); 59 int TestFunc1(void); 60 int TestFunc2(void); 61 int TestFunc3(void); 62 int TestFunc4(void); 63 int TestFunc5(void); 64 int TestFunc6(void); 65 int TestFunc7(void); 66 int TestFunc8(void); 67 int TestFunc9(void); 68 int TestFunc10(void); 69 int TestFunc11(void); 70 int TestFunc12(void); 71 int TestFunc13(void); 72 int TestFunc14(void); 73 int TestFunc15(void); 74 int TestFunc16(void); 75 int TestFunc17(void); 76 int TestFunc18(void); 77 int TestFunc19(void); 78 int TestFunc20(void); 79 int TestFunc21(void); 80 int TestFunc22(void); 81 int TestFunc23(void); 82 int TestFunc24(void); 83 int TestFunc25(void); 84 int TestFunc26(void); 85 int TestFunc27(void); 86 int TestFunc28(void); 87 int TestFunc29(void); 88 int TestFunc30(void); 89 int TestFunc31(void); 90 int TestFunc32(void); 91 int TestFunc33(void); 92 int TestFunc34(void); 93 int TestFunc35(void); 94 int TestFunc36(void); 95 int TestFunc37(void); 96 int TestFunc38(void); 97 int TestFunc39(void); 98 int TestFunc40(void); 99 int TestFunc41(void); 100 int TestFunc42(void); 101 int TestFunc43(void); 102 int TestFunc44(void); 103 int TestFunc45(void); 104 int TestFunc46(void); 105 int TestFunc47(void); 106 int TestFunc48(void); 107 int TestFunc49(void); 108 int TestFunc50(void); 109 int TestFunc51(void); 110 int TestFunc52(void); 111 int TestFunc53(void); 112 int TestFunc54(void); 113 int TestFunc55(void); 114 int TestFunc56(void); 115 int TestFunc57(void); 116 int TestFunc58(void); 117 int TestFunc59(void); 118 int TestFunc60(void); 119 int TestFunc61(void); 120 int TestFunc62(void); 121 int TestFunc63(void); 122 int TestFunc64(void); 123 int TestFunc65(void); 124 int TestFunc66(void); 125 int TestFunc67(void); 126 int TestFunc68(void); 127 int TestFunc69(void); 128 int TestFunc70(void); 129 130 #endif // DFX_CRASHER_H 131