diff mbox

[ping,04/19] Use MODULE_NAME in stap-probe instead of IN_LIB

Message ID 20140917124715.GW6586@spoyarek.pnq.redhat.com
State New
Headers show

Commit Message

Siddhesh Poyarekar Sept. 17, 2014, 12:47 p.m. UTC
Rebased on top of latest master.  No changes to the patch.

Siddhesh

From b3ae47d0b34aa5d0366cf27cb944aa008e069186 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu, 21 Aug 2014 11:55:35 +0530
Subject: [PATCH] Use MODULE_NAME in stap-probe instead of IN_LIB

Verified that the generated code is unchanged on x86_64.

	* scripts/gen-libc-modules.awk (END): Generate defines for
	MODULE_NAME.
	* include/stap-probe.h (LIBC_PROBE_1): Use MODULE_NAME instead
	of IN_LIB.
	(STAP_PROBE_ASM): Likewise.
---
 include/stap-probe.h         | 6 +++---
 scripts/gen-libc-modules.awk | 9 ++++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Siddhesh Poyarekar Sept. 24, 2014, 9:06 a.m. UTC | #1
Ping!

On Wed, Sep 17, 2014 at 06:17:16PM +0530, Siddhesh Poyarekar wrote:
> Rebased on top of latest master.  No changes to the patch.
> 
> Siddhesh
> 
> From b3ae47d0b34aa5d0366cf27cb944aa008e069186 Mon Sep 17 00:00:00 2001
> From: Siddhesh Poyarekar <siddhesh@redhat.com>
> Date: Thu, 21 Aug 2014 11:55:35 +0530
> Subject: [PATCH] Use MODULE_NAME in stap-probe instead of IN_LIB
> 
> Verified that the generated code is unchanged on x86_64.
> 
> 	* scripts/gen-libc-modules.awk (END): Generate defines for
> 	MODULE_NAME.
> 	* include/stap-probe.h (LIBC_PROBE_1): Use MODULE_NAME instead
> 	of IN_LIB.
> 	(STAP_PROBE_ASM): Likewise.
> ---
>  include/stap-probe.h         | 6 +++---
>  scripts/gen-libc-modules.awk | 9 ++++++++-
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/include/stap-probe.h b/include/stap-probe.h
> index 688646c..150fc1e 100644
> --- a/include/stap-probe.h
> +++ b/include/stap-probe.h
> @@ -30,7 +30,7 @@
>  
>     Systemtap's header defines the macros STAP_PROBE (provider, name) and
>     STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
> -   in the IN_LIB name (libc, libpthread, etc.) automagically.
> +   in MODULE_NAME (libc, libpthread, etc.) automagically.
>  
>     The format of the arg parameters is discussed here:
>  
> @@ -53,7 +53,7 @@
>  # endif
>  
>  # define LIBC_PROBE(name, n, ...)	\
> -  LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__)
> +  LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__)
>  
>  # define LIBC_PROBE_1(lib, name, n, ...) \
>    STAP_PROBE##n (lib, name, ## __VA_ARGS__)
> @@ -61,7 +61,7 @@
>  # define STAP_PROBE0		STAP_PROBE
>  
>  # define LIBC_PROBE_ASM(name, template) \
> -  STAP_PROBE_ASM (IN_LIB, name, template)
> +  STAP_PROBE_ASM (MODULE_NAME, name, template)
>  
>  # define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
>  
> diff --git a/scripts/gen-libc-modules.awk b/scripts/gen-libc-modules.awk
> index d3382b6..1ae4af3 100644
> --- a/scripts/gen-libc-modules.awk
> +++ b/scripts/gen-libc-modules.awk
> @@ -32,9 +32,16 @@ match (FILENAME, ".*soversions.i") {
>  
>  # Finally, print out the header file.
>  END {
> -  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
> +  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n")
>    i = 1
> +  print ("\n/* Allowed values for IN_MODULE.  */")
>    for (l in libs) {
>      printf ("#define MODULE_%s %d\n", l, libs[l])
>    }
> +  print ("\n/* Module names, used in stap-probe.h */")
> +  for (l in libs) {
> +    printf ("#if IN_MODULE == MODULE_%s\n", l)
> +    printf ("# define MODULE_NAME %s\n", l)
> +    printf ("#endif\n")
> +  }
>  }
> -- 
> 1.9.3
>
Siddhesh Poyarekar Oct. 1, 2014, 8:19 a.m. UTC | #2
Rebased against current master and the patch is unchanged.

Ping!

Siddhesh

On Wed, Sep 17, 2014 at 06:17:16PM +0530, Siddhesh Poyarekar wrote:
> Rebased on top of latest master.  No changes to the patch.
> 
> Siddhesh
> 
> From b3ae47d0b34aa5d0366cf27cb944aa008e069186 Mon Sep 17 00:00:00 2001
> From: Siddhesh Poyarekar <siddhesh@redhat.com>
> Date: Thu, 21 Aug 2014 11:55:35 +0530
> Subject: [PATCH] Use MODULE_NAME in stap-probe instead of IN_LIB
> 
> Verified that the generated code is unchanged on x86_64.
> 
> 	* scripts/gen-libc-modules.awk (END): Generate defines for
> 	MODULE_NAME.
> 	* include/stap-probe.h (LIBC_PROBE_1): Use MODULE_NAME instead
> 	of IN_LIB.
> 	(STAP_PROBE_ASM): Likewise.
> ---
>  include/stap-probe.h         | 6 +++---
>  scripts/gen-libc-modules.awk | 9 ++++++++-
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/include/stap-probe.h b/include/stap-probe.h
> index 688646c..150fc1e 100644
> --- a/include/stap-probe.h
> +++ b/include/stap-probe.h
> @@ -30,7 +30,7 @@
>  
>     Systemtap's header defines the macros STAP_PROBE (provider, name) and
>     STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
> -   in the IN_LIB name (libc, libpthread, etc.) automagically.
> +   in MODULE_NAME (libc, libpthread, etc.) automagically.
>  
>     The format of the arg parameters is discussed here:
>  
> @@ -53,7 +53,7 @@
>  # endif
>  
>  # define LIBC_PROBE(name, n, ...)	\
> -  LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__)
> +  LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__)
>  
>  # define LIBC_PROBE_1(lib, name, n, ...) \
>    STAP_PROBE##n (lib, name, ## __VA_ARGS__)
> @@ -61,7 +61,7 @@
>  # define STAP_PROBE0		STAP_PROBE
>  
>  # define LIBC_PROBE_ASM(name, template) \
> -  STAP_PROBE_ASM (IN_LIB, name, template)
> +  STAP_PROBE_ASM (MODULE_NAME, name, template)
>  
>  # define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
>  
> diff --git a/scripts/gen-libc-modules.awk b/scripts/gen-libc-modules.awk
> index d3382b6..1ae4af3 100644
> --- a/scripts/gen-libc-modules.awk
> +++ b/scripts/gen-libc-modules.awk
> @@ -32,9 +32,16 @@ match (FILENAME, ".*soversions.i") {
>  
>  # Finally, print out the header file.
>  END {
> -  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
> +  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n")
>    i = 1
> +  print ("\n/* Allowed values for IN_MODULE.  */")
>    for (l in libs) {
>      printf ("#define MODULE_%s %d\n", l, libs[l])
>    }
> +  print ("\n/* Module names, used in stap-probe.h */")
> +  for (l in libs) {
> +    printf ("#if IN_MODULE == MODULE_%s\n", l)
> +    printf ("# define MODULE_NAME %s\n", l)
> +    printf ("#endif\n")
> +  }
>  }
> -- 
> 1.9.3
>
Siddhesh Poyarekar Oct. 14, 2014, 4:21 p.m. UTC | #3
Ping!

On Wed, Oct 01, 2014 at 01:49:40PM +0530, Siddhesh Poyarekar wrote:
> Rebased against current master and the patch is unchanged.
> 
> Ping!
> 
> Siddhesh
> 
> On Wed, Sep 17, 2014 at 06:17:16PM +0530, Siddhesh Poyarekar wrote:
> > Rebased on top of latest master.  No changes to the patch.
> > 
> > Siddhesh
> > 
> > From b3ae47d0b34aa5d0366cf27cb944aa008e069186 Mon Sep 17 00:00:00 2001
> > From: Siddhesh Poyarekar <siddhesh@redhat.com>
> > Date: Thu, 21 Aug 2014 11:55:35 +0530
> > Subject: [PATCH] Use MODULE_NAME in stap-probe instead of IN_LIB
> > 
> > Verified that the generated code is unchanged on x86_64.
> > 
> > 	* scripts/gen-libc-modules.awk (END): Generate defines for
> > 	MODULE_NAME.
> > 	* include/stap-probe.h (LIBC_PROBE_1): Use MODULE_NAME instead
> > 	of IN_LIB.
> > 	(STAP_PROBE_ASM): Likewise.
> > ---
> >  include/stap-probe.h         | 6 +++---
> >  scripts/gen-libc-modules.awk | 9 ++++++++-
> >  2 files changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/stap-probe.h b/include/stap-probe.h
> > index 688646c..150fc1e 100644
> > --- a/include/stap-probe.h
> > +++ b/include/stap-probe.h
> > @@ -30,7 +30,7 @@
> >  
> >     Systemtap's header defines the macros STAP_PROBE (provider, name) and
> >     STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
> > -   in the IN_LIB name (libc, libpthread, etc.) automagically.
> > +   in MODULE_NAME (libc, libpthread, etc.) automagically.
> >  
> >     The format of the arg parameters is discussed here:
> >  
> > @@ -53,7 +53,7 @@
> >  # endif
> >  
> >  # define LIBC_PROBE(name, n, ...)	\
> > -  LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__)
> > +  LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__)
> >  
> >  # define LIBC_PROBE_1(lib, name, n, ...) \
> >    STAP_PROBE##n (lib, name, ## __VA_ARGS__)
> > @@ -61,7 +61,7 @@
> >  # define STAP_PROBE0		STAP_PROBE
> >  
> >  # define LIBC_PROBE_ASM(name, template) \
> > -  STAP_PROBE_ASM (IN_LIB, name, template)
> > +  STAP_PROBE_ASM (MODULE_NAME, name, template)
> >  
> >  # define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
> >  
> > diff --git a/scripts/gen-libc-modules.awk b/scripts/gen-libc-modules.awk
> > index d3382b6..1ae4af3 100644
> > --- a/scripts/gen-libc-modules.awk
> > +++ b/scripts/gen-libc-modules.awk
> > @@ -32,9 +32,16 @@ match (FILENAME, ".*soversions.i") {
> >  
> >  # Finally, print out the header file.
> >  END {
> > -  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
> > +  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n")
> >    i = 1
> > +  print ("\n/* Allowed values for IN_MODULE.  */")
> >    for (l in libs) {
> >      printf ("#define MODULE_%s %d\n", l, libs[l])
> >    }
> > +  print ("\n/* Module names, used in stap-probe.h */")
> > +  for (l in libs) {
> > +    printf ("#if IN_MODULE == MODULE_%s\n", l)
> > +    printf ("# define MODULE_NAME %s\n", l)
> > +    printf ("#endif\n")
> > +  }
> >  }
> > -- 
> > 1.9.3
> > 
> 
>
Roland McGrath Nov. 7, 2014, 11:32 p.m. UTC | #4
> 	* scripts/gen-libc-modules.awk (END): Generate defines for
> 	MODULE_NAME.

Why is this better than just putting -DMODULE_NAME=... in CPPFLAGS
as with IN_MODULE?  In fact, you could pass only -DMODULE_NAME=...
and then use PASTE(MODULE_,MODULE_NAME).
Siddhesh Poyarekar Nov. 19, 2014, 7:09 a.m. UTC | #5
Sorry, I missed this one.

On Fri, Nov 07, 2014 at 03:32:06PM -0800, Roland McGrath wrote:
> > 	* scripts/gen-libc-modules.awk (END): Generate defines for
> > 	MODULE_NAME.
> 
> Why is this better than just putting -DMODULE_NAME=... in CPPFLAGS
> as with IN_MODULE?  In fact, you could pass only -DMODULE_NAME=...
> and then use PASTE(MODULE_,MODULE_NAME).

I don't think that is possible.  We cannot paste macro definitions.
That is, I cannot do:

#define MODULE_ ## libc 42

Siddhesh
Roland McGrath Nov. 19, 2014, 11:47 p.m. UTC | #6
> > Why is this better than just putting -DMODULE_NAME=... in CPPFLAGS
> > as with IN_MODULE?  In fact, you could pass only -DMODULE_NAME=...
> > and then use PASTE(MODULE_,MODULE_NAME).
> 
> I don't think that is possible.  We cannot paste macro definitions.
> That is, I cannot do:
> 
> #define MODULE_ ## libc 42

I'm not sure what you imagine I imagine that would do.  What I'm talking
about is -DMODULE_NAME=libc instead of -DIN_MODULE=MODULE_libc and:

#define IN_MODULE PASTE(MODULE_, MODULE_NAME)
#define PASTE(a, b) PASTE_1(a, b)
#define PASTE_1(a, b) a##b

instead of generating #if IN_MODULE == ... #define MODULE_NAME ... #endif.
Of course the "#define MODULE_foo N" bit has to be generated.
diff mbox

Patch

diff --git a/include/stap-probe.h b/include/stap-probe.h
index 688646c..150fc1e 100644
--- a/include/stap-probe.h
+++ b/include/stap-probe.h
@@ -30,7 +30,7 @@ 
 
    Systemtap's header defines the macros STAP_PROBE (provider, name) and
    STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
-   in the IN_LIB name (libc, libpthread, etc.) automagically.
+   in MODULE_NAME (libc, libpthread, etc.) automagically.
 
    The format of the arg parameters is discussed here:
 
@@ -53,7 +53,7 @@ 
 # endif
 
 # define LIBC_PROBE(name, n, ...)	\
-  LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__)
+  LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__)
 
 # define LIBC_PROBE_1(lib, name, n, ...) \
   STAP_PROBE##n (lib, name, ## __VA_ARGS__)
@@ -61,7 +61,7 @@ 
 # define STAP_PROBE0		STAP_PROBE
 
 # define LIBC_PROBE_ASM(name, template) \
-  STAP_PROBE_ASM (IN_LIB, name, template)
+  STAP_PROBE_ASM (MODULE_NAME, name, template)
 
 # define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
 
diff --git a/scripts/gen-libc-modules.awk b/scripts/gen-libc-modules.awk
index d3382b6..1ae4af3 100644
--- a/scripts/gen-libc-modules.awk
+++ b/scripts/gen-libc-modules.awk
@@ -32,9 +32,16 @@  match (FILENAME, ".*soversions.i") {
 
 # Finally, print out the header file.
 END {
-  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n\n")
+  printf ("/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT.  */\n")
   i = 1
+  print ("\n/* Allowed values for IN_MODULE.  */")
   for (l in libs) {
     printf ("#define MODULE_%s %d\n", l, libs[l])
   }
+  print ("\n/* Module names, used in stap-probe.h */")
+  for (l in libs) {
+    printf ("#if IN_MODULE == MODULE_%s\n", l)
+    printf ("# define MODULE_NAME %s\n", l)
+    printf ("#endif\n")
+  }
 }