qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 113/132] systemtap


From: Paolo Bonzini
Subject: [PATCH 113/132] systemtap
Date: Thu, 19 Dec 2019 13:23:33 +0100

From: Marc-André Lureau <address@hidden>

Signed-off-by: Marc-André Lureau <address@hidden>
---
 Makefile.target   | 84 ++-----------------------------------------------------
 meson.build       | 26 +++++++++++++++++
 trace/meson.build | 14 +++++-----
 3 files changed, 35 insertions(+), 89 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 8ee4c78..4f72a89 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -6,88 +6,8 @@ include ../config-host.mak
 include config-target.mak
 include $(SRC_PATH)/rules.mak
 
-$(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
-
-ifdef CONFIG_USER_ONLY
-# user emulator name
-QEMU_PROG=qemu-$(TARGET_NAME)
-else
-# system emulator name
-QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF)
-endif
-
-STPFILES=
-
-ifdef CONFIG_TRACE_SYSTEMTAP
-stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp 
$(QEMU_PROG)-log.stp
-
-ifdef CONFIG_USER_ONLY
-TARGET_TYPE=user
-else
-TARGET_TYPE=system
-endif
-
-tracetool-y = $(SRC_PATH)/scripts/tracetool.py
-tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
-
-$(QEMU_PROG).stp-installed: $(BUILD_DIR)/trace/trace-events-all $(tracetool-y)
-       $(call quiet-command,$(TRACETOOL) \
-               --group=all \
-               --format=stap \
-               --backends=$(TRACE_BACKENDS) \
-               --binary=$(bindir)/$(QEMU_PROG) \
-               --target-name=$(TARGET_NAME) \
-               --target-type=$(TARGET_TYPE) \
-               $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp-installed")
-
-$(QEMU_PROG).stp: $(BUILD_DIR)/trace/trace-events-all $(tracetool-y)
-       $(call quiet-command,$(TRACETOOL) \
-               --group=all \
-               --format=stap \
-               --backends=$(TRACE_BACKENDS) \
-               --binary=$(realpath .)/$(QEMU_PROG) \
-               --target-name=$(TARGET_NAME) \
-               --target-type=$(TARGET_TYPE) \
-               $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG).stp")
-
-$(QEMU_PROG)-simpletrace.stp: $(BUILD_DIR)/trace/trace-events-all 
$(tracetool-y)
-       $(call quiet-command,$(TRACETOOL) \
-               --group=all \
-               --format=simpletrace-stap \
-               --backends=$(TRACE_BACKENDS) \
-               --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
-               $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-simpletrace.stp")
-
-$(QEMU_PROG)-log.stp: $(BUILD_DIR)/trace/trace-events-all $(tracetool-y)
-       $(call quiet-command,$(TRACETOOL) \
-               --group=all \
-               --format=log-stap \
-               --backends=$(TRACE_BACKENDS) \
-               --probe-prefix=qemu.$(TARGET_TYPE).$(TARGET_NAME) \
-               $< > $@,"GEN","$(TARGET_DIR)$(QEMU_PROG)-log.stp")
-
-else
-stap:
-endif
-.PHONY: stap
-
-all: stap
-
+all:
 clean:
-       rm -f *.a *~
-       rm -f $(shell find . -name '*.[od]')
-       rm -f hmp-commands.h gdbstub-xml.c
-       rm -f trace/generated-helpers.c trace/generated-helpers.c-timestamp
-ifdef CONFIG_TRACE_SYSTEMTAP
-       rm -f *.stp
-endif
-
 install: all
-ifdef CONFIG_TRACE_SYSTEMTAP
-       $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
-       $(INSTALL_DATA) $(QEMU_PROG).stp-installed 
"$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
-       $(INSTALL_DATA) $(QEMU_PROG)-simpletrace.stp 
"$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-simpletrace.stp"
-       $(INSTALL_DATA) $(QEMU_PROG)-log.stp 
"$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG)-log.stp"
-endif
-
+       
 .PHONY: all clean install
diff --git a/meson.build b/meson.build
index ab53b62..4fb3bdc 100644
--- a/meson.build
+++ b/meson.build
@@ -749,6 +749,7 @@ common_all = static_library('common',
                             name_suffix: 'fa')
 
 feature_to_c = find_program('scripts/feature_to_c.sh')
+tracetool = find_program('scripts/tracetool.py')
 
 foreach target : target_dirs
   config_target = target_config[target]
@@ -850,6 +851,31 @@ foreach target : target_dirs
                c_args: ['-DNEED_CPU_H',
                         '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
                         
'-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)])
+
+    if 'CONFIG_TRACE_SYSTEMTAP' in config_host
+      foreach stp: [
+        {'ext': '.stp-build', 'fmt': 'stap', 'bin': meson.current_build_dir() 
/ exe_name, 'install': false},
+        {'ext': '.stp', 'fmt': 'stap', 'bin': get_option('prefix') / 
get_option('bindir') / exe_name, 'install': true},
+        {'ext': '-simpletrace.stp', 'fmt': 'simpletrace-stap', 'bin': '', 
'install': true},
+        {'ext': '-log.stp', 'fmt': 'log-stap', 'bin': '', 'install': true},
+      ]
+        custom_target(exe_name + stp['ext'],
+                      input: trace_events_all,
+                      output: exe_name + stp['ext'],
+                      capture: true,
+                      install: stp['install'],
+                      install_dir: config_host['qemu_datadir'] / 
'../systemtap/tapset',
+                      command: [
+                        tracetool, '--group=all', '--format=' + stp['fmt'],
+                        '--backends=' + config_host['TRACE_BACKENDS'],
+                        '--binary=' + stp['bin'],
+                        '--target-name=' + target_name,
+                        '--target-type=' + target_type,
+                        '--probe-prefix=qemu.' + target_type + '.' + 
target_name,
+                        '@INPUT@',
+                      ])
+      endforeach
+    endif
   endforeach
 endforeach
 
diff --git a/trace/meson.build b/trace/meson.build
index b113425..eb28aff 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -55,13 +55,13 @@ foreach dir : [ '.' ] + trace_events_subdirs
   endif
 endforeach
 
-custom_target('trace-events-all',
-              output: 'trace-events-all',
-              input: trace_events_files,
-              command: [ 'cat', '@INPUT@' ],
-              capture: true,
-              install: true,
-              install_dir: config_host['qemu_datadir'])
+trace_events_all = custom_target('trace-events-all',
+                                 output: 'trace-events-all',
+                                 input: trace_events_files,
+                                 command: [ 'cat', '@INPUT@' ],
+                                 capture: true,
+                                 install: true,
+                                 install_dir: config_host['qemu_datadir'])
 
 foreach d : [
   ['generated-tcg-tracers.h', 'tcg-h'],
-- 
1.8.3.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]