/* static */ Bool VG_(sanity_check_needs)(Char** failmsg) { #define CHECK_NOT(var, value) \ if ((var)==(value)) { \ *failmsg = "Tool error: '" #var "' not initialised\n"; \ return False; \ } /* Ones that must be set */ CHECK_NOT(VG_(details).name, NULL); /* Nb: .version can be NULL */ CHECK_NOT(VG_(details).description, NULL); CHECK_NOT(VG_(details).copyright_author, NULL); CHECK_NOT(VG_(details).bug_reports_to, NULL); if ( (VG_(tdict).track_new_mem_stack_4 || VG_(tdict).track_new_mem_stack_8 || VG_(tdict).track_new_mem_stack_12 || VG_(tdict).track_new_mem_stack_16 || VG_(tdict).track_new_mem_stack_32 || VG_(tdict).track_new_mem_stack_112 || VG_(tdict).track_new_mem_stack_128 || VG_(tdict).track_new_mem_stack_144 || VG_(tdict).track_new_mem_stack_160 ) && ! VG_(tdict).track_new_mem_stack) { *failmsg = "Tool error: one of the specialised 'new_mem_stack_n'\n" " events tracked, but not the generic 'new_mem_stack' one.\n" " 'new_mem_stack' should be defined\n"; return False; } if ( (VG_(tdict).track_die_mem_stack_4 || VG_(tdict).track_die_mem_stack_8 || VG_(tdict).track_die_mem_stack_12 || VG_(tdict).track_die_mem_stack_16 || VG_(tdict).track_die_mem_stack_32 || VG_(tdict).track_die_mem_stack_112 || VG_(tdict).track_die_mem_stack_128 || VG_(tdict).track_die_mem_stack_144 || VG_(tdict).track_die_mem_stack_160 ) && ! VG_(tdict).track_die_mem_stack) { *failmsg = "Tool error: one of the specialised 'die_mem_stack_n'\n" " events tracked, but not the generic 'die_mem_stack' one.\n" " 'die_mem_stack' should be defined\n"; return False; } return True; #undef CHECK_NOT }
/* static */ Bool VG_(sanity_check_needs)(const HChar** failmsg) { Bool any_new_mem_stack_N, any_new_mem_stack_N_w_ECU; Bool any_new_mem_stack_w_conflicting_otags; Bool any_die_mem_stack_N; #define CHECK_NOT(var, value) \ if ((var)==(value)) { \ *failmsg = "Tool error: '" #var "' not initialised\n"; \ return False; \ } /* Ones that must be set */ CHECK_NOT(VG_(details).name, NULL); /* Nb: .version can be NULL */ CHECK_NOT(VG_(details).description, NULL); CHECK_NOT(VG_(details).copyright_author, NULL); CHECK_NOT(VG_(details).bug_reports_to, NULL); /* Check that new_mem_stack is defined if any new_mem_stack_N are. */ any_new_mem_stack_N = VG_(tdict).track_new_mem_stack_4 || VG_(tdict).track_new_mem_stack_8 || VG_(tdict).track_new_mem_stack_12 || VG_(tdict).track_new_mem_stack_16 || VG_(tdict).track_new_mem_stack_32 || VG_(tdict).track_new_mem_stack_112 || VG_(tdict).track_new_mem_stack_128 || VG_(tdict).track_new_mem_stack_144 || VG_(tdict).track_new_mem_stack_160; if (any_new_mem_stack_N && ! VG_(tdict).track_new_mem_stack) { *failmsg = "Tool error: one of the specialised 'new_mem_stack_N'\n" " events tracked, but not the generic 'new_mem_stack' one.\n" " 'new_mem_stack' should be defined\n"; return False; } /* Check that new_mem_stack_w_ECU is defined if any new_mem_stack_N_w_ECU are. */ any_new_mem_stack_N_w_ECU = VG_(tdict).track_new_mem_stack_4_w_ECU || VG_(tdict).track_new_mem_stack_8_w_ECU || VG_(tdict).track_new_mem_stack_12_w_ECU || VG_(tdict).track_new_mem_stack_16_w_ECU || VG_(tdict).track_new_mem_stack_32_w_ECU || VG_(tdict).track_new_mem_stack_112_w_ECU || VG_(tdict).track_new_mem_stack_128_w_ECU || VG_(tdict).track_new_mem_stack_144_w_ECU || VG_(tdict).track_new_mem_stack_160_w_ECU; if (any_new_mem_stack_N_w_ECU && ! VG_(tdict).track_new_mem_stack_w_ECU) { *failmsg = "Tool error: one of the specialised 'new_mem_stack_N_w_ECU'\n" " events tracked, but not the generic 'new_mem_stack_w_ECU' one.\n" " 'new_mem_stack_w_ECU' should be defined\n"; return False; } /* Check that in no cases are both with- and without-otag versions of the same new_mem_stack_ function defined. */ any_new_mem_stack_w_conflicting_otags = (VG_(tdict).track_new_mem_stack_4 && VG_(tdict).track_new_mem_stack_4_w_ECU) || (VG_(tdict).track_new_mem_stack_8 && VG_(tdict).track_new_mem_stack_8_w_ECU) || (VG_(tdict).track_new_mem_stack_12 && VG_(tdict).track_new_mem_stack_12_w_ECU) || (VG_(tdict).track_new_mem_stack_16 && VG_(tdict).track_new_mem_stack_16_w_ECU) || (VG_(tdict).track_new_mem_stack_32 && VG_(tdict).track_new_mem_stack_32_w_ECU) || (VG_(tdict).track_new_mem_stack_112 && VG_(tdict).track_new_mem_stack_112_w_ECU) || (VG_(tdict).track_new_mem_stack_128 && VG_(tdict).track_new_mem_stack_128_w_ECU) || (VG_(tdict).track_new_mem_stack_144 && VG_(tdict).track_new_mem_stack_144_w_ECU) || (VG_(tdict).track_new_mem_stack_160 && VG_(tdict).track_new_mem_stack_160_w_ECU) || (VG_(tdict).track_new_mem_stack && VG_(tdict).track_new_mem_stack_w_ECU); if (any_new_mem_stack_w_conflicting_otags) { *failmsg = "Tool error: tool supplies both a 'new_mem_stack_N' and a\n" " 'new_mem_stack_N_w_ECU' function for some N (or none),\n" " but you can only have one or the other (not both)\n"; return False; } /* Check that die_mem_stack is defined if any die_mem_stack_N are. */ any_die_mem_stack_N = VG_(tdict).track_die_mem_stack_4 || VG_(tdict).track_die_mem_stack_8 || VG_(tdict).track_die_mem_stack_12 || VG_(tdict).track_die_mem_stack_16 || VG_(tdict).track_die_mem_stack_32 || VG_(tdict).track_die_mem_stack_112 || VG_(tdict).track_die_mem_stack_128 || VG_(tdict).track_die_mem_stack_144 || VG_(tdict).track_die_mem_stack_160; if (any_die_mem_stack_N && ! VG_(tdict).track_die_mem_stack) { *failmsg = "Tool error: one of the specialised 'die_mem_stack_N'\n" " events tracked, but not the generic 'die_mem_stack' one.\n" " 'die_mem_stack' should be defined\n"; return False; } return True; #undef CHECK_NOT }