inline void InitSemantic(void) { optional opt = init_sym(); if (!opt.e) { fprintf(dbg_file, "Initialization of symbol table failed.\n"); exit(1); } else { tab = opt.val; } opt = arr_init(32); if (!opt.e) { fprintf(dbg_file, "Initializiation of operator array failed.\n"); exit(1); } else { operators = opt.val; } opt = arr_init(32); if (!opt.e) { fprintf(dbg_file, "Initilization of operand array failed.\n"); exit(1); } else { operands = opt.val; } }
static void init() { ::setlocale(LC_ALL, ""); int32_t cpus = 0; process_base::cwd(s_root); os_base::cpuNumbers(cpus); if (cpus < 2) cpus = 2; exlib::Service::init(cpus + 1); init_date(); init_acThread(); init_aio(); init_process(); #ifdef Linux init_sym(); #endif srand((unsigned int)time(0)); v8::Platform* platform = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(platform); v8::V8::Initialize(); }
PUBLIC int main(int ac, char **av) { int i, n_files; char **files; argc = ac; argv = av; while (--argc > 0 && (*++argv)[0] == '-') do_flags(*argv); files = argv; n_files = argc; if (debflag('v')) { fprintf(errout, "%s\n%s\n%s\n", fuzz_banner, fuzz_rcsid, fuzz_copyright); fflush(errout); } debugging = debflag('p'); init_sym(); init_type(); init_dict(); open_prelude(); read_a_file(); if (dflag) { check_file(); clear_temp((univ) NULL); } debugging = TRUE; if (n_files == 0) { /* Finished prelude, no args: read stdin */ file_name = "standard input"; yyrestart(stdin); read_a_file(); } else { for (i = 0; i < n_files; i++) { reopen_input(files[i]); yyrestart(yyin); read_a_file(); } } if (dflag) { check_file(); clear_temp((univ) NULL); } #ifdef DEBUG if (debflag('h')) dump_hash(); #endif return (n_errors > 0 ? 1 : 0); }
/*----------------------------------------------------------------------------- * Init functions *----------------------------------------------------------------------------*/ DEFINE_init_module() { input_buf = str_new(STR_SIZE); p = str_data(input_buf); input_stack = OBJ_NEW(List); input_stack->free_data = m_free_compat; init_sym(); utarray_new(scan_state, &ut_scan_state_icd); }
/*----------------------------------------------------------------------------- * Get the next token, fill the corresponding tok* variables *----------------------------------------------------------------------------*/ tokid_t GetSym( void ) { init_module(); init_sym(); /* keep returning TK_NEWLINE until EOL is cleared * NOTE: HACK for inconsistent parser in handling newlines, should be removed */ if ( EOL ) { at_bol = TRUE; sym.tstart = "\n"; sym.tlen = 1; return (sym.tok = TK_NEWLINE); /* assign and return */ } /* loop filling buffer when needed */ do { /* refill buffer if needed, check for end of file */ if ( ! fill_buffer() ) { sym.tok = TK_END; ts = te = p; break; } /* run the state machine */ sym.tok = _scan_get(); } while ( sym.tok == TK_END ); sym.tstart = ts; sym.tlen = te - ts; /* remember token position */ at_bol = EOL = (sym.tok == TK_NEWLINE) ? TRUE : FALSE; return sym.tok; }
void __hidden init_dvm_iface(struct dvm_iface *dvm, const char *dso_path) { int ii; if (dvm->dso) return; dvm->dso = (void *)1; dvm->dso = dlopen(dso_path, RTLD_NOW | RTLD_LOCAL); if (!dvm->dso) { libc_log("E:Could not open libdvm (%s)!", dso_path); return; } /* initialize the minimal Dalvik debug interface */ #define __init_sym(iface,sym,mem) \ do { \ if ((iface)->mem) \ break; \ (iface)->mem = dlsym((iface)->dso, #sym); \ if ((iface)->mem) \ break; \ (iface)->mem = dlsym((iface)->dso, "_" #sym); \ if ((iface)->mem) \ break; \ BUG(0xD0); \ } while (0) #define _init_sym(iface,sym,mem) \ __init_sym(iface, sym, mem) #define init_sym(IFACE,SYM) \ _init_sym(IFACE, sym_DVM_ ## SYM, dvm ## SYM) init_sym(dvm, ThreadSelf); init_sym(dvm, ComputeExactFrameDepth); init_sym(dvm, FillStackTraceArray); init_sym(dvm, GetThreadName); init_sym(dvm, HumanReadableMethod); #undef init_sym #undef _init_sym #undef __init_sym /* * Now find the functions that indicate * we are within the Java call stack */ dvm->dvmCallMethodSym[0][0] = dlsym(dvm->dso, DVM_CALL_METHOD); dvm->dvmCallMethodSym[1][0] = dlsym(dvm->dso, DVM_CALL_METHOD_A); dvm->dvmCallMethodSym[2][0] = dlsym(dvm->dso, DVM_CALL_METHOD_V); dvm->dvmCallMethodSym[3][0] = dlsym(dvm->dso, DVM_CALL_JNI_METHOD); dvm->dvmCallMethodSym[4][0] = dlsym(dvm->dso, DVM_CALL_JNI_METHOD_CHK); /* * note: if either of these fail, then we won't ever find a * java/dalvik backtrace, but we won't risk instability either */ for (ii = 0; ii < (int)ARRAY_SZ(dvm->dvmCallMethodSym); ii++) { if (!dvm->dvmCallMethodSym[ii][0]) { libc_log("W:Couldn't find dvmCallMethod[%d] in libdvm.so", ii); } else { void *end; end = _find_symbol_end(dvm->dvmCallMethodSym[ii][0]); dvm->dvmCallMethodSym[ii][1] = end; /* libc_log("I:dvmCallMethod[%d][%p-%p]:", ii, dvm->dvmCallMethodSym[ii][0], dvm->dvmCallMethodSym[ii][1]); */ } } dvm->valid = 1; return; }