VOID Commence() { trace_enter(); /* Init instruction counter */ counter = 0; init = true; string _addr, _name; if (ifile.is_open()) { while (ifile) { char m; unsigned int nb_param = 0; vector<bool> type_param; string img_name = read_part(&m); if (img_name.empty()) { continue; } ADDRINT img_addr = atol(read_part(&m).c_str()); string name = read_part(&m); /* Read parameters */ while (ifile && m != '\n') { string part = read_part(&m); switch (part[0]) { case 'A': type_param.push_back(true); break; case 'I': case 'V': type_param.push_back(false); break; case 'F': type_param.push_back(false); break; default: type_param.push_back(false); } nb_param += 1; } FID fid = fn_register(img_name, img_addr, name); if (fid != FID_UNKNOWN) { fn_registered(fid, nb_param - 1, type_param); } } } gettimeofday(&start, NULL); trace_leave(); return; }
VOID register_functions_from_arity_log() { ifstream ifile; ifile.open(KnobInputFile.Value().c_str()); if (ifile.is_open()) { while (ifile) { char m; string img_name = read_part(ifile, &m); if (img_name.empty()) { continue; } ADDRINT img_addr = atol(read_part(ifile, &m).c_str()); string name = read_part(ifile, &m); UINT64 int_arity = atol(read_part(ifile, &m).c_str()); UINT64 int_stack_arity = atol(read_part(ifile, &m).c_str()); UINT64 float_arity = atol(read_part(ifile, &m).c_str()); UINT64 float_stack_arity = atol(read_part(ifile, &m).c_str()); UINT64 has_return = atol(read_part(ifile, &m).c_str()); vector<UINT32> int_param_idx; while (ifile && m != '\n') { string part = read_part(ifile, &m); if (part.length() == 0) { break; } long idx = atol(part.c_str()); int_param_idx.push_back(idx); } FID fid = fn_register(img_name, img_addr, name); if (fid != FID_UNKNOWN) { fn_registered(fid, int_arity, int_stack_arity, float_arity, float_stack_arity, has_return, int_param_idx); } } ifile.close(); } }