[lttng-dev] Writing a babeltrace output plugin

Matthew Khouzam matthew.khouzam at ericsson.com
Tue Apr 17 11:44:41 EDT 2012



On 12-04-17 11:30 AM, Alexandre Montplaisir wrote:
> On 12-04-17 11:05 AM, Mathieu Desnoyers wrote:
>> [...]
>> The ideas I pondered were either to change the grammar late in the
>> game and prefix a dot (".") before any toplevel dynamic scope, or make
>> the LTTng tracer preprend an underscore before each event field, which
>> gets removed by the trace analyzer. I'm not particularly proud of this
>> hack though. Comments are welcome. 
> Matthew and I have discussed it before, and adding an underscore in
> front is fine. However, we think this should be specified in the CTF
> spec, and should not be optional. This makes writing a parser much
> easier, since you systematically remove the first character, and it
> avoids having to parse the first character for every single field name.
>
> For example:
> developer adds a tracepoint, with a field called "field1"
> tracer adds the underscore when writing the CTF metadata, "_field1"
> when reading a trace, the parser removes the "_"
> Viewers and readers (Babeltrace, Eclipse, etc.) only see the "field1" part.
>
> That way users never see the underscore itself.
>
> Thoughts?
>
I would like to say that part of the logic behind Alex and I's
perspective of the problem is that this seems very similar to name
mangling in C/C++. It's not up to the compiler to say: I think I'll add
__lcGfield16Fpcpkc_0_ to this function name. It is in the spec. Of
course, ctf needs to be simpler. My concerns are giving an unclear
message to the user: why does seek field and _field work. what if I have
worked at a Redmond company and adds _ all my fields already, then
_field and __field will work.



More information about the lttng-dev mailing list