This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/17292] New: multi-line strings broken
- From: "dsmith at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Tue, 19 Aug 2014 18:14:45 +0000
- Subject: [Bug translator/17292] New: multi-line strings broken
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=17292
Bug ID: 17292
Summary: multi-line strings broken
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
Assignee: systemtap at sourceware dot org
Reporter: dsmith at redhat dot com
Multi-line strings don't seem to work in systemtap. (Are they supposed to?)
With the following script:
====
probe begin
{
str = "hello
there"
printf("%s\n", str)
}
====
You get this:
====
# stap ./str.stp
parse error: Could not find matching closing quote
at: junk 'hello' at ./str.stp:3:8
source: str = "hello
^
1 parse error.
Pass 1: parse failed. [man error::pass1]
====
The above seems reasonable. So, let's add a '\' to the end of the line:
====
probe begin
{
str = "hello\
there"
printf("%s\n", str)
}
====
Here we get past the translator, but the resulting C code won't compile:
====
# stap ./str.stp
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c: In function
âprobe_2254â:
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:102:26: error:
missing terminating " character [-Werror]
strlcpy (l->l_str, "hello
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:102:7: error:
missing terminating " character
strlcpy (l->l_str, "hello
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:103:6: error:
missing terminating " character [-Werror]
there", MAXSTRINGLEN);
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:103:1: error:
missing terminating " character
there", MAXSTRINGLEN);
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:104:7: error:
missing terminating " character [-Werror]
"hello
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:104:7: error:
missing terminating " character
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:103:1: error:
âthereâ undeclared (first use in this function)
there", MAXSTRINGLEN);
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:103:1: note:
each undeclared identifier is reported only once for each function it appears
in
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:105:1: error:
expected â)â before âthereâ
there";
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:105:6: error:
missing terminating " character [-Werror]
there";
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:105:1: error:
missing terminating " character
there";
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:106:5: error:
too few arguments to function âstrlcpyâ
});
^
In file included from include/linux/bitmap.h:8:0,
from include/linux/cpumask.h:11,
from
/usr/src/kernels/3.15.8-200.fc20.x86_64/arch/x86/include/asm/cpumask.h:4,
from
/usr/src/kernels/3.15.8-200.fc20.x86_64/arch/x86/include/asm/msr.h:10,
from
/usr/src/kernels/3.15.8-200.fc20.x86_64/arch/x86/include/asm/processor.h:20,
from
/usr/src/kernels/3.15.8-200.fc20.x86_64/arch/x86/include/asm/thread_info.h:23,
from include/linux/thread_info.h:54,
from
/usr/src/kernels/3.15.8-200.fc20.x86_64/arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:18,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from /usr/local/share/systemtap/runtime/linux/runtime.h:14,
from /usr/local/share/systemtap/runtime/runtime.h:24,
from
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:24:
include/linux/string.h:26:8: note: declared here
size_t strlcpy(char *, const char *, size_t);
^
/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.c:106:5: error:
expected â;â before â}â token
});
^
cc1: all warnings being treated as errors
make[1]: *** [/tmp/stapLwuE5U/stap_1d9558597b8a3f10f9d97d340d0f13d3_927_src.o]
Error 1
make: *** [_module_/tmp/stapLwuE5U] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed. [man error::pass4]
====
OK, let's put '\\' at the end of the string:
====
probe begin
{
str = "hello\\
there"
printf("%s\n", str)
}
====
Here we can't get past the translator:
====
# stap ./str.stp
parse error: Could not find matching closing quote
at: junk 'hello\\' at ./str.stp:3:8
source: str = "hello\\
^
1 parse error.
Pass 1: parse failed. [man error::pass1]
====
OK, let's put '\\\' at the end:
====
probe begin
{
str = "hello\\\
there"
printf("%s\n", str)
}
====
Here we get success (of a sort):
====
# stap ./str.stp
hello here
====
The translator outputs valid C code, which got compiled, but the result isn't
what we were looking for. One of those backslashes got attached to the 't' in
'there' and got turned into a tab character.
(This bug might be related to bug #13371)
--
You are receiving this mail because:
You are the assignee for the bug.