qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

trace: pass trace-events to tracetool as a positional param

Instead of reading the contents of 'trace-events' from stdin,
accept the filename as a positional parameter. This also
allows for reading from multiple files, though this facility
is not used at this time.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 1475588159-30598-20-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

authored by

Daniel P. Berrange and committed by
Stefan Hajnoczi
0bc6484d 9096b78a

+16 -13
+3 -3
Makefile.target
··· 55 55 --binary=$(bindir)/$(QEMU_PROG) \ 56 56 --target-name=$(TARGET_NAME) \ 57 57 --target-type=$(TARGET_TYPE) \ 58 - < $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed") 58 + $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed") 59 59 60 60 $(QEMU_PROG).stp: $(BUILD_DIR)/trace-events-all 61 61 $(call quiet-command,$(TRACETOOL) \ ··· 64 64 --binary=$(realpath .)/$(QEMU_PROG) \ 65 65 --target-name=$(TARGET_NAME) \ 66 66 --target-type=$(TARGET_TYPE) \ 67 - < $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp") 67 + $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp") 68 68 69 69 $(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace-events-all 70 70 $(call quiet-command,$(TRACETOOL) \ 71 71 --format=simpletrace-stap \ 72 72 --backends=$(TRACE_BACKENDS) \ 73 73 --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \ 74 - < $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp") 74 + $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp") 75 75 76 76 else 77 77 stap:
+4 -1
scripts/tracetool.py
··· 129 129 if probe_prefix is None: 130 130 probe_prefix = ".".join(["qemu", target_type, target_name]) 131 131 132 - events = tracetool.read_events(sys.stdin) 132 + if len(args) != 1: 133 + error_opt("missing trace-events filepath") 134 + with open(args[0], "r") as fh: 135 + events = tracetool.read_events(fh) 133 136 134 137 try: 135 138 tracetool.generate(events, arg_format, arg_backends,
+9 -9
trace/Makefile.objs
··· 22 22 $(call quiet-command,$(TRACETOOL) \ 23 23 --format=ust-events-h \ 24 24 --backends=$(TRACE_BACKENDS) \ 25 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 25 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 26 26 27 27 $(obj)/generated-ust.c: $(obj)/generated-ust.c-timestamp $(BUILD_DIR)/config-host.mak 28 28 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ ··· 30 30 $(call quiet-command,$(TRACETOOL) \ 31 31 --format=ust-events-c \ 32 32 --backends=$(TRACE_BACKENDS) \ 33 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 33 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 34 34 35 35 $(obj)/generated-tracers.h: $(obj)/generated-ust-provider.h 36 36 $(obj)/generated-tracers.c: $(obj)/generated-ust.c ··· 50 50 $(call quiet-command,$(TRACETOOL) \ 51 51 --format=h \ 52 52 --backends=$(TRACE_BACKENDS) \ 53 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 53 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 54 54 55 55 ############################## 56 56 # non-DTrace ··· 61 61 $(call quiet-command,$(TRACETOOL) \ 62 62 --format=c \ 63 63 --backends=$(TRACE_BACKENDS) \ 64 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 64 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 65 65 66 66 $(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h 67 67 ··· 79 79 $(call quiet-command,$(TRACETOOL) \ 80 80 --format=d \ 81 81 --backends=$(TRACE_BACKENDS) \ 82 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 82 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 83 83 84 84 $(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers-dtrace.dtrace 85 85 $(call quiet-command,dtrace -o $@ -h -s $<,"GEN","$@") ··· 98 98 $(call quiet-command,$(TRACETOOL) \ 99 99 --format=tcg-helper-wrapper-h \ 100 100 --backend=$(TRACE_BACKENDS) \ 101 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 101 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 102 102 103 103 $(obj)/generated-helpers.h: $(obj)/generated-helpers.h-timestamp 104 104 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ ··· 106 106 $(call quiet-command,$(TRACETOOL) \ 107 107 --format=tcg-helper-h \ 108 108 --backend=$(TRACE_BACKENDS) \ 109 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 109 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 110 110 111 111 $(obj)/generated-helpers.c: $(obj)/generated-helpers.c-timestamp 112 112 @cmp $< $@ >/dev/null 2>&1 || cp $< $@ ··· 114 114 $(call quiet-command,$(TRACETOOL) \ 115 115 --format=tcg-helper-c \ 116 116 --backend=$(TRACE_BACKENDS) \ 117 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 117 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 118 118 119 119 $(obj)/generated-helpers.o: $(obj)/generated-helpers.c 120 120 ··· 127 127 $(call quiet-command,$(TRACETOOL) \ 128 128 --format=tcg-h \ 129 129 --backend=$(TRACE_BACKENDS) \ 130 - < $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 130 + $< > $@,"GEN","$(patsubst %-timestamp,%,$@)") 131 131 132 132 133 133 ######################################################################