[lttng-dev] porting LTTng to Go(lang)?

craig harmer charmster at gmail.com
Fri Jun 2 06:27:33 UTC 2017


hi all,

has anyone looked at porting LTTng to Go
<https://en.wikipedia.org/wiki/Go_%28programming_language%29> (AKA Golang
<https://golang.org/>)?

Go is a language very similar to C, but it has intrinsic support for
concurrency and better memory protection (at the expense of including
garbage collection).  its from Google and is pretty hot these days for big
data and "web scale" distributed systems.  the similarity to C is not
surprising since two of the three authors were also involved in the
development of UNIX in at AT&T in the 1970's: Rob Pike and Ken Thompson
(Robert Griesemer is the third author).

Go is able to link with C object files, so implementing support for
tracef(3) should not be very difficult.

but i want to have full support for user-defined tracepoint() events.  that
looks to be much trickier since the LTTng tracepoint() functionality relies
heavily on (some might say abuses) the C pre-processor, and Go does not
have an equivalent of the C pre-processor.  however, i don't see an obvious
reason why Go source files that contain tracepoints couldn't be run through
the C pre-processor -- except that Go specific LTTng header files would be
required.

here is an example of "hello, world" in Go
<https://tour.golang.org/welcome/1>.  (note the use of "import" rather then
"#include").

i've spent more than a few hours looking at the C code generated by the C
pre-processor trying to track down exactly why a tracepoint() definition is
causing a compiler error, so i think i have an idea of just how hard it
would be to development equivalent header files for Go + C pre-processor.
it may be the case that the Go "header files", once developed, would be
compiler specific, i.e only work with gccgo
<https://golang.org/doc/install/gccgo> (the gcc front-end for Go).

anyway, i'm wondering if anybody has attempted this and/or what your
thoughts would be.

--craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20170601/d188836b/attachment.html>


More information about the lttng-dev mailing list