public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Debug code enabled on Systemtap verison: 0.8?
@ 2009-01-07 20:36 Buddy Lumpkin
  2009-01-07 20:48 ` Buddy Lumpkin
  0 siblings, 1 reply; 6+ messages in thread
From: Buddy Lumpkin @ 2009-01-07 20:36 UTC (permalink / raw)
  To: systemtap

I have a guru mode script that uses a combination of the systemtap
language and inline C. Upon upgrading to systemtap 0.8, I noticed an
extra message being printed from my scripts output. I assume it is
extra debugging of the code interpreter?

This is the extra line that is printed:

node_addr=0x0

There is a global variable called node_addr in my script. A small
adjustment to some code made the message go away:


this causes the message to occur:

            if ((node_addr = node_addr(node_id + 1)))
            {
                node_id++;
                pg_index = 0;
                mem_map = node_mem_map(node_id);
                present_pages = node_present_pages(node_id);
            }

Written this way, it goes away:

            node_addr = node_addr(node_id + 1);
            if (node_addr)
            {
                node_id++;
                pg_index = 0;
                mem_map = node_mem_map(node_id);
                present_pages = node_present_pages(node_id);
            }

Here is what appears to be the relevant portion of a unified diff of
the code that is produced:


@@ -3696,26 +3701,24 @@
             global.s_pages_scanned;
           });

-          (void)
-          ({
-            l->__tmp80 =
-            ({
-              l->__tmp82 = ((global.s_node_id) + (((int64_t)1LL)));
-              c->locals[c->nesting+1].function_node_addr.node_idx = l->__tmp82;
-              function_node_addr (c);
-              if (unlikely(c->last_error)) goto out;
-              c->locals[c->nesting+1].function_node_addr.__retvalue;
-            });
-            global.s_node_addr = l->__tmp80;
-            l->__tmp80;
-          });
-
-          c->actionremaining -= 3;
+          c->actionremaining -= 2;
           if (unlikely (c->actionremaining <= 0)) {
             c->last_error = "MAXACTION exceeded";
             goto out;
           }
-          if (global.s_node_addr) {
+          if (
+            ({
+              l->__tmp80 =
+              ({
+                l->__tmp82 = ((global.s_node_id) + (((int64_t)1LL)));
+                c->locals[c->nesting+1].function_node_addr.node_idx =
l->__tmp82;
+                function_node_addr (c);
+                if (unlikely(c->last_error)) goto out;
+                c->locals[c->nesting+1].function_node_addr.__retvalue;
+              });
+              global.s_node_addr = l->__tmp80;
+              l->__tmp80;
+            })) {
             {
               (void)
               ({
@@ -3949,6 +3952,36 @@
 }


+#ifdef STP_TIMING
+static __cacheline_aligned Stat time_probe_1405;
+#endif
+
+static void probe_1406 (struct context * __restrict__ c) {
+  struct probe_1406_locals * __restrict__ l =
+    & c->locals[0].probe_1406;
+  (void) l;
+  #ifdef STP_TIMING
+  c->statp = & time_probe_1405;
+  #endif
+  {
+    (void)
+    ({
+      l->__tmp0 = global.s_node_addr;
+      _stp_printf ("node_addr=%#llx\n", l->__tmp0);
+      ((int64_t)0LL);
+    });
+
+  }
+  c->actionremaining -= 1;
+  if (unlikely (c->actionremaining <= 0)) {
+    c->last_error = "MAXACTION exceeded";
+    goto out;
+  }
+out:
+  _stp_print_flush();
+}
+
+
 /* ---- begin/end probes ---- */
 void enter_begin_probe (void (*fn)(struct context*), const char* pp) {
   struct context* __restrict__ c;
@@ -4161,6 +4194,7 @@
 } stap_be_probes[] = {
   { .pp="begin", .ph=&probe_1402, .type=0 },
   { .pp="end", .ph=&probe_1404, .type=1 },
+  { .pp="end", .ph=&probe_1406, .type=1 },
 };

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Debug code enabled on Systemtap verison: 0.8?
  2009-01-07 20:36 Debug code enabled on Systemtap verison: 0.8? Buddy Lumpkin
@ 2009-01-07 20:48 ` Buddy Lumpkin
  2009-01-07 21:22   ` Stone, Joshua I
  2009-01-07 21:40   ` Frank Ch. Eigler
  0 siblings, 2 replies; 6+ messages in thread
From: Buddy Lumpkin @ 2009-01-07 20:48 UTC (permalink / raw)
  To: systemtap

Sorry if this is a duplicate, I already sent this once to
systemtap@sourceware.org, re-sending to systemtap@sources.redhat.com.

