summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testsuite/systemtap.examples/general/grapher.stp10
-rw-r--r--testsuite/systemtap.printf/basic6.exp3
-rw-r--r--testsuite/systemtap.printf/basic6.stp5
-rw-r--r--translate.cxx3
4 files changed, 15 insertions, 6 deletions
diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp
index 04463979..4f326ec1 100644
--- a/testsuite/systemtap.examples/general/grapher.stp
+++ b/testsuite/systemtap.examples/general/grapher.stp
@@ -2,11 +2,11 @@
probe begin
{
-printf ("%s\n", "%Title:CPU utilization");
-printf ("%s\n", "%XAxisTitle:Time");
-printf ("%s\n", "%YAxisTitle:Percent");
-printf ("%s\n", "%DataSet:cpu 100 00ff00 bar");
-printf ("%s\n", "%DataSet:kbd 100 ff0000 dot");
+printf ("%%Title:CPU utilization\n");
+printf ("%%XAxisTitle:Time");
+printf ("%%YAxisTitle:Percent");
+printf ("%%DataSet:cpu 100 00ff00 bar");
+printf ("%%DataSet:kbd 100 ff0000 dot");
}
# CPU utilization
diff --git a/testsuite/systemtap.printf/basic6.exp b/testsuite/systemtap.printf/basic6.exp
new file mode 100644
index 00000000..72bf8f57
--- /dev/null
+++ b/testsuite/systemtap.printf/basic6.exp
@@ -0,0 +1,3 @@
+set test "basic6"
+set ::result_string {Hello%World}
+stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.printf/basic6.stp b/testsuite/systemtap.printf/basic6.stp
new file mode 100644
index 00000000..69721188
--- /dev/null
+++ b/testsuite/systemtap.printf/basic6.stp
@@ -0,0 +1,5 @@
+probe begin
+{
+ printf("Hello%%World");
+ exit()
+}
diff --git a/translate.cxx b/translate.cxx
index 46fea6e7..f7868ceb 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4172,7 +4172,8 @@ c_unparser::visit_print_format (print_format* e)
int use_print = 0;
string format_string = print_format::components_to_string(components);
- if (tmp.size() == 0 || (tmp.size() == 1 && format_string == "%s"))
+ if ((tmp.size() == 0 && format_string.find("%%") == std::string::npos)
+ || (tmp.size() == 1 && format_string == "%s"))
use_print = 1;
else if (tmp.size() == 1
&& e->args[0]->tok->type == tok_string