Fix filter: pointer to string, not string, should be on stack -- query
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · * David Bryant ([email protected]) wrote:
Hi,
I'm trying to understand the following changeset:
Hello !
Please upstream lttng-ust master branch HEAD, which includes this commit:
commit c4261b0aecaf281fc1ced4c7af96b1ff6d2600d7
Author: Mathieu Desnoyers <[email protected]> Date: Wed Nov 7 13:24:58 2012 -0500
Fix: re-allow non-lvalue string, sequence, array parameters
Issue introduced by upstream commit:
commit 27f4b6094f399f2fe231b58801dce98cbd21baa9
Author: Mathieu Desnoyers <[email protected]>
Date: Tue Sep 4 12:17:07 2012 -0400
Fix filter: pointer to string, not string, should be on stack
Fixes #329
Please let me know if it helps,
Thanks,
Mathieu
Quoted 81 lines
commit
27f4b6094f399f2fe231b58801dce98cbd21baa9
Author: Mathieu Desnoyers <[email protected]>
Date: Tue Sep 4 12:17:07 2012 -0400Fix filter: pointer to string, not string, should be on stack
Fixes #329
Signed-off-by Mathieu Desnoyers <[email protected]>Bug link: https://bugs.lttng.org/issues/329
The patch forces the
ctf_string()argument to be an lvalue. It appears to be in support of tracepoint filtering of the sort:lttng enable-event ust_tests_demo2:loop -u --filter 'stringfield=="text"'
Because the argument must be an lvalue the examples/easy-ust won't compile (anymore) with the following patch:
diff -u --recursive
easy-ust/sample_component_provider.heasy-ust-reproduce/sample_component_provider.hsample_component_provider.h 2012-11-07 renamed from sample_component_provider.h 2012-11-07 17:00:09.879299565 +1030 +0
-016:57:02.121647871 +1030
sample_component_provider.h 2012-11-07 renamed from sample_component_provider.h 2012-11-07 17:00:09.879299565 +1030 +6
-1@@ -61,6 +61,11 @@ */ #include <lttng/tracepoint.h> +#ifndef SEE_ONCE +#define SEE_ONCE +static inline char * echo(char * c) { return c; } +#endif + /* * The following tracepoint event writes a message (c string) into the * field message of the trace event message in the provider@@ -100,7 +105,7 @@ * The ctf_string macro takes a c string and writes it into a field * named "message" */ - ctf_string(message, text) + ctf_string(message, echo(text)) ) ) /*Compilation results in:
$ make gcc -I/home/dbryant/local5/include -I. -c -o sample.o sample.c gcc -I/home/dbryant/local5/include -I. -c -o tp.o tp.c In file included from /home/dbryant/local5/include/lttng/ust-tracepoint-event.h:338:0, from /home/dbryant/local5/include/lttng/tracepoint-event.h:41, from sample_component_provider.h:140, from tp.c:25: ././sample_component_provider.h: In function ‘__event_prepare_filter_stack__sample_component___message’: ././sample_component_provider.h:76:1: error: lvalue required as unary ‘&’ operand make: *** [tp.o] Error 1I'm trying to make sense of all this. I've been passing generated-on-the-fly rvalues through
ctf_string()using v2.0.5 with no (noticeable) problems. Now I can't. Should I never have been doing that, or has this change had an unintended consequence? Admittedly I haven't been filtering tracepoints on text criteria and am not considering things from that angle. Shouldctf_string()arguments always be string literals?!Thanks,
Dave----------------------------------------------------------------------
The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt._______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 9 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): 20121107183400.GA29766@Krystal
Hi Mathieu,
Yes, your commit did the trick! My patched version of easy-ust (that passed an lvalue string) compiles and runs correctly.
$ lttng view Trace directory: /home/dbryant/lttng-traces/sample-20121108-105753
[10:59:16.175851994] (+?.?????????) sample:3213 sample_component:message: { cpu_id = 0 }, { message = "Hello World" } [10:59:17.176018865] (+1.000166871) sample:3213 sample_component:message: { cpu_id = 0 }, { message = "Hello World" } [10:59:18.176188138] (+1.000169273) sample:3213 sample_component:message: { cpu_id = 0 }, { message = "Hello World" }
Thanks for your quick response!
Dave
Quoted 21 lines · Mathieu Desnoyers
Hello !
Please upstream lttng-ust master branch HEAD, which includes this commit:
commit
c4261b0aecaf281fc1ced4c7af96b1ff6d2600d7Author: Mathieu Desnoyers <[email protected]> Date: Wed Nov 7 13:24:58 2012 -0500Fix: re-allow non-lvalue string, sequence, array parameters
Issue introduced by upstream commit:
commit
27f4b6094f399f2fe231b58801dce98cbd21baa9
Author: Mathieu Desnoyers <[email protected]>
Date: Tue Sep 4 12:17:07 2012 -0400Fix filter: pointer to string, not string, should be on stack
Fixes #329
Quoted 9 lines
Reported-by David Bryant <[email protected]>Signed-off-by Mathieu Desnoyers <[email protected]>Please let me know if it helps,
Thanks,
Mathieu
----------------------------------------------------------------------
The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt.