From 49b50ec6c2b45456d33d3fa145ccd3adfe4c528b Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Tue, 24 Mar 2009 16:11:55 -0400 Subject: Remove debugging line. * dtrace: Remove debugging line. --- dtrace | 1 - 1 file changed, 1 deletion(-) (limited to 'dtrace') diff --git a/dtrace b/dtrace index 7966e1f2..fd7b4b99 100755 --- a/dtrace +++ b/dtrace @@ -80,7 +80,6 @@ class provider: elif (c == 8): self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\n' % (this_probe_canon, c+1, this_probe)) elif (c == 9): - self.h.write('// X %d %s\n' % (c+1,this_probe_canon)) self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)\n' % (this_probe_canon, c+1, this_probe)) self.h.write ('#define %s_ENABLED() 1\n' % this_probe_canon) -- cgit From f5f4f6b9712d3a93e42d5c2f81d21bf229d65ab6 Mon Sep 17 00:00:00 2001 From: Eugeniy Meshcheryakov Date: Mon, 13 Apr 2009 21:05:25 +0200 Subject: add a space --- dtrace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dtrace') diff --git a/dtrace b/dtrace index fd7b4b99..ca95b678 100755 --- a/dtrace +++ b/dtrace @@ -94,7 +94,7 @@ class provider: ######################################################################## def usage (): - print "Usage " + sys.argv[0] + "[-h | -G] -s File.d -o File {Files}" + print "Usage " + sys.argv[0] + " [-h | -G] -s File.d -o File {Files}" sys.exit(1) def open_file (arg): -- cgit From 4f988cd3365c63ac792317337670155d3351d577 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Thu, 16 Apr 2009 14:34:21 -0400 Subject: Simplify dtrace. * dtrace: Simplify the macro generator. --- dtrace | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'dtrace') diff --git a/dtrace b/dtrace index ca95b678..304c1bf6 100755 --- a/dtrace +++ b/dtrace @@ -59,29 +59,18 @@ class provider: i += 1 if (len(new_args) > 0): self.arglist[this_probe] = ('%s arg%d' % (new_args, c)) - if (len(new_args) == 0): - self.h.write ('#define %s() STAP_PROBE(provider,%s)\n' % (this_probe_canon, this_probe)) - elif (c == 0): - self.h.write ('#define %s(arg1) STAP_PROBE%d(provider,%s,arg1)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 1): - self.h.write ('#define %s(arg1,arg2) STAP_PROBE%d(provider,%s,arg1,arg2)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 2): - self.h.write ('#define %s(arg1,arg2,arg3) STAP_PROBE%d(provider,%s,arg1,arg2,arg3)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 3): - self.h.write ('#define %s(arg1,arg2,arg3,arg4) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 4): - self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 5): - self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 6): - self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 7): - self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 8): - self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\n' % (this_probe_canon, c+1, this_probe)) - elif (c == 9): - self.h.write ('#define %s(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) STAP_PROBE%d(provider,%s,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)\n' % (this_probe_canon, c+1, this_probe)) + define_str = "#define %s(" % (this_probe_canon) + stap_str = "STAP_PROBE%s(provider,%s" % (c+1,this_probe) + i = 0 + while (i <= c): + if (i != 0): + define_str += "," + define_str = define_str + "arg%s" % (i+1); + stap_str = stap_str + ",arg%s" % (i+1); + i += 1 self.h.write ('#define %s_ENABLED() 1\n' % this_probe_canon) + self.h.write (define_str + ")\\\n") + self.h.write (stap_str + ")\n\n") def get(self, arg): print arg @@ -89,9 +78,6 @@ class provider: return self.arglist[arg] else: return "" -######################################################################## -# main -######################################################################## def usage (): print "Usage " + sys.argv[0] + " [-h | -G] -s File.d -o File {Files}" @@ -107,6 +93,11 @@ def open_file (arg): sys.exit(1) return file + +######################################################################## +# main +######################################################################## + if (len (sys.argv) < 2): usage() -- cgit From 466076411bb00af1b2d13423b47ee2835e9b1c97 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Thu, 16 Apr 2009 15:04:29 -0400 Subject: Handle dtrace no argument macro case specially. * dtrace: No argument case is DTRACE_PROBE/STAP_PROBE. --- dtrace | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'dtrace') diff --git a/dtrace b/dtrace index 304c1bf6..114e70a6 100755 --- a/dtrace +++ b/dtrace @@ -59,17 +59,22 @@ class provider: i += 1 if (len(new_args) > 0): self.arglist[this_probe] = ('%s arg%d' % (new_args, c)) + if (len(new_args) == 0): + c = 0 + stap_str = "STAP_PROBE(provider,%s" % (this_probe) + else: + c += 1 + stap_str = "STAP_PROBE%d(provider,%s" % (c,this_probe) define_str = "#define %s(" % (this_probe_canon) - stap_str = "STAP_PROBE%s(provider,%s" % (c+1,this_probe) - i = 0 + i = 1 while (i <= c): if (i != 0): define_str += "," - define_str = define_str + "arg%s" % (i+1); - stap_str = stap_str + ",arg%s" % (i+1); + define_str = define_str + "arg%s" % (i); + stap_str = stap_str + ",arg%s" % (i); i += 1 self.h.write ('#define %s_ENABLED() 1\n' % this_probe_canon) - self.h.write (define_str + ")\\\n") + self.h.write (define_str + ") \\\n") self.h.write (stap_str + ")\n\n") def get(self, arg): -- cgit From 2a22df62a80d032e9450570c32009bfea4be7305 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Fri, 17 Apr 2009 10:15:41 -0400 Subject: Output probe calling sequence comment * dtrace: Output probe calling sequence comment --- dtrace | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'dtrace') diff --git a/dtrace b/dtrace index 114e70a6..a2b495b2 100755 --- a/dtrace +++ b/dtrace @@ -17,12 +17,11 @@ from subprocess import call from tempfile import mkstemp class provider: - arglist = dict() def open(self, provider, header): have_provider = False self.f = open(provider) self.h = open(header,mode='w') - self.h.write("// Generated by the Systemtap dtrace wrapper\n") + self.h.write("/* Generated by the Systemtap dtrace wrapper */\n") self.h.write("\n#include \n\n") in_comment = False while (True): @@ -49,7 +48,6 @@ class provider: new_args = "" i = 0 c = 0 - self.arglist[this_probe] = "" while (i < len(args)): if (args[i:i+1] == ","): new_args = ('%s%s' % (new_args, args[i])) @@ -57,8 +55,6 @@ class provider: else: new_args = new_args + args[i] i += 1 - if (len(new_args) > 0): - self.arglist[this_probe] = ('%s arg%d' % (new_args, c)) if (len(new_args) == 0): c = 0 stap_str = "STAP_PROBE(provider,%s" % (this_probe) @@ -68,22 +64,16 @@ class provider: define_str = "#define %s(" % (this_probe_canon) i = 1 while (i <= c): - if (i != 0): + if (i != 1): define_str += "," define_str = define_str + "arg%s" % (i); stap_str = stap_str + ",arg%s" % (i); i += 1 + self.h.write ('/* %s (%s) */\n' % (this_probe_canon,new_args)) self.h.write ('#define %s_ENABLED() 1\n' % this_probe_canon) self.h.write (define_str + ") \\\n") self.h.write (stap_str + ")\n\n") - def get(self, arg): - print arg - if (arg in self.arglist): - return self.arglist[arg] - else: - return "" - def usage (): print "Usage " + sys.argv[0] + " [-h | -G] -s File.d -o File {Files}" sys.exit(1) -- cgit