// return 0 for normal case
int daemonLoop(void)
{
	int return_value = 0;

	ecore_init();

	if (init_input_events() == -1) {
		return_value = -1;
		goto END_EVENT;
	}

	if (!initialize_events()) {
		return_value = -1;
		goto END_EFD;
	}

	if (launch_timer_start() < 0) {
		LOGE("Launch timer start failed\n");
		return_value = -1;
		goto END_EFD;
	}

	init_prof_session(&prof_session);

	ecore_main_loop_begin();
	ecore_shutdown();

 END_EFD:
	LOGI("close efd\n");
	close(manager.efd);
 END_EVENT:
	return return_value;
}
Beispiel #2
0
int main(int argc, char** argv)
{
    PIN_InitSymbols();

    if(PIN_Init(argc,argv))
    {
        return Usage();
    }
    
    // Set up the events
    initialize_events();
    
    if(!KnobDisableLibraryTracing.Value())
    {
        printf("Enabling library tracing.\n");
        /* Enable library tracing. */
        IMG_AddInstrumentFunction(library_loaded_function, 0);
        IMG_AddUnloadFunction(library_unloaded_function, 0);
    }

    if(KnobEnableInitialMonitoring.Value())
    {
        printf("Enabling tracing on initialization.\n");
        event_monitoring_set(true);
    }
    
    if(KnobEnableMonitoring.Value())
    {
        long start = KnobRegionStart.Value();
        long end = KnobRegionEnd.Value();
        const char* library_name = KnobRegionName.Value().c_str();

        printf("Library name: %s\n", library_name);
        printf("0x%lx 0x%lx\n", start, end);

        region_t *r = (region_t*)malloc(sizeof(region_t));
        r->start = (void*)start;
        r->end = (void*)end;
        strncpy(r->library_name, library_name, 260);
        printf("Added %s\n", r->library_name);
        add_region_to_monitoring(r);

        event_snapshot_set(true);

        region_monitoring_enabled = true;
    }
    
    // Add instrumentation. It handles both regions and instruction monitoring so must be enabled
    INS_AddInstrumentFunction(instruction_trace, 0);

    // Start up the program to investigate.
    PIN_StartProgram();

    return 0;
}
Beispiel #3
0
int evtdef_pass1(cpel_section_header_t *sh, int verbose, FILE *ofp)
{
    int i, nevents;
    event_definition_section_header_t *edh;
    event_definition_t *ep;
    u8 *this_strtab;
    u32 event_code;
    uword *p;
    bound_event_t *bp;

    edh = (event_definition_section_header_t *)(sh+1);
    nevents = ntohl(edh->number_of_event_definitions);
    
    if (verbose) {
        fprintf(ofp, "Event Definition Section: %d definitions\n",
                nevents);
    }

    p = hash_get_mem(the_strtab_hash, edh->string_table_name);
    if (!p) {
        fprintf(ofp, "Fatal: couldn't find string table\n");
        return(1);
    }
    this_strtab = (u8 *)p[0];

    initialize_events();

    ep = (event_definition_t *)(edh+1);
    
    for (i = 0; i < nevents; i++) {
        event_code = ntohl(ep->event);
        p = hash_get(the_evtdef_hash, event_code);
        if (p) {
            fprintf(ofp, "Event %d redefined, retain first definition\n",
                    event_code);
            continue;
        }
        vec_add2(bound_events, bp, 1);
        bp->event_code = event_code;
        bp->event_str = this_strtab + ntohl(ep->event_format);
        bp->datum_str = this_strtab + ntohl(ep->datum_format);
        hash_set(the_evtdef_hash, event_code, bp - bound_events);

        add_event_from_cpel_file(event_code, (char *) bp->event_str, 
                                 (char *)bp->datum_str);

        ep++;
    }

    finalize_events();
    return (0);
}
Beispiel #4
0
void initialize_kernel() {
    bwsetfifo(COM2, OFF);

    void (**syscall_handler)() = (void (**)())0x28;
    *syscall_handler = &kernel_enter;

    void (**irq_handler)() = (void (**)())0x38;
    *irq_handler = &irq_enter;

    initialize_cache();
    initialize_memory();
    initialize_fine_timer();
    initialize_scheduling();
    initialize_tasks();
    initialize_messaging();
    initialize_events();
    initialize_waiting();
}
Beispiel #5
0
boolean read_event_definitions (char *filename)
{
    char tmpbuf [128];

    initialize_events();

    s_elog_hfp = fopen (filename, "rt");
    if (s_elog_hfp == NULL) {
        sprintf (tmpbuf, "Couldn't open %s\n", filename);
        infobox ("Open Failed", tmpbuf);
        return(FALSE);
    }
    /* Presume "elog.h".  Note fallthrough... */
    if (read_header_files()) {
        sort_event_definitions();
        create_point_selector();
        recompute_ps_vscrollbar();
        fclose(s_elog_hfp);
        view1_display_when_idle();
        remove_needed = TRUE;
        return(TRUE);
    }
    fclose(s_elog_hfp);

    s_hfp = fopen (filename, "rt");
    if (s_hfp == NULL) {
        sprintf (tmpbuf, "Couldn't open %s\n", filename);
        infobox ("Read Event Definition Failure", tmpbuf);
        return(FALSE);
    }

    read_header_file();

    /* Happens if the user feeds us the wrong file, for example */
    if (g_neventdefs == 0) {
        sprintf (tmpbuf, "No event definitions found in %s\n", filename);
        infobox ("No Event Definitions?", tmpbuf);
        return(FALSE);
    }
    finalize_events();
    return(TRUE);
}