Patchwork tracetool.py: always pass --binary, --target-arch, --target-type

login
register
mail settings
Submitter Alon Levy
Date March 27, 2012, 4:37 p.m.
Message ID <1332866260-28387-1-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/148994/
State New
Headers show

Comments

Alon Levy - March 27, 2012, 4:37 p.m.
Signed-off-by: Alon Levy <alevy@redhat.com>
---
 Makefile.objs |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
Lluís Vilanova - March 27, 2012, 6:01 p.m.
Alon Levy writes:

> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
>  Makefile.objs |   25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)

> diff --git a/Makefile.objs b/Makefile.objs
> index 8e56f48..0e33f4b 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -373,12 +373,25 @@ else
>  trace.h: trace.h-timestamp
>  endif
>  trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=h --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.h")
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
> +		--format=h	\
> +		--backend=$(TRACE_BACKEND) \
> +		--binary=$(bindir)/$(QEMU_PROG) \
> +		--target-arch=$(TARGET_ARCH) \
> +		--target-type=$(TARGET_TYPE) \
> +		--target-type=$(TARGET_TYPE) < $< > $@, \
> +	"  GEN   trace.h")
>  	@cmp -s $@ trace.h || cp $@ trace.h
 
>  trace.c: trace.c-timestamp
>  trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=c --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.c")
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
> +		--format=c \
> +		--backend=$(TRACE_BACKEND) \
> +		--binary=$(bindir)/$(QEMU_PROG) \
> +		--target-arch=$(TARGET_ARCH) \
> +		--target-type=$(TARGET_TYPE) < $< > $@, \
> +	"  GEN   trace.c")
>  	@cmp -s $@ trace.c || cp $@ trace.c
 
>  trace.o: trace.c $(GENERATED_HEADERS)
> @@ -391,7 +404,13 @@ trace-dtrace.h: trace-dtrace.dtrace
>  # rule file. So we use '.dtrace' instead
>  trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
>  trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=d --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace-dtrace.dtrace")
> +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
> +		--format=d \
> +		--backend=$(TRACE_BACKEND) \
> +		--binary=$(bindir)/$(QEMU_PROG) \
> +		--target-arch=$(TARGET_ARCH) \
> +		--target-type=$(TARGET_TYPE) < $< > $@, \
> +	"  GEN   trace-dtrace.dtrace")
>  	@cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
 
>  trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
> -- 
> 1.7.9.3

I don't see the reason for such a change, as in the current bash code it's not
used except when generating files in the 'stap' format.

Same applies to your change in tracetool.py when checking the binary/probe/etc
options.


Lluis
Alon Levy - March 28, 2012, 9:35 a.m.
On Tue, Mar 27, 2012 at 08:01:54PM +0200, Lluís Vilanova wrote:
> Alon Levy writes:
> 
> > Signed-off-by: Alon Levy <alevy@redhat.com>
> > ---
> >  Makefile.objs |   25 ++++++++++++++++++++++---
> >  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> > diff --git a/Makefile.objs b/Makefile.objs
> > index 8e56f48..0e33f4b 100644
> > --- a/Makefile.objs
> > +++ b/Makefile.objs
> > @@ -373,12 +373,25 @@ else
> >  trace.h: trace.h-timestamp
> >  endif
> >  trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> > -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=h --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.h")
> > +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
> > +		--format=h	\
> > +		--backend=$(TRACE_BACKEND) \
> > +		--binary=$(bindir)/$(QEMU_PROG) \
> > +		--target-arch=$(TARGET_ARCH) \
> > +		--target-type=$(TARGET_TYPE) \
> > +		--target-type=$(TARGET_TYPE) < $< > $@, \
> > +	"  GEN   trace.h")
> >  	@cmp -s $@ trace.h || cp $@ trace.h
>  
> >  trace.c: trace.c-timestamp
> >  trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> > -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=c --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.c")
> > +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
> > +		--format=c \
> > +		--backend=$(TRACE_BACKEND) \
> > +		--binary=$(bindir)/$(QEMU_PROG) \
> > +		--target-arch=$(TARGET_ARCH) \
> > +		--target-type=$(TARGET_TYPE) < $< > $@, \
> > +	"  GEN   trace.c")
> >  	@cmp -s $@ trace.c || cp $@ trace.c
>  
> >  trace.o: trace.c $(GENERATED_HEADERS)
> > @@ -391,7 +404,13 @@ trace-dtrace.h: trace-dtrace.dtrace
> >  # rule file. So we use '.dtrace' instead
> >  trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
> >  trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
> > -	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=d --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace-dtrace.dtrace")
> > +	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
> > +		--format=d \
> > +		--backend=$(TRACE_BACKEND) \
> > +		--binary=$(bindir)/$(QEMU_PROG) \
> > +		--target-arch=$(TARGET_ARCH) \
> > +		--target-type=$(TARGET_TYPE) < $< > $@, \
> > +	"  GEN   trace-dtrace.dtrace")
> >  	@cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
>  
> >  trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
> > -- 
> > 1.7.9.3
> 
> I don't see the reason for such a change, as in the current bash code it's not
> used except when generating files in the 'stap' format.

Have you tried building with trace backend dtrace? without those changed
it breaks because tracetool.py requires both target_arch and target_type
for dtrace backend. Either change the source or change the invocation. I
thought the later is better, hence this patch.

> 
> Same applies to your change in tracetool.py when checking the binary/probe/etc
> options.
> 
> 
> Lluis
> 
> -- 
>  "And it's much the same thing with knowledge, for whenever you learn
>  something new, the whole world becomes that much richer."
>  -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
>  Tollbooth
Lluís Vilanova - March 28, 2012, 10:29 a.m.
Alon Levy writes:
[...]
>> I don't see the reason for such a change, as in the current bash code it's not
>> used except when generating files in the 'stap' format.

> Have you tried building with trace backend dtrace? without those changed
> it breaks because tracetool.py requires both target_arch and target_type
> for dtrace backend. Either change the source or change the invocation. I
> thought the later is better, hence this patch.

If you're referring to your changes in tracetool.py related to this (when
checking binary/prefix/etc), it should be fixed in v3 without resorting to your
changes:

    -     if format == "stap":
    +     if arg_format == "stap":

Instead of your proposal:

    -     if format == "stap":
    +     if arg_backend == "dtrace":

I didn't try to compile the resulting dtrace files (they should be the same),
but tracetool does not fail with the aforementioned changes.


Thanks,
   Lluis

Patch

diff --git a/Makefile.objs b/Makefile.objs
index 8e56f48..0e33f4b 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -373,12 +373,25 @@  else
 trace.h: trace.h-timestamp
 endif
 trace.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=h --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.h")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
+		--format=h	\
+		--backend=$(TRACE_BACKEND) \
+		--binary=$(bindir)/$(QEMU_PROG) \
+		--target-arch=$(TARGET_ARCH) \
+		--target-type=$(TARGET_TYPE) \
+		--target-type=$(TARGET_TYPE) < $< > $@, \
+	"  GEN   trace.h")
 	@cmp -s $@ trace.h || cp $@ trace.h
 
 trace.c: trace.c-timestamp
 trace.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=c --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace.c")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
+		--format=c \
+		--backend=$(TRACE_BACKEND) \
+		--binary=$(bindir)/$(QEMU_PROG) \
+		--target-arch=$(TARGET_ARCH) \
+		--target-type=$(TARGET_TYPE) < $< > $@, \
+	"  GEN   trace.c")
 	@cmp -s $@ trace.c || cp $@ trace.c
 
 trace.o: trace.c $(GENERATED_HEADERS)
@@ -391,7 +404,13 @@  trace-dtrace.h: trace-dtrace.dtrace
 # rule file. So we use '.dtrace' instead
 trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
 trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
-	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py --format=d --backend=$(TRACE_BACKEND) < $< > $@,"  GEN   trace-dtrace.dtrace")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/tracetool.py \
+		--format=d \
+		--backend=$(TRACE_BACKEND) \
+		--binary=$(bindir)/$(QEMU_PROG) \
+		--target-arch=$(TARGET_ARCH) \
+		--target-type=$(TARGET_TYPE) < $< > $@, \
+	"  GEN   trace-dtrace.dtrace")
 	@cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
 
 trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)