public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] PR23599 Bugfix: the embeddedcode info pass incorrectly skipped unused functions
@ 2018-09-16  1:16 Yichun Zhang (agentzh)
  2018-09-16  3:17 ` Yichun Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Yichun Zhang (agentzh) @ 2018-09-16  1:16 UTC (permalink / raw)
  To: systemtap; +Cc: Yichun Zhang (agentzh)

This bug led to kernel module compilation errors when using tapset
functions like usym* in unoptimized stap translation mode (i.e., stap
-u).
---
 elaborate.cxx                                  |  4 +++
 testsuite/systemtap.base/usym_unoptimize.exp   | 34 ++++++++++++++++++++++++++
 testsuite/systemtap.base/usym_unoptimize_1.stp |  8 ++++++
 testsuite/systemtap.base/usym_unoptimize_2.stp |  8 ++++++
 4 files changed, 54 insertions(+)
 create mode 100644 testsuite/systemtap.base/usym_unoptimize.exp
 create mode 100644 testsuite/systemtap.base/usym_unoptimize_1.stp
 create mode 100644 testsuite/systemtap.base/usym_unoptimize_2.stp

diff --git a/elaborate.cxx b/elaborate.cxx
index 4a8af5f88..f34c3c01b 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1736,6 +1736,10 @@ void embeddedcode_info_pass (systemtap_session& s)
   embeddedcode_info eci (s);
   for (unsigned i=0; i<s.probes.size(); i++)
     s.probes[i]->body->visit (& eci);
+
+  for (map<string,functiondecl*>::iterator it = s.functions.begin();
+       it != s.functions.end(); it++)
+    it->second->body->visit (& eci);
 }
 
 // ------------------------------------------------------------------------
diff --git a/testsuite/systemtap.base/usym_unoptimize.exp b/testsuite/systemtap.base/usym_unoptimize.exp
new file mode 100644
index 000000000..4c6e075c9
--- /dev/null
+++ b/testsuite/systemtap.base/usym_unoptimize.exp
@@ -0,0 +1,34 @@
+set test "usym_unoptimize"
+set testpath "$srcdir/$subdir"
+
+if {! [installtest_p]} { untested "$test"; return }
+
+# --- TEST 1 ---
+
+set subtest1 "TEST 1: PR23506: using usymname() alone breaks unoptimized stap translation"
+set test_name "$test: $subtest1"
+
+set exit_code [run_cmd_2way "stap -u '$srcdir/$subdir/${test}_1.stp'" out stderr]
+set exp_out "0xdeadbeef
+hey
+"
+is "${test_name}: stdout" $out $exp_out
+is "${test_name}: exit code" $exit_code 0
+if {$stderr ne ""} {
+    send_log "stderr:\n$stderr"
+}
+
+# --- TEST 2 ---
+
+set subtest2 "TEST 2: PR23506: using usymdata() alone breaks unoptimized stap translation"
+set test_name "$test: $subtest2"
+
+set exit_code [run_cmd_2way "stap -u '$srcdir/$subdir/${test}_2.stp'" out stderr]
+set exp_out "0xdeadbeef
+hey
+"
+is "${test_name}: stdout" $out $exp_out
+is "${test_name}: exit code" $exit_code 0
+if {$stderr ne ""} {
+    send_log "stderr:\n$stderr"
+}
diff --git a/testsuite/systemtap.base/usym_unoptimize_1.stp b/testsuite/systemtap.base/usym_unoptimize_1.stp
new file mode 100644
index 000000000..4a91f519f
--- /dev/null
+++ b/testsuite/systemtap.base/usym_unoptimize_1.stp
@@ -0,0 +1,8 @@
+function foo(a) {
+    println(usymname(a));
+}
+
+probe oneshot {
+    foo(0xdeadbeef);
+    println("hey");
+}
diff --git a/testsuite/systemtap.base/usym_unoptimize_2.stp b/testsuite/systemtap.base/usym_unoptimize_2.stp
new file mode 100644
index 000000000..0a3ef06dc
--- /dev/null
+++ b/testsuite/systemtap.base/usym_unoptimize_2.stp
@@ -0,0 +1,8 @@
+function foo(a) {
+    println(usymdata(a));
+}
+
+probe oneshot {
+    foo(0xdeadbeef);
+    println("hey");
+}
-- 
2.11.0.295.gd7dffce

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

* Re: [PATCH] PR23599 Bugfix: the embeddedcode info pass incorrectly skipped unused functions
  2018-09-16  1:16 [PATCH] PR23599 Bugfix: the embeddedcode info pass incorrectly skipped unused functions Yichun Zhang (agentzh)
@ 2018-09-16  3:17 ` Yichun Zhang
  0 siblings, 0 replies; 2+ messages in thread
From: Yichun Zhang @ 2018-09-16  3:17 UTC (permalink / raw)
  To: systemtap

Hello!

On Sat, Sep 15, 2018 at 6:16 PM Yichun Zhang (agentzh)
<yichun@openresty.com> wrote:
>
> This bug led to kernel module compilation errors when using tapset
> functions like usym* in unoptimized stap translation mode (i.e., stap
> -u).

Just committed to master with the green light from fche on IRC.

Best,
Yichun

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

end of thread, other threads:[~2018-09-16  3:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-16  1:16 [PATCH] PR23599 Bugfix: the embeddedcode info pass incorrectly skipped unused functions Yichun Zhang (agentzh)
2018-09-16  3:17 ` Yichun Zhang

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).