structs.c
来自「这个是LINUX下的GDB调度工具的源码」· C语言 代码 · 共 460 行
C
460 行
/* This testcase is part of GDB, the GNU debugger. Copyright 1996, 1999, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Please email any bugs, comments, and/or additions to this file to: bug-gdb@prep.ai.mit.edu *//* Useful abreviations. */typedef void t;typedef char tc;typedef short ts;typedef int ti;typedef long tl;typedef long long tll;typedef float tf;typedef double td;typedef long double tld;/* Force the type of each field. */#ifndef tAtypedef t tA;#endif#ifndef tBtypedef tA tB;#endif#ifndef tCtypedef tB tC;#endif#ifndef tDtypedef tC tD;#endif#ifndef tEtypedef tD tE;#endif#ifndef tFtypedef tE tF;#endif#ifndef tGtypedef tF tG;#endif#ifndef tHtypedef tG tH;#endif#ifndef tItypedef tH tI;#endif#ifndef tJtypedef tI tJ;#endif#ifndef tKtypedef tJ tK;#endif#ifndef tLtypedef tK tL;#endif#ifndef tMtypedef tL tM;#endif#ifndef tNtypedef tM tN;#endif#ifndef tOtypedef tN tO;#endif#ifndef tPtypedef tO tP;#endif#ifndef tQtypedef tP tQ;#endif#ifndef tRtypedef tQ tR;#endifstruct struct1 {tA a;};struct struct2 {tA a; tB b;};struct struct3 {tA a; tB b; tC c; };struct struct4 {tA a; tB b; tC c; tD d; };struct struct5 {tA a; tB b; tC c; tD d; tE e; };struct struct6 {tA a; tB b; tC c; tD d; tE e; tF f; };struct struct7 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; };struct struct8 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; };struct struct9 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; };struct struct10 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; };struct struct11 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; };struct struct12 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; };struct struct13 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; };struct struct14 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; };struct struct15 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; };struct struct16 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; };struct struct17 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; tQ q; };struct struct18 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; tQ q; tR r; };struct struct1 foo1 = {'1'}, L1;struct struct2 foo2 = {'a','2'}, L2;struct struct3 foo3 = {'1','b','3'}, L3;struct struct4 foo4 = {'a','2','c','4'}, L4;struct struct5 foo5 = {'1','b','3','d','5'}, L5;struct struct6 foo6 = {'a','2','c','4','e','6'}, L6;struct struct7 foo7 = {'1','b','3','d','5','f','7'}, L7;struct struct8 foo8 = {'a','2','c','4','e','6','g','8'}, L8;struct struct9 foo9 = {'1','b','3','d','5','f','7','h','9'}, L9;struct struct10 foo10 = {'a','2','c','4','e','6','g','8','i','A'}, L10;struct struct11 foo11 = {'1','b','3','d','5','f','7','h','9','j','B'}, L11;struct struct12 foo12 = {'a','2','c','4','e','6','g','8','i','A','k','C'}, L12;struct struct13 foo13 = {'1','b','3','d','5','f','7','h','9','j','B','l','D'}, L13;struct struct14 foo14 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E'}, L14;struct struct15 foo15 = {'1','b','3','d','5','f','7','h','9','j','B','l','D','n','F'}, L15;struct struct16 foo16 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E','o','G'}, L16;struct struct17 foo17 = {'1','b','3','d','5','f','7','h','9','j','B','l','D','n','F','p','H'}, L17;struct struct18 foo18 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E','o','G','q','I'}, L18;struct struct1 fun1(){ return foo1; }struct struct2 fun2(){ return foo2;}struct struct3 fun3(){ return foo3;}struct struct4 fun4(){ return foo4;}struct struct5 fun5(){ return foo5;}struct struct6 fun6(){ return foo6;}struct struct7 fun7(){ return foo7;}struct struct8 fun8(){ return foo8;}struct struct9 fun9(){ return foo9;}struct struct10 fun10(){ return foo10; }struct struct11 fun11(){ return foo11; }struct struct12 fun12(){ return foo12; }struct struct13 fun13(){ return foo13; }struct struct14 fun14(){ return foo14; }struct struct15 fun15(){ return foo15; }struct struct16 fun16(){ return foo16; }struct struct17 fun17(){ return foo17; }struct struct18 fun18(){ return foo18; }#ifdef PROTOTYPESvoid Fun1(struct struct1 foo1)#elsevoid Fun1(foo1) struct struct1 foo1;#endif{ L1 = foo1;}#ifdef PROTOTYPESvoid Fun2(struct struct2 foo2)#elsevoid Fun2(foo2) struct struct2 foo2;#endif{ L2 = foo2;}#ifdef PROTOTYPESvoid Fun3(struct struct3 foo3)#elsevoid Fun3(foo3) struct struct3 foo3;#endif{ L3 = foo3;}#ifdef PROTOTYPESvoid Fun4(struct struct4 foo4)#elsevoid Fun4(foo4) struct struct4 foo4;#endif{ L4 = foo4;}#ifdef PROTOTYPESvoid Fun5(struct struct5 foo5)#elsevoid Fun5(foo5) struct struct5 foo5;#endif{ L5 = foo5;}#ifdef PROTOTYPESvoid Fun6(struct struct6 foo6)#elsevoid Fun6(foo6) struct struct6 foo6;#endif{ L6 = foo6;}#ifdef PROTOTYPESvoid Fun7(struct struct7 foo7)#elsevoid Fun7(foo7) struct struct7 foo7;#endif{ L7 = foo7;}#ifdef PROTOTYPESvoid Fun8(struct struct8 foo8)#elsevoid Fun8(foo8) struct struct8 foo8;#endif{ L8 = foo8;}#ifdef PROTOTYPESvoid Fun9(struct struct9 foo9)#elsevoid Fun9(foo9) struct struct9 foo9;#endif{ L9 = foo9;}#ifdef PROTOTYPESvoid Fun10(struct struct10 foo10)#elsevoid Fun10(foo10) struct struct10 foo10;#endif{ L10 = foo10; }#ifdef PROTOTYPESvoid Fun11(struct struct11 foo11)#elsevoid Fun11(foo11) struct struct11 foo11;#endif{ L11 = foo11; }#ifdef PROTOTYPESvoid Fun12(struct struct12 foo12)#elsevoid Fun12(foo12) struct struct12 foo12;#endif{ L12 = foo12; }#ifdef PROTOTYPESvoid Fun13(struct struct13 foo13)#elsevoid Fun13(foo13) struct struct13 foo13;#endif{ L13 = foo13; }#ifdef PROTOTYPESvoid Fun14(struct struct14 foo14)#elsevoid Fun14(foo14) struct struct14 foo14;#endif{ L14 = foo14; }#ifdef PROTOTYPESvoid Fun15(struct struct15 foo15)#elsevoid Fun15(foo15) struct struct15 foo15;#endif{ L15 = foo15; }#ifdef PROTOTYPESvoid Fun16(struct struct16 foo16)#elsevoid Fun16(foo16) struct struct16 foo16;#endif{ L16 = foo16; }#ifdef PROTOTYPESvoid Fun17(struct struct17 foo17)#elsevoid Fun17(foo17) struct struct17 foo17;#endif{ L17 = foo17; }#ifdef PROTOTYPESvoid Fun18(struct struct18 foo18)#elsevoid Fun18(foo18) struct struct18 foo18;#endif{ L18 = foo18; }zed (){ L1.a = L2.a = L3.a = L4.a = L5.a = L6.a = L7.a = L8.a = L9.a = L10.a = L11.a = L12.a = L13.a = L14.a = L15.a = L16.a = L17.a = L18.a = 'Z'; L2.b = L3.b = L4.b = L5.b = L6.b = L7.b = L8.b = L9.b = L10.b = L11.b = L12.b = L13.b = L14.b = L15.b = L16.b = L17.b = L18.b = 'Z'; L3.c = L4.c = L5.c = L6.c = L7.c = L8.c = L9.c = L10.c = L11.c = L12.c = L13.c = L14.c = L15.c = L16.c = L17.c = L18.c = 'Z'; L4.d = L5.d = L6.d = L7.d = L8.d = L9.d = L10.d = L11.d = L12.d = L13.d = L14.d = L15.d = L16.d = L17.d = L18.d = 'Z'; L5.e = L6.e = L7.e = L8.e = L9.e = L10.e = L11.e = L12.e = L13.e = L14.e = L15.e = L16.e = L17.e = L18.e = 'Z'; L6.f = L7.f = L8.f = L9.f = L10.f = L11.f = L12.f = L13.f = L14.f = L15.f = L16.f = L17.f = L18.f = 'Z'; L7.g = L8.g = L9.g = L10.g = L11.g = L12.g = L13.g = L14.g = L15.g = L16.g = L17.g = L18.g = 'Z'; L8.h = L9.h = L10.h = L11.h = L12.h = L13.h = L14.h = L15.h = L16.h = L17.h = L18.h = 'Z'; L9.i = L10.i = L11.i = L12.i = L13.i = L14.i = L15.i = L16.i = L17.i = L18.i = 'Z'; L10.j = L11.j = L12.j = L13.j = L14.j = L15.j = L16.j = L17.j = L18.j = 'Z'; L11.k = L12.k = L13.k = L14.k = L15.k = L16.k = L17.k = L18.k = 'Z'; L12.l = L13.l = L14.l = L15.l = L16.l = L17.l = L18.l = 'Z'; L13.m = L14.m = L15.m = L16.m = L17.m = L18.m = 'Z'; L14.n = L15.n = L16.n = L17.n = L18.n = 'Z'; L15.o = L16.o = L17.o = L18.o = 'Z'; L16.p = L17.p = L18.p = 'Z'; L17.q = L18.q = 'Z'; L18.r = 'Z';}int main(){#ifdef usestubs set_debug_traps(); breakpoint();#endif int i; Fun1(foo1); Fun2(foo2); Fun3(foo3); Fun4(foo4); Fun5(foo5); Fun6(foo6); Fun7(foo7); Fun8(foo8); Fun9(foo9); Fun10(foo10); Fun11(foo11); Fun12(foo12); Fun13(foo13); Fun14(foo14); Fun15(foo15); Fun16(foo16); Fun17(foo17); Fun18(foo18); /* An infinite loop that first clears all the variables and then calls each function. This "hack" is to make testing random functions easier - "advance funN" is guaranteed to have always been preceeded by a global variable clearing zed call. */ while (1) { zed (); L1 = fun1(); L2 = fun2(); L3 = fun3(); L4 = fun4(); L5 = fun5(); L6 = fun6(); L7 = fun7(); L8 = fun8(); L9 = fun9(); L10 = fun10(); L11 = fun11(); L12 = fun12(); L13 = fun13(); L14 = fun14(); L15 = fun15(); L16 = fun16(); L17 = fun17(); L18 = fun18(); } return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?