Revision 2834c3e0 tracetool

b/tracetool
26 26
  -h    Generate .h file
27 27
  -c    Generate .c file
28 28
  -d    Generate .d file (DTrace only)
29
  -s    Generate .stp file (DTrace with SystemTAP only)
30

  
31
Options:
32
  --bindir [bindir]  QEMU binary install location
33
  --target [arch]    QEMU target architecture
34

  
29 35
EOF
30 36
    exit 1
31 37
}
......
390 396
EOF
391 397
}
392 398

  
399
linetos_begin_dtrace()
400
{
401
    return
402
}
403

  
404
linetos_dtrace()
405
{
406
    local name args arglist state
407
    name=$(get_name "$1")
408
    args=$(get_args "$1")
409
    arglist=$(get_argnames "$1", "")
410
    state=$(get_state "$1")
411
    if [ "$state" = "0" ] ; then
412
        name=${name##disable }
413
    fi
414

  
415
    if [ "$target" = "i386" ]
416
    then
417
      binary="qemu"
418
    else
419
      binary="qemu-system-$target"
420
    fi
421

  
422
    # Define prototype for probe arguments
423
    cat <<EOF
424
probe qemu.system.$target.$name = process("$bindir/$binary").mark("$name")
425
{
426
EOF
427

  
428
    i=1
429
    for arg in $arglist
430
    do
431
        cat <<EOF
432
  $arg = \$arg$i;
433
EOF
434
	i="$((i+1))"
435
    done
436

  
437
    cat <<EOF
438
}
439
EOF
440
}
441

  
442
linetos_end_dtrace()
443
{
444
    return
445
}
446

  
393 447
# Process stdin by calling begin, line, and end functions for the backend
394 448
convert()
395 449
{
......
455 509
    convert d
456 510
}
457 511

  
512
tracetos()
513
{
514
    if [ $backend != "dtrace" ]; then
515
       echo "SystemTAP tapset generator not applicable to $backend backend"
516
       exit 1
517
    fi
518
    if [ -z "$target" ]; then
519
       echo "--target is required for SystemTAP tapset generator"
520
       exit 1
521
    fi
522
    if [ -z "$bindir" ]; then
523
       echo "--bindir is required for SystemTAP tapset generator"
524
       exit 1
525
    fi
526
    echo "/* This file is autogenerated by tracetool, do not edit. */"
527
    convert s
528
}
529

  
458 530
# Choose backend
459 531
case "$1" in
460 532
"--nop" | "--simple" | "--ust" | "--dtrace") backend="${1#--}" ;;
......
462 534
esac
463 535
shift
464 536

  
537
bindir=
538
case "$1" in
539
  "--bindir")
540
    bindir=$2
541
    shift
542
    shift
543
    ;;
544
esac
545

  
546
target=
547
case "$1" in
548
  "--target")
549
    target=$2
550
    shift
551
    shift
552
    ;;
553
esac
554

  
555

  
465 556
case "$1" in
466 557
"-h") tracetoh ;;
467 558
"-c") tracetoc ;;
468 559
"-d") tracetod ;;
560
"-s") tracetos ;;
469 561
"--check-backend") exit 0 ;; # used by ./configure to test for backend
470 562
*) usage ;;
471 563
esac

Also available in: Unified diff