I have a guru mode script that uses a combination of the systemtap
language and inline C. Upon upgrading to systemtap 0.8, I noticed an
extra message being printed from my scripts output. I assume it is
extra debugging of the code interpreter?

This is the extra line that is printed:

node_addr=0x0

There is a global variable called node_addr in my script. A small
adjustment to some code made the message go away:


this causes the message to occur:

           if ((node_addr = node_addr(node_id + 1)))
           {
               node_id++;
               pg_index = 0;
               mem_map = node_mem_map(node_id);
               present_pages = node_present_pages(node_id);
           }

Written this way, it goes away:

           node_addr = node_addr(node_id + 1);
           if (node_addr)
           {
               node_id++;
               pg_index = 0;
               mem_map = node_mem_map(node_id);
               present_pages = node_present_pages(node_id);
           }

Here is what appears to be the relevant portion of a unified diff of
the code that is produced:


@@ -3696,26 +3701,24 @@
            global.s_pages_scanned;
          });

-          (void)
-          ({
-            l->__tmp80 =
-            ({
-              l->__tmp82 = ((global.s_node_id) + (((int64_t)1LL)));
-              c->locals[c->nesting+1].function_node_addr.node_idx = l->__tmp82;
-              function_node_addr (c);
-              if (unlikely(c->last_error)) goto out;
-              c->locals[c->nesting+1].function_node_addr.__retvalue;
-            });
-            global.s_node_addr = l->__tmp80;
-            l->__tmp80;
-          });
-
-          c->actionremaining -= 3;
+          c->actionremaining -= 2;
          if (unlikely (c->actionremaining <= 0)) {
            c->last_error = "MAXACTION exceeded";
            goto out;
          }
-          if (global.s_node_addr) {
+          if (
+            ({
+              l->__tmp80 =
+              ({
+                l->__tmp82 = ((global.s_node_id) + (((int64_t)1LL)));
+                c->locals[c->nesting+1].function_node_addr.node_idx =
l->__tmp82;
+                function_node_addr (c);
+                if (unlikely(c->last_error)) goto out;
+                c->locals[c->nesting+1].function_node_addr.__retvalue;
+              });
+              global.s_node_addr = l->__tmp80;
+              l->__tmp80;
+            })) {
            {
              (void)
              ({
@@ -3949,6 +3952,36 @@
 }


+#ifdef STP_TIMING
+static __cacheline_aligned Stat time_probe_1405;
+#endif
+
+static void probe_1406 (struct context * __restrict__ c) {
+  struct probe_1406_locals * __restrict__ l =
+    & c->locals[0].probe_1406;
+  (void) l;
+  #ifdef STP_TIMING
+  c->statp = & time_probe_1405;
+  #endif
+  {
+    (void)
+    ({
+      l->__tmp0 = global.s_node_addr;
+      _stp_printf ("node_addr=%#llx\n", l->__tmp0);
+      ((int64_t)0LL);
+    });
+
+  }
+  c->actionremaining -= 1;
+  if (unlikely (c->actionremaining <= 0)) {
+    c->last_error = "MAXACTION exceeded";
+    goto out;
+  }
+out:
+  _stp_print_flush();
+}
+
+
 /* ---- begin/end probes ---- */
 void enter_begin_probe (void (*fn)(struct context*), const char* pp) {
  struct context* __restrict__ c;
@@ -4161,6 +4194,7 @@
 } stap_be_probes[] = {
  { .pp="begin", .ph=&probe_1402, .type=0 },
  { .pp="end", .ph=&probe_1404, .type=1 },
+  { .pp="end", .ph=&probe_1406, .type=1 },
 };

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Debug code enabled on Systemtap verison: 0.8?
  2009-01-07 20:48 ` Buddy Lumpkin
@ 2009-01-07 21:22   ` Stone, Joshua I
  2009-01-07 21:40   ` Frank Ch. Eigler
  1 sibling, 0 replies; 6+ messages in thread
From: Stone, Joshua I @ 2009-01-07 21:22 UTC (permalink / raw)
  To: Buddy Lumpkin, systemtap

Buddy Lumpkin wrote:
> Sorry if this is a duplicate, I already sent this once to
> systemtap@sourceware.org, re-sending to systemtap@sources.redhat.com.

Those are aliases for the same list.

> I have a guru mode script that uses a combination of the systemtap
> language and inline C. Upon upgrading to systemtap 0.8, I noticed an
> extra message being printed from my scripts output. I assume it is
> extra debugging of the code interpreter?
>
> This is the extra line that is printed:
>
> node_addr=0x0
>
> There is a global variable called node_addr in my script. A small
> adjustment to some code made the message go away:

We automatically print out global variables that are write-only.  This is for convenience so you don't need to write a "probe end { print(...) }" every time.

Inside your "if" condition, the result of an assignment is just the RHS value again, so your "node_addr" variable is never actually being read.  Therefore, a "probe end" is generated to print it for you.

If this is the only place you're using node_addr, then why have it as a global?


Josh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debug code enabled on Systemtap verison: 0.8?
  2009-01-07 20:48 ` Buddy Lumpkin
  2009-01-07 21:22   ` Stone, Joshua I
@ 2009-01-07 21:40   ` Frank Ch. Eigler
  2009-01-07 23:54     ` Buddy Lumpkin
  1 sibling, 1 reply; 6+ messages in thread
From: Frank Ch. Eigler @ 2009-01-07 21:40 UTC (permalink / raw)
  To: Buddy Lumpkin; +Cc: systemtap

"Buddy Lumpkin" <buddy.lumpkin@gmail.com> writes:

> Sorry if this is a duplicate, I already sent this once to
> systemtap@sourceware.org, re-sending to systemtap@sources.redhat.com.

(They are equivalent aliases.)


> This is the extra line that is printed:
> node_addr=0x0

This is a consequence of feature sources.redhat.com/PR5686.


> There is a global variable called node_addr in my script. A small
> adjustment to some code made the message go away:
>
> this causes the message to occur:
>
>            if ((node_addr = node_addr(node_id + 1)))
>                [...]

In this case, the node_addr variable is not read, so it is
automagically printed.  (The value of the node_addr() function is used
as an rvalue for the if expression.)

> Written this way, it goes away:
>
>            node_addr = node_addr(node_id + 1);
>            if (node_addr)
>                [...]

In this case, the node_addr variable is read, so the
automagic global printing is not active.

- FChE

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debug code enabled on Systemtap verison: 0.8?
  2009-01-07 21:40   ` Frank Ch. Eigler
@ 2009-01-07 23:54     ` Buddy Lumpkin
  2009-01-08  0:01       ` Frank Ch. Eigler
  0 siblings, 1 reply; 6+ messages in thread
From: Buddy Lumpkin @ 2009-01-07 23:54 UTC (permalink / raw)
  To: Frank Ch. Eigler, systemtap

Why not turn that behavior on with a command line option?

As an example, You can turn on all kinds of convenient, additional
behavior in perl to enhance the ability to do one liners by adding
command line switches.

--Buddy

On Wed, Jan 7, 2009 at 1:40 PM, Frank Ch. Eigler <fche@redhat.com> wrote:
> "Buddy Lumpkin" <buddy.lumpkin@gmail.com> writes:
>
>> Sorry if this is a duplicate, I already sent this once to
>> systemtap@sourceware.org, re-sending to systemtap@sources.redhat.com.
>
> (They are equivalent aliases.)
>
>
>> This is the extra line that is printed:
>> node_addr=0x0
>
> This is a consequence of feature sources.redhat.com/PR5686.
>
>
>> There is a global variable called node_addr in my script. A small
>> adjustment to some code made the message go away:
>>
>> this causes the message to occur:
>>
>>            if ((node_addr = node_addr(node_id + 1)))
>>                [...]
>
> In this case, the node_addr variable is not read, so it is
> automagically printed.  (The value of the node_addr() function is used
> as an rvalue for the if expression.)
>
>> Written this way, it goes away:
>>
>>            node_addr = node_addr(node_id + 1);
>>            if (node_addr)
>>                [...]
>
> In this case, the node_addr variable is read, so the
> automagic global printing is not active.
>
> - FChE
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debug code enabled on Systemtap verison: 0.8?
  2009-01-07 23:54     ` Buddy Lumpkin
@ 2009-01-08  0:01       ` Frank Ch. Eigler
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Ch. Eigler @ 2009-01-08  0:01 UTC (permalink / raw)
  To: Buddy Lumpkin; +Cc: systemtap

Hi -

> Why not turn that behavior on with a command line option?

That's possible, though I'd prefer it stay on by default.  In your
script's case, without the automagic printing, you'd get a
(suppressable) warning about a written-only variable.

> As an example, You can turn on all kinds of convenient, additional
> behavior in perl to enhance the ability to do one liners by adding
> command line switches.

True.

- FChE

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-08  0:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-07 20:36 Debug code enabled on Systemtap verison: 0.8? Buddy Lumpkin
2009-01-07 20:48 ` Buddy Lumpkin
2009-01-07 21:22   ` Stone, Joshua I
2009-01-07 21:40   ` Frank Ch. Eigler
2009-01-07 23:54     ` Buddy Lumpkin
2009-01-08  0:01       ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).