| | 2421 | | trc_read_trace_event( ID, eof ) |
| | 2422 | | TRC_ID ID; |
| | 2423 | | int *eof; |
| | 2424 | | { |
| | 2425 | | TRC_TEVDESC TD; |
| | 2426 | | |
| | 2427 | | char tmp[4096]; |
| | 2428 | | char c; |
| | 2429 | | |
| | 2430 | | int entry_exit; |
| | 2431 | | int dummy; |
| | 2432 | | int index; |
| | 2433 | | int code; |
| | 2434 | | int flag; |
| | 2435 | | int eid; |
| | 2436 | | int ee; |
| | 2437 | | int i; |
| | 2438 | | |
| | 2439 | | *eof = TRC_FALSE;
|
| | 2440 | | |
| | 2441 | | if ( ID->trace_in == NULL )
|
| | 2442 | | return( TRC_FALSE );
|
| | 2443 | | |
| | 2444 | | while ( TRC_TRUE )
|
| | 2445 | | { |
| | 2446 | | c = getc( ID->trace_in ); |
| | 2447 | | |
| | 2448 | | if ( c != (char) EOF )
|
| | 2449 | | { |
| | 2450 | | switch ( c ) |
| | 2451 | | { |
| | 2452 | | |
| | 2453 | | |
| | 2454 | | case '#': |
| | 2455 | | { |
| | 2456 | | |
| | 2457 | | |
| | 2458 | | flag = fscanf( ID->trace_in, "%d", &code ); |
| | 2459 | | |
| | 2460 | | if ( flag != 1 ) |
| | 2461 | | { |
| | 2462 | | printf( "Error Reading Event ID\n" ); |
| | 2463 | | |
| | 2464 | | return( TRC_FALSE );
|
| | 2465 | | } |
| | 2466 | | |
| | 2467 | | |
| | 2468 | | |
| | 2469 | | if ( !trc_find_event_str( ID, "\"" ) ) |
| | 2470 | | return( TRC_FALSE );
|
| | 2471 | | |
| $input_304884 > 4096 | 2472 | | i = 0; |
| | 2473 | | |
| | 2474 | | while ( (c = getc( ID->trace_in )) != (char) EOF
|
| | 2475 | | && c != '"' && c != '(' ) |
| | 2476 | | { |
| | 2477 | | tmp[i++] = c; |
| | 2478 | | } |
| | 2479 | | |
| | 2480 | | TRC_CKEOF( c, "EOF Reading Event Descriptor Name\n",
|
| | 2481 | | return( TRC_FALSE ) ); |
| | 2482 | | |
| i > 4096 | 2483 | | tmp[i] = '\0'; |
| | 2484 | | |
| | 2485 | | |
| | 2486 | | |
| | 2487 | | if ( c == '(' ) |
| | 2488 | | { |
| | 2489 | | |
| | 2490 | | |
| | 2491 | | index = ( code / 1000 ) - 1; |
| | 2492 | | |
| | 2493 | | eid = ( code - ((index + 1) * 1000) ) / 2; |
| | 2494 | | |
| | 2495 | | ee = code - ((index + 1) * 1000) - (2 * eid); |
| | 2496 | | |
| | 2497 | | |
| | 2498 | | |
| | 2499 | | flag = fscanf( ID->trace_in, "%d", &dummy ); |
| | 2500 | | |
| | 2501 | | if ( flag != 1 ) |
| | 2502 | | { |
| | 2503 | | printf( "Error Reading Event Index\n" ); |
| | 2504 | | |
| | 2505 | | return( TRC_FALSE );
|
| | 2506 | | } |
| | 2507 | | |
| | 2508 | | |
| | 2509 | | |
| | 2510 | | c = getc( ID->trace_in ); |
| | 2511 | | |
| | 2512 | | TRC_CKEOF( c, "EOF Reading Event Descriptor\n",
|
| | 2513 | | return( TRC_FALSE ) ); |
| | 2514 | | |
| | 2515 | | if ( c == '.' ) |
| | 2516 | | { |
| | 2517 | | if ( ee != dummy ) |
| | 2518 | | { |
| | 2519 | | printf( "Warning: " ); |
| | 2520 | | printf( "Entry/Exit Mismatch " ); |
| | 2521 | | printf( "%d != %d\n", ee, dummy ); |
| | 2522 | | } |
| | 2523 | | |
| | 2524 | | entry_exit = TRC_IGNORE_TEV;
|
| | 2525 | | |
| | 2526 | | if ( dummy == 0 ) |
| | 2527 | | entry_exit = TRC_ENTRY_TEV;
|
| | 2528 | | |
| | 2529 | | else if ( dummy == 1 ) |
| | 2530 | | entry_exit = TRC_EXIT_TEV;
|
| | 2531 | | |
| | 2532 | | flag = fscanf( ID->trace_in, "%d", &dummy ); |
| | 2533 | | |
| | 2534 | | if ( flag != 1 ) |
| | 2535 | | { |
| | 2536 | | printf( "Error Reading Event Index\n" ); |
| | 2537 | | |
| | 2538 | | return( TRC_FALSE );
|
| | 2539 | | } |
| | 2540 | | |
| | 2541 | | if ( index != dummy ) |
| | 2542 | | { |
| | 2543 | | printf( "Warning: " ); |
| | 2544 | | printf( "Descriptor Index Mismatch " ); |
| | 2545 | | printf( "%d != %d\n", index, dummy ); |
| | 2546 | | |
| | 2547 | | index = dummy; |
| | 2548 | | } |
| | 2549 | | |
| | 2550 | | if ( !trc_find_event_str( ID, ")" ) ) |
| | 2551 | | return( TRC_FALSE );
|
| | 2552 | | } |
| | 2553 | | |
| | 2554 | | else |
| | 2555 | | { |
| | 2556 | | entry_exit = TRC_IGNORE_TEV;
|
| | 2557 | | |
| | 2558 | | if ( ee == 1 ) |
| | 2559 | | { |
| | 2560 | | printf( "Warning: " ); |
| | 2561 | | printf( "Entry/Exit Mismatch " ); |
| | 2562 | | printf( "%d != %d\n", ee, entry_exit ); |
| | 2563 | | } |
| | 2564 | | |
| | 2565 | | if ( index != dummy ) |
| | 2566 | | { |
| | 2567 | | printf( "Warning: " ); |
| | 2568 | | printf( "Descriptor Index Mismatch " ); |
| | 2569 | | printf( "%d != %d\n", index, dummy ); |
| | 2570 | | |
| | 2571 | | index = dummy; |
| | 2572 | | } |
| | 2573 | | } |
| | 2574 | | |
| strlen(&tmp[0]) > 4096 | 2575 | | if ( !trc_find_event_str( ID, "\"" ) ) |
| | 2576 | | return( TRC_FALSE );
|
| | 2577 | | |
| strlen($param_3) > bytes_after($param_3) | 2578 | | if ( !(TD = trc_read_descriptor( | Problem | | strlen($param_3) > bytes_after($param_3) |
|