Bug #421
closedlttng-ust generates invalid CTF on a MIPS32 target
100%
Description
Our MIPS target can not generate correct traces from UST tracepoints when there is an integer field included in the tracepoint. It seems to be some issue with alignment of the event data fields. A simple visual inspection confirms that all event fields are present in the file, but babeltrace fails to parse it.
This tracepoint definition was used to trigger the issue:
TRACEPOINT_EVENT(
image2d_sensor,
test,
TP_ARGS(int, dummy),
TP_FIELDS(
ctf_string(s, "ABCDEFGH")
ctf_integer(int, i1, 0xBBBBBBBB)
ctf_integer(int, i2, 0x33333333)
)
)
Babeltrace (compiled for x86_64) interprets the result as:
[16:54:00.266647168] (+?.?????????) axis-00408ccdbabe:image2d:13964 image2d_sensor:test: { cpu_id = 0 }, { s = "DEFGH", i1 = -1145324613, i2 = 858993459 }
[16:54:00.335492959] (+0.068845791) axis-00408ccdbabe:image2d:13964 image2d_sensor:test: { cpu_id = 0 }, { s = "?ABCDEFGH", i1 = -1145324613, i2 = 858993459 }
[16:54:00.451401559] (+0.115908600) axis-00408ccdbabe:image2d:13964 image2d_sensor:test: { cpu_id = 0 }, { s = "", i1 = 1343087003, i2 = 1111556096 }
[error] Event id 3 is outside range
Files
Updated by Mathieu Desnoyers almost 12 years ago
it looks like an alignment problem in lttng-ust.
Can you add some debugging within:
liblttng-ust/lttng-ring-buffer-client.h
lttng_write_event_header() and lttng_write_event_header_slow()
The calls to lib_ring_buffer_align_ctx(ctx, ctx->largest_align) at the end of those two functions are responsible for adding this alignment (which seems to be missing).
lib_ring_buffer_align_ctx is defined as either aligned or non-aligned depending on configuration content within your target's include/lttng/ust-config.h file (LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS).
It's very much possible that your build environment used a x86 header when trying to build a MIPS liblttng-ust.so. You might want to double check that too.
Thanks,
Mathieu
Updated by Mathieu Desnoyers almost 12 years ago
- Status changed from New to Feedback
Updated by Lars Persson almost 12 years ago
I have tracked it down to a packaging issue in the tarball distribution of lttng-ust.
The tarball contains an include/lttng/ust-config.h that #defines LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS. Since we build out-of-tree, there will be two copies of ust-config.h and the compiler picks the one from the source tree. Everything works after deleting the ust-config.h from the tarball.
Updated by Mathieu Desnoyers almost 12 years ago
- Status changed from Feedback to Resolved
- % Done changed from 0 to 100
Applied in changeset 00b217e613614b8addc4ee2bbcdec473275842fd.