Revision 2834c3e0

b/Makefile.target
40 40
config-target.h: config-target.h-timestamp
41 41
config-target.h-timestamp: config-target.mak
42 42

  
43
all: $(PROGS)
43
ifdef CONFIG_SYSTEMTAP_TRACE
44
trace: $(QEMU_PROG).stp
45

  
46
$(QEMU_PROG).stp:
47
	$(call quiet-command,sh $(SRC_PATH)/tracetool \
48
		--$(TRACE_BACKEND) \
49
		--bindir $(bindir) \
50
		--target $(TARGET_ARCH) \
51
		-s < $(SRC_PATH)/trace-events > $(QEMU_PROG).stp,"  GEN   $(QEMU_PROG).stp")
52
else
53
trace:
54
endif
55

  
56
all: $(PROGS) trace
44 57

  
45 58
# Dummy command so that make thinks it has done something
46 59
	@true
......
348 361
	$(STRIP) $(patsubst %,"$(DESTDIR)$(bindir)/%",$(PROGS))
349 362
endif
350 363
endif
364
ifdef CONFIG_SYSTEMTAP_TRACE
365
	$(INSTALL_DIR) "$(DESTDIR)$(datadir)/../systemtap/tapset"
366
	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(datadir)/../systemtap/tapset"
367
endif
351 368

  
352 369
# Include automatically generated dependency files
353 370
-include $(wildcard *.d */*.d)
b/configure
2192 2192
    echo
2193 2193
    exit 1
2194 2194
  fi
2195
  trace_backend_stap="no"
2196
  if has 'stap' ; then
2197
    trace_backend_stap="yes"
2198
  fi
2195 2199
fi
2196 2200

  
2197 2201
##########################################
......
2645 2649
if test "$trace_backend" = "simple"; then
2646 2650
  trace_file="\"$trace_file-%u\""
2647 2651
fi
2652
if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
2653
  echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak
2654
fi
2648 2655
echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
2649 2656

  
2650 2657
echo "TOOLS=$tools" >> $config_host_mak
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