]> sourceware.org Git - systemtap.git/commitdiff
Guard regparm in probe context with STAP_NEED_REGPARM.
authorMark Wielaard <mjw@redhat.com>
Thu, 28 Jul 2011 16:10:20 +0000 (18:10 +0200)
committerMark Wielaard <mjw@redhat.com>
Thu, 28 Jul 2011 21:06:05 +0000 (23:06 +0200)
regparm is only used on i386 (and x86_64 when probing 32bit) for
signaling what the parameter packing is for the probed function
as set in register.stp. So only include it in the probe context
struct when actually used in a stap script.

Also updated docs and fixed signature on other arches.

stapfuncs.3stap
tapset/arm/registers.stp
tapset/i386/registers.stp
tapset/powerpc/registers.stp
tapset/s390/registers.stp
tapset/x86_64/registers.stp
tapsets.cxx
translate.cxx

index 345955ffc782f9e1d7a37842a59fcdda6984a9b2..c3541be0ff766189867db6860f36b92a4c429321 100644 (file)
@@ -156,6 +156,8 @@ regparm:unknown (n:long)
 The probed function was built with the gcc \-mregparm=n option.
 (The i386 kernel is built with \-mregparm=3, so systemtap considers
 regparm(3) the default for kernel functions on that architecture.)
+Only valid on i386 and x86_64 (when probing 32bit applications).
+Produces an error on other architectures.
 
 For some architectures, the *_arg functions may reject unusually high
 values of n.
index 5a64b9e0bc279d159b7275fa54cd686d9c1e1217..1f3087960fecd4dcdc8f04ec898404e1165cf14f 100644 (file)
@@ -151,7 +151,7 @@ function asmlinkage() %{ /* pure */ %}
 
 function fastcall() %{ /* pure */ %}
 
-function regparm() %{
+function regparm(n:long) %{
        snprintf(CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
                "regparm is invalid on arm.");
        CONTEXT->last_error = CONTEXT->error_buffer;
index c1e98ac008dceb475af9a1f1a718ae3d69d0de0c..5646caa297fe592f1237c042dcd4694b0ea2d00d 100644 (file)
@@ -1,3 +1,10 @@
+%{
+/* Set to include regparm field in probe context in translate.cxx. */
+#ifndef STAP_NEED_REGPARM
+#define STAP_NEED_REGPARM 1
+#endif
+%}
+
 global _reg_offsets, _stp_regs_registered, _sp_offset, _ss_offset
 
 function test_x86_gs:long() %{ /* pure */
index 5d507252be37aa76ffb11a8aef157e63e0bf0ddd..8fbfbd50069c5e049f42f259e740e33c924ea3e0 100644 (file)
@@ -215,7 +215,7 @@ function asmlinkage() %{ /* pure */ %}
 
 function fastcall() %{ /* pure */ %}
 
-function regparm() %{
+function regparm(n:long) %{
        snprintf(CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
                "regparm is invalid on powerpc.");
        CONTEXT->last_error = CONTEXT->error_buffer;
index 3215afa3356f9815fd6b853c50a89a6bc1ab2b79..df49229b0e93315ba34f049e60656f55e0ce8315 100644 (file)
@@ -215,7 +215,7 @@ function asmlinkage() %{ /* pure */ %}
 
 function fastcall() %{ /* pure */ %}
 
-function regparm() %{
+function regparm(n:long) %{
        snprintf(CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
                "regparm is invalid on s390.");
        CONTEXT->last_error = CONTEXT->error_buffer;
index e7abb18b7bd6fb2bdda838e1b0e53fa19c487907..9876c08a728510f96b6291e1ddff560e59246c1e 100644 (file)
@@ -1,3 +1,10 @@
+%{
+/* Set to include regparm field in probe context in translate.cxx. */
+#ifndef STAP_NEED_REGPARM
+#define STAP_NEED_REGPARM 1
+#endif
+%}
+
 global _reg_offsets, _r32_offsets, _stp_regs_registered
 
 function _stp_register_regs() {
index 2984fd64bd54e7f45165d060886f9f0409a1bf97..75b94ae39d9921599ca06e6cb4ec0a2c7d292ec7 100644 (file)
@@ -162,7 +162,9 @@ common_probe_entryfn_prologue (translator_output* o, string statestr,
   o->newline() << "c->pi = 0;";
   o->newline() << "c->pi_longs = 0;";
   o->newline() << "c->regflags = 0;";
+  o->newline() << "#ifdef STAP_NEED_REGPARM"; // i386 or x86_64 register.stp
   o->newline() << "c->regparm = 0;";
+  o->newline() << "#endif";
   o->newline() << "c->marker_name = NULL;";
   o->newline() << "c->marker_format = NULL;";
 
index 37de9dbd1ff635b107f8cd7c657f227f300abb17..caf9f32a880bd9f07ea804499d9ecde8728c0ac5 100644 (file)
@@ -929,7 +929,7 @@ c_unparser::emit_common_header ()
   o->newline() << "static atomic_t skipped_count_uprobe_reg = ATOMIC_INIT (0);";
   o->newline() << "static atomic_t skipped_count_uprobe_unreg = ATOMIC_INIT (0);";
 
-  // Defines for the regsflags field. Maybe merge with regparm field?
+  // Defines for the regsflags field.
   // _STP_REGS_USER regsflags bit to indicate regs fully from user.
   o->newline();
   o->newline() << "#define _STP_REGS_USER_FLAG 1";
@@ -960,7 +960,9 @@ c_unparser::emit_common_header ()
   o->newline() << "struct kretprobe_instance *pi;";
   o->newline() << "int pi_longs;"; // int64_t count in pi->data, the rest is string_t
   o->newline() << "int regflags;"; // status of pt_regs regs field.
+  o->newline() << "#ifdef STAP_NEED_REGPARM"; // i386 or x86_64 register.stp
   o->newline() << "int regparm;";
+  o->newline() << "#endif";
   o->newline() << "va_list *mark_va_list;";
   o->newline() << "const char * marker_name;";
   o->newline() << "const char * marker_format;";
This page took 0.054287 seconds and 5 git commands to generate.