void Stats_Print(FILE *f, struct NCValidatorState *vstate) { if (!VERBOSE) return; if (vstate == NULL) { fprintf(f, "Analysis Summary: invalid module or internal failure\n"); return; } PrintOpcodeHisto(f, vstate); fprintf(f, "Analysis Summary:\n"); fprintf(f, "%d Checked instructions\n", vstate->stats.instructions); fprintf(f, "%d checked jump targets\n", vstate->stats.checktarget); fprintf(f, "%d calls/jumps need dynamic checking (%0.2f%%)\n", vstate->stats.targetindirect, vstate->stats.instructions ? 100.0 * vstate->stats.targetindirect/vstate->stats.instructions : 0); fprintf(f, "\nProblems:\n"); fprintf(f, "%d illegal instructions\n", vstate->stats.illegalinst); fprintf(f, "%d bad jump targets\n", vstate->stats.badtarget); fprintf(f, "%d illegal unprotected indirect jumps (including ret)\n", vstate->stats.unsafeindirect); fprintf(f, "%d instruction alignment defects\n", vstate->stats.badalignment); fprintf(f, "%d segmentation errors\n", vstate->stats.segfaults); fprintf(f, "%d bad prefix\n", vstate->stats.badprefix); fprintf(f, "%d bad instruction length\n", vstate->stats.badinstlength); fprintf(f, "%d internal errors\n", vstate->stats.internalerrors); fprintf(f, "%d bad cpu\n", vstate->stats.badcpu); }
void NCStatsPrint(struct NCValidatorState *vstate) { NaClErrorReporter* reporter; if (!VERBOSE || (vstate == NULL)) return; reporter = vstate->dstate.error_reporter; PrintOpcodeHisto(vstate); (*reporter->printf)(reporter, "Analysis Summary:\n"); (*reporter->printf)(reporter, "%d Checked instructions\n", vstate->stats.instructions); (*reporter->printf)(reporter, "%d checked jump targets\n", vstate->stats.checktarget); (*reporter->printf)( reporter, "%d calls/jumps need dynamic checking (%0.2f%%)\n", vstate->stats.targetindirect, vstate->stats.instructions ? 100.0 * vstate->stats.targetindirect/vstate->stats.instructions : 0); if (vstate->stats.didstubout) { (*reporter->printf)(reporter, "Some instructions were replaced with HLTs"); } (*reporter->printf)(reporter, "\nProblems:\n"); (*reporter->printf)(reporter, "%d illegal instructions\n", vstate->stats.illegalinst); (*reporter->printf)(reporter, "%d bad jump targets\n", vstate->stats.badtarget); (*reporter->printf)( reporter, "%d illegal unprotected indirect jumps (including ret)\n", vstate->stats.unsafeindirect); (*reporter->printf)(reporter, "%d instruction alignment defects\n", vstate->stats.badalignment); (*reporter->printf)(reporter, "%d segmentation errors\n", vstate->stats.segfaults); (*reporter->printf)(reporter, "%d bad prefix\n", vstate->stats.badprefix); (*reporter->printf)(reporter, "%d bad instruction length\n", vstate->stats.badinstlength); (*reporter->printf)(reporter, "%d internal errors\n", vstate->stats.internalerrors); }