diff --git a/fakegen.rb b/fakegen.rb index 0afe819..13f7104 100644 --- a/fakegen.rb +++ b/fakegen.rb @@ -5,7 +5,7 @@ $cpp_output = true $MAX_ARGS = 10 -$MAX_ARG_HISTORY = 10 +$DEFAULT_ARG_HISTORY = 10 $MAX_CALL_HISTORY = 10 def output_macro(args, is_value_function) @@ -90,14 +90,15 @@ def output_argument_capture_variables(i) # last argument puts " static ARG#{i}_TYPE FUNCNAME##_arg#{i}_val; \\" # argument history array -# puts " static ARG#{i}_TYPE FUNCNAME##_arg#{i}_history[];" -# puts " static int FUNCNAME##_arg#{i}_history_idx;" + puts " static ARG#{i}_TYPE FUNCNAME##_arg#{i}_history[#{$DEFAULT_ARG_HISTORY}];\\" end def output_variables(arg_count, is_value_function) arg_count.times { |i| output_argument_capture_variables(i) } puts " static RETURN_TYPE FUNCNAME##_return_val; \\" unless not is_value_function - puts " static int FUNCNAME##_call_count = 0; \\" + puts " static unsigned int FUNCNAME##_call_count = 0; \\" + puts " static unsigned int FUNCNAME##_arg_history_len = #{$DEFAULT_ARG_HISTORY};\\" + puts " static unsigned int FUNCNAME##_arg_histories_dropped = 0; \\" end def output_function_signature(args_count, is_value_function) @@ -117,6 +118,18 @@ end def output_function_body(arg_count, is_value_function) # capture arguments arg_count.times { |i| puts " FUNCNAME##_arg#{i}_val = arg#{i}; \\" } + # store in argument history + arg_count.times { |i| + puts " if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\\" + puts " FUNCNAME##_arg#{i}_history[FUNCNAME##_call_count] = arg#{i}; \\" + puts " }\\" + } + + # update dropped argument history counts + puts " if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\\" + puts " FUNCNAME##_arg_histories_dropped++;\\" + puts " }\\" + # update call count puts " FUNCNAME##_call_count++; \\" #register call diff --git a/fff.h b/fff.h index aa8fad3..591b4c9 100644 --- a/fff.h +++ b/fff.h @@ -30,8 +30,13 @@ static StaticInitializer_##FUNCNAME staticInitializer_##FUNCNAME; \ /* Defining a void function with 0 parameters*/ #define FAKE_VOID_FUNC0(FUNCNAME) \ extern "C"{ \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(){ \ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -46,9 +51,18 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0){ \ FUNCNAME##_arg0_val = arg0; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -64,11 +78,24 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -85,13 +112,30 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -109,15 +153,36 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -136,17 +201,42 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -166,12 +256,20 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -179,6 +277,27 @@ extern "C"{ \ FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -199,13 +318,22 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -214,6 +342,30 @@ extern "C"{ \ FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -235,14 +387,24 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -252,6 +414,33 @@ extern "C"{ \ FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -274,15 +463,26 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ static ARG8_TYPE FUNCNAME##_arg8_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG8_TYPE FUNCNAME##_arg8_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -293,6 +493,36 @@ extern "C"{ \ FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ FUNCNAME##_arg8_val = arg8; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg8_history[FUNCNAME##_call_count] = arg8; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -316,8 +546,13 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \ extern "C"{ \ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(){ \ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -334,10 +569,19 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0){ \ FUNCNAME##_arg0_val = arg0; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -355,12 +599,25 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -379,14 +636,31 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -406,16 +680,37 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -436,18 +731,43 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -469,13 +789,21 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -483,6 +811,27 @@ extern "C"{ \ FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -505,14 +854,23 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -521,6 +879,30 @@ extern "C"{ \ FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -544,15 +926,25 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -562,6 +954,33 @@ extern "C"{ \ FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -586,16 +1005,27 @@ STATIC_INIT(FUNCNAME) \ #define FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \ extern "C"{ \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ static ARG8_TYPE FUNCNAME##_arg8_val; \ + static ARG8_TYPE FUNCNAME##_arg8_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -606,6 +1036,36 @@ extern "C"{ \ FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ FUNCNAME##_arg8_val = arg8; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg8_history[FUNCNAME##_call_count] = arg8; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -644,8 +1104,13 @@ void RESET_HISTORY() { /* Defining a void function with 0 parameters*/ #define FAKE_VOID_FUNC0(FUNCNAME) \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(){ \ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -657,9 +1122,18 @@ void RESET_HISTORY() { /* Defining a void function with 1 parameters*/ #define FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0){ \ FUNCNAME##_arg0_val = arg0; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -672,11 +1146,24 @@ void RESET_HISTORY() { /* Defining a void function with 2 parameters*/ #define FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -690,13 +1177,30 @@ void RESET_HISTORY() { /* Defining a void function with 3 parameters*/ #define FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -711,15 +1215,36 @@ void RESET_HISTORY() { /* Defining a void function with 4 parameters*/ #define FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -735,17 +1260,42 @@ void RESET_HISTORY() { /* Defining a void function with 5 parameters*/ #define FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -762,12 +1312,20 @@ void RESET_HISTORY() { /* Defining a void function with 6 parameters*/ #define FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -775,6 +1333,27 @@ void RESET_HISTORY() { FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -792,13 +1371,22 @@ void RESET_HISTORY() { /* Defining a void function with 7 parameters*/ #define FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -807,6 +1395,30 @@ void RESET_HISTORY() { FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -825,14 +1437,24 @@ void RESET_HISTORY() { /* Defining a void function with 8 parameters*/ #define FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -842,6 +1464,33 @@ void RESET_HISTORY() { FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -861,15 +1510,26 @@ void RESET_HISTORY() { /* Defining a void function with 9 parameters*/ #define FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ static ARG8_TYPE FUNCNAME##_arg8_val; \ - static int FUNCNAME##_call_count = 0; \ + static ARG8_TYPE FUNCNAME##_arg8_history[10];\ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -880,6 +1540,36 @@ void RESET_HISTORY() { FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ FUNCNAME##_arg8_val = arg8; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg8_history[FUNCNAME##_call_count] = arg8; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ } \ @@ -900,8 +1590,13 @@ void RESET_HISTORY() { /* Defining a function returning a value with 0 parameters*/ #define FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(){ \ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -915,10 +1610,19 @@ void RESET_HISTORY() { /* Defining a function returning a value with 1 parameters*/ #define FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0){ \ FUNCNAME##_arg0_val = arg0; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -933,12 +1637,25 @@ void RESET_HISTORY() { /* Defining a function returning a value with 2 parameters*/ #define FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -954,14 +1671,31 @@ void RESET_HISTORY() { /* Defining a function returning a value with 3 parameters*/ #define FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -978,16 +1712,37 @@ void RESET_HISTORY() { /* Defining a function returning a value with 4 parameters*/ #define FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -1005,18 +1760,43 @@ void RESET_HISTORY() { /* Defining a function returning a value with 5 parameters*/ #define FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ FUNCNAME##_arg2_val = arg2; \ FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -1035,13 +1815,21 @@ void RESET_HISTORY() { /* Defining a function returning a value with 6 parameters*/ #define FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -1049,6 +1837,27 @@ void RESET_HISTORY() { FUNCNAME##_arg3_val = arg3; \ FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -1068,14 +1877,23 @@ void RESET_HISTORY() { /* Defining a function returning a value with 7 parameters*/ #define FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -1084,6 +1902,30 @@ void RESET_HISTORY() { FUNCNAME##_arg4_val = arg4; \ FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -1104,15 +1946,25 @@ void RESET_HISTORY() { /* Defining a function returning a value with 8 parameters*/ #define FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -1122,6 +1974,33 @@ void RESET_HISTORY() { FUNCNAME##_arg5_val = arg5; \ FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ @@ -1143,16 +2022,27 @@ void RESET_HISTORY() { /* Defining a function returning a value with 9 parameters*/ #define FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \ static ARG0_TYPE FUNCNAME##_arg0_val; \ + static ARG0_TYPE FUNCNAME##_arg0_history[10];\ static ARG1_TYPE FUNCNAME##_arg1_val; \ + static ARG1_TYPE FUNCNAME##_arg1_history[10];\ static ARG2_TYPE FUNCNAME##_arg2_val; \ + static ARG2_TYPE FUNCNAME##_arg2_history[10];\ static ARG3_TYPE FUNCNAME##_arg3_val; \ + static ARG3_TYPE FUNCNAME##_arg3_history[10];\ static ARG4_TYPE FUNCNAME##_arg4_val; \ + static ARG4_TYPE FUNCNAME##_arg4_history[10];\ static ARG5_TYPE FUNCNAME##_arg5_val; \ + static ARG5_TYPE FUNCNAME##_arg5_history[10];\ static ARG6_TYPE FUNCNAME##_arg6_val; \ + static ARG6_TYPE FUNCNAME##_arg6_history[10];\ static ARG7_TYPE FUNCNAME##_arg7_val; \ + static ARG7_TYPE FUNCNAME##_arg7_history[10];\ static ARG8_TYPE FUNCNAME##_arg8_val; \ + static ARG8_TYPE FUNCNAME##_arg8_history[10];\ static RETURN_TYPE FUNCNAME##_return_val; \ - static int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_call_count = 0; \ + static unsigned int FUNCNAME##_arg_history_len = 10;\ + static unsigned int FUNCNAME##_arg_histories_dropped = 0; \ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \ FUNCNAME##_arg0_val = arg0; \ FUNCNAME##_arg1_val = arg1; \ @@ -1163,6 +2053,36 @@ void RESET_HISTORY() { FUNCNAME##_arg6_val = arg6; \ FUNCNAME##_arg7_val = arg7; \ FUNCNAME##_arg8_val = arg8; \ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg0_history[FUNCNAME##_call_count] = arg0; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg1_history[FUNCNAME##_call_count] = arg1; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg2_history[FUNCNAME##_call_count] = arg2; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg3_history[FUNCNAME##_call_count] = arg3; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg4_history[FUNCNAME##_call_count] = arg4; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg5_history[FUNCNAME##_call_count] = arg5; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg6_history[FUNCNAME##_call_count] = arg6; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg7_history[FUNCNAME##_call_count] = arg7; \ + }\ + if(FUNCNAME##_call_count < FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg8_history[FUNCNAME##_call_count] = arg8; \ + }\ + if(FUNCNAME##_call_count >= FUNCNAME##_arg_history_len){\ + FUNCNAME##_arg_histories_dropped++;\ + }\ FUNCNAME##_call_count++; \ REGISTER_CALL(FUNCNAME); \ return FUNCNAME##_return_val; \ diff --git a/test/fff_test_c.c b/test/fff_test_c.c index 2291904..7c38055 100644 --- a/test/fff_test_c.c +++ b/test/fff_test_c.c @@ -85,6 +85,45 @@ TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_and_reset_then_captu ASSERT_EQ(voidfunc2_arg1_val, 0); } + + +// Argument history +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_created_default_history_is_ten_calls) +{ + ASSERT_EQ(10u, (sizeof voidfunc2_arg0_history) / (sizeof voidfunc2_arg0_history[0])); + ASSERT_EQ(10u, (sizeof voidfunc2_arg1_history) / (sizeof voidfunc2_arg1_history[0])); +} + +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_then_arguments_captured_in_history) +{ + voidfunc2('g', 'h'); + ASSERT_EQ('g', voidfunc2_arg0_history[0]); + ASSERT_EQ('h', voidfunc2_arg1_history[0]); +} + +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_max_times_then_no_argument_histories_dropped) +{ + int i; + for(i = 0; i < 10; i++) + { + voidfunc2('1'+i, '2'+i); + } + ASSERT_EQ(0u, voidfunc2_arg_histories_dropped); +} + +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_max_times_plus_one_then_one_argument_history_dropped) +{ + int i; + for(i = 0; i < 10; i++) + { + voidfunc2('1'+i, '2'+i); + } + voidfunc2('1', '2'); + ASSERT_EQ(1u, voidfunc2_arg_histories_dropped); +} + + + // Return values TEST_F(FFFTestSuite, value_func_will_return_zero_by_default) { @@ -147,6 +186,7 @@ TEST_F(FFFTestSuite, calling_fake_registers_one_call) } + int main() { setbuf(stdout, NULL); @@ -165,6 +205,12 @@ int main() RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_then_last_args_captured); RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_twice_then_last_args_captured); RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_and_reset_then_captured_arg_is_zero); + + RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_created_default_history_is_ten_calls); + RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_then_arguments_captured_in_history); + RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_max_times_then_no_argument_histories_dropped); + RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_max_times_plus_one_then_one_argument_history_dropped); + RUN_TEST(FFFTestSuite, value_func_will_return_zero_by_default); RUN_TEST(FFFTestSuite, value_func_will_return_value_given); RUN_TEST(FFFTestSuite, value_func_will_return_zero_after_reset); diff --git a/test/fff_test_cpp.cpp b/test/fff_test_cpp.cpp index ccc80e6..720fb57 100644 --- a/test/fff_test_cpp.cpp +++ b/test/fff_test_cpp.cpp @@ -25,20 +25,20 @@ public: // Call counting TEST_F(FFFTestSuite, when_void_func_never_called_then_callcount_is_zero) { - ASSERT_EQ(voidfunc1_call_count, 0); + ASSERT_EQ(voidfunc1_call_count, 0u); } TEST_F(FFFTestSuite, when_void_func_called_once_then_callcount_is_one) { voidfunc1(66); - ASSERT_EQ(voidfunc1_call_count, 1); + ASSERT_EQ(voidfunc1_call_count, 1u); } TEST_F(FFFTestSuite, when_void_func_called_once_and_reset_then_callcount_is_zero) { voidfunc1(66); RESET_FAKE(voidfunc1); - ASSERT_EQ(voidfunc1_call_count, 0); + ASSERT_EQ(voidfunc1_call_count, 0u); } // Single Argument @@ -86,6 +86,45 @@ TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_and_reset_then_captu ASSERT_EQ(voidfunc2_arg1_val, 0); } + + +// Argument history +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_created_default_history_is_ten_calls) +{ + ASSERT_EQ(10u, (sizeof voidfunc2_arg0_history) / (sizeof voidfunc2_arg0_history[0])); + ASSERT_EQ(10u, (sizeof voidfunc2_arg1_history) / (sizeof voidfunc2_arg1_history[0])); +} + +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_then_arguments_captured_in_history) +{ + voidfunc2('g', 'h'); + ASSERT_EQ('g', voidfunc2_arg0_history[0]); + ASSERT_EQ('h', voidfunc2_arg1_history[0]); +} + +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_max_times_then_no_argument_histories_dropped) +{ + int i; + for(i = 0; i < 10; i++) + { + voidfunc2('1'+i, '2'+i); + } + ASSERT_EQ(0u, voidfunc2_arg_histories_dropped); +} + +TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_max_times_plus_one_then_one_argument_history_dropped) +{ + int i; + for(i = 0; i < 10; i++) + { + voidfunc2('1'+i, '2'+i); + } + voidfunc2('1', '2'); + ASSERT_EQ(1u, voidfunc2_arg_histories_dropped); +} + + + // Return values TEST_F(FFFTestSuite, value_func_will_return_zero_by_default) {