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