Patchwork Add a stp file for usage from build directory

login
register
mail settings
Submitter Alon Levy
Date May 28, 2013, 5:44 p.m.
Message ID <1369763069-13689-1-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/246925/
State New
Headers show

Comments

Alon Levy - May 28, 2013, 5:44 p.m.
For systemtap the location of the process being tapped is crucial, as a
result the existing stp file requires installation for use.

There are now two files:
$(TARGET_DIR)/$(QEMU_PROG).stp-installed: copied to $(tapdir)/$(QEMU_PROG).stp
$(TARGET_DIR)/$(QEMU_PROG).stp: usable locally

To use:
stap -I $(TARGET_DIR) ..

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 Makefile.target | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
Paolo Bonzini - May 28, 2013, 5:45 p.m.
Il 28/05/2013 19:44, Alon Levy ha scritto:
> For systemtap the location of the process being tapped is crucial, as a
> result the existing stp file requires installation for use.
> 
> There are now two files:
> $(TARGET_DIR)/$(QEMU_PROG).stp-installed: copied to $(tapdir)/$(QEMU_PROG).stp
> $(TARGET_DIR)/$(QEMU_PROG).stp: usable locally

The actual name of the file is $(TARGET_DIR)/$(QEMU_PROG).local.stp.

I think I prefer the one in the commit message, but anyway please respin
to make it consistent.

Paolo

> To use:
> stap -I $(TARGET_DIR) ..
> 
> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
>  Makefile.target | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile.target b/Makefile.target
> index ce4391f..54687e2 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -35,7 +35,7 @@ config-target.h: config-target.h-timestamp
>  config-target.h-timestamp: config-target.mak
>  
>  ifdef CONFIG_TRACE_SYSTEMTAP
> -stap: $(QEMU_PROG).stp
> +stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).local.stp
>  
>  ifdef CONFIG_USER_ONLY
>  TARGET_TYPE=user
> @@ -43,14 +43,24 @@ else
>  TARGET_TYPE=system
>  endif
>  
> -$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
> +$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
>  	$(call quiet-command,$(TRACETOOL) \
>  		--format=stap \
>  		--backend=$(TRACE_BACKEND) \
>  		--binary=$(bindir)/$(QEMU_PROG) \
>  		--target-arch=$(TARGET_ARCH) \
>  		--target-type=$(TARGET_TYPE) \
> -		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
> +		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")
> +
> +$(QEMU_PROG).local.stp: $(SRC_PATH)/trace-events
> +	$(call quiet-command,$(TRACETOOL) \
> +		--format=stap \
> +		--backend=$(TRACE_BACKEND) \
> +		--binary=$(realpath .)/$(QEMU_PROG) \
> +		--target-arch=$(TARGET_ARCH) \
> +		--target-type=$(TARGET_TYPE) \
> +		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).local.stp")
> +
>  else
>  stap:
>  endif
> @@ -186,7 +196,7 @@ endif
>  endif
>  ifdef CONFIG_TRACE_SYSTEMTAP
>  	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
> -	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
> +	$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
>  endif
>  
>  GENERATED_HEADERS += config-target.h
>

Patch

diff --git a/Makefile.target b/Makefile.target
index ce4391f..54687e2 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -35,7 +35,7 @@  config-target.h: config-target.h-timestamp
 config-target.h-timestamp: config-target.mak
 
 ifdef CONFIG_TRACE_SYSTEMTAP
-stap: $(QEMU_PROG).stp
+stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).local.stp
 
 ifdef CONFIG_USER_ONLY
 TARGET_TYPE=user
@@ -43,14 +43,24 @@  else
 TARGET_TYPE=system
 endif
 
-$(QEMU_PROG).stp: $(SRC_PATH)/trace-events
+$(QEMU_PROG).stp-installed: $(SRC_PATH)/trace-events
 	$(call quiet-command,$(TRACETOOL) \
 		--format=stap \
 		--backend=$(TRACE_BACKEND) \
 		--binary=$(bindir)/$(QEMU_PROG) \
 		--target-arch=$(TARGET_ARCH) \
 		--target-type=$(TARGET_TYPE) \
-		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp")
+		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).stp-installed")
+
+$(QEMU_PROG).local.stp: $(SRC_PATH)/trace-events
+	$(call quiet-command,$(TRACETOOL) \
+		--format=stap \
+		--backend=$(TRACE_BACKEND) \
+		--binary=$(realpath .)/$(QEMU_PROG) \
+		--target-arch=$(TARGET_ARCH) \
+		--target-type=$(TARGET_TYPE) \
+		< $< > $@,"  GEN   $(TARGET_DIR)$(QEMU_PROG).local.stp")
+
 else
 stap:
 endif
@@ -186,7 +196,7 @@  endif
 endif
 ifdef CONFIG_TRACE_SYSTEMTAP
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
-	$(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset"
+	$(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset/$(QEMU_PROG).stp"
 endif
 
 GENERATED_HEADERS += config-target.h