You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LTTng 2.15+ records CTF 2 (JSON metadata) by default, which the TSDL parser could not read. Add a CTF 2 metadata parser that maps CTF 2 field classes onto the existing descriptor model, and select the parser from the metadata content.
Also fix issues that CTF 2 / multi-channel LTTng traces exposed:
Accept any _ stream file, not only chan*
Event ids are unique per stream: look up event descriptors and generic event kinds by (stream, id)
Look up streams by id and read the packet context after determining the stream id
Decode explicitly big-endian whole-byte integers
Read the event-specific context when one is defined
LTTng 2.15+ records CTF 2 (JSON metadata) by default, which the TSDL parser
could not read. Add a CTF 2 metadata parser that maps CTF 2 field classes onto
the existing descriptor model, and select the parser from the metadata content.
Also fix issues that CTF 2 / multi-channel LTTng traces exposed:
- Accept any <channel>_<cpu> stream file, not only chan*
- Event ids are unique per stream: look up event descriptors and generic
event kinds by (stream, id)
- Look up streams by id and read the packet context after determining the
stream id
- Decode explicitly big-endian whole-byte integers
- Read the event-specific context when one is defined
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
Most of these comments are small style and clarity things; though there are two or three that revolve around logic correctness that I think you should take a quick look at first and let me know if I am thinking nonsense or not
CtfFloatingPointDescriptor passed the raw bytes to BitConverter regardless of
its ByteOrder, so big-endian floats (now produced by the CTF 2 parser, and
possible in CTF 1.8 via byte_order = be/network) decoded to wrong values.
Reverse explicitly big-endian values before decoding, as CtfIntegerDescriptor
does, and add tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Detect the packet magic number in little- or big-endian order and read
content_size/packet_size in that order (explicit, not host byte order)
- CTF 2 metadata packets (CTF2-PMETA-1.0) have a 44-byte header whose size
is given by the header-size field; CTF 1.8 packets keep the 37-byte header
- Decode the content of all packets at once so multi-byte UTF-8 characters
split across packets are preserved
- Pass the decoded text to the CTF 1.8 (ANTLR) parser so it no longer
re-reads packets with its little-endian-only reader
- Add tests for both byte orders and header versions, corrupt packets, and
the repo's CTF 1.8 LTTng metadata re-packetized as big endian
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
https://diamon.org/ctf/ now hosts the CTF 2 specification, so the #spec7.1 and
#spec4.1.7 anchors no longer exist there. Link CTF 1.8 sections to the v1.8.3
specification and CTF 2 metadata to its Metadata stream section.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
EventKind cached names and field names in a static dictionary keyed by
(domain, stream id, event id). Ids are only unique within one stream of one
trace, so traces of the same domain in one input (e.g. per-UID and per-PID
UST buffers) and traces processed later in the same process reused the
first trace's event names. The static Dictionary was also not thread safe.
Cache kinds per event descriptor, which identifies the event class within
its trace, in a ConditionalWeakTable so entries are released with the trace
and lookups are thread safe. LTTngEvent now exposes its EventDescriptor.
The legacy (domain, id) EventKind methods are kept for compatibility but
marked obsolete; the (domain, stream, id) overloads added earlier in this
change are removed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The sign mask was an int (1 << (Size - 1)), so for sizes above 32 bits the
shift wrapped and the mask was sign-extended when widened to long. Signed
integers of 33 to 64 bits, little- and big-endian, decoded to wrong values
(e.g. 64-bit 0x0000000100000000 as -2147483648). Compute the sign bit in 64
bits and only extend values narrower than 64 bits.
Decoding long.MinValue correctly then hit Math.Abs(long.MinValue) in
IntegerLiteral's bit counting, so handle that value explicitly.
Add tests for signed integers of every whole-byte size in both byte orders.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A field location may have an origin (e.g. event-record-payload), in which
case its path starts at that scope's root structure rather than at the
structure containing the field. The origin was ignored, so such paths were
treated as relative and a length or selector inside a nested structure was
not found when decoding. LTTng-UST metadata (written by lttng-tools) gives
every field location an origin.
Track the scope and the member path while building field classes. A
location rooted at the same scope is converted to a path relative to the
structure containing the field when that structure is on the path, which
covers all locations LTTng writes. Locations in another scope, outside the
containing structure, inside array elements or variant options, or with
parent (null) steps are rejected with a clear error instead of being
misread.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LTTng 2.15+ (lttng-modules and lttng-ust) packetizes CTF 2 metadata with
the 37-byte CTF 1.8 header and sets the version to 2.0; it does not add the
reserved bytes and header size field of CTF2-PMETA-1.0. Choosing the 44-byte
layout from the major version alone read metadata text as the header size
and rejected these traces.
Use the CTF2-PMETA-1.0 header only when its header size field is valid for
the packet. Metadata text can't contain NUL bytes and can't form a valid
size for a real packet, so zero reserved bytes with an invalid size are
still reported as corrupt; anything else uses the 37-byte header.
The test packetizer now takes an explicit layout (CTF 1.8, LTTng CTF 2,
CTF2-PMETA-1.0), and the packet tests cover LTTng's layout.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Casting the CTF 2 stream-class ID from ulong to uint is unchecked, so an ID such as 4294967296 is silently remapped to stream 0. Since the playback model only supports 32-bit stream IDs, reject out-of-range metadata instead of associating its events with another stream.
This issue also appears on line 739 of the same file.
Dispose engine runtime before deleting the trace archive
LTTngDataExtUnitTest/LTTngCtf2UnitTest.cs:56
The engine runtime is never disposed, while cleanup immediately deletes the archive it opened. This leaks the runtime for the test process and can make ClassCleanup fail on platforms that keep the archive handle open. Keep the runtime as class state and dispose it before deleting tracePath, or restructure setup so it is disposed after outputs are materialized.
Added additional check for packetBytes to ensure it does not exceed metadata length.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The event specific context was read before the payload but nothing tested
it, and LTTng never exposed its values. Add LTTngEvent.SpecificContext and
include its fields in generic events, between the stream event context and
the payload fields. Size the generic event field columns from all of an
event's fields, not only its payload fields.
Tests:
- Parser: a specific context with mixed field sizes and a field location
rooted at event-record-specific-context, decoded together with the
payload from one buffer.
- End to end: a CTF 2 trace with event record classes with and without a
specific context in one stream; the context and following payload fields
must decode correctly (a missed context read fails this test).
- Share the synthetic CTF 2 trace writer between LTTng tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LTTngDriver is a command-line tool that ships the Performance SDK and
engine, so plugintool pack always fails for it (its build output also
carries the LTTng plugin's manifest). The Create PTIX step only reported
the exit code of its last command, and the hashtable's key order varies
between runs, so the step failed only when LTTngDriver happened to be
packed last.
Don't pack LTTngDriver (its files are still published as an artifact),
pack in a fixed order, and fail the step if any manifest is missing or
any pack fails.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LTTng 2.15+ records CTF 2 (JSON metadata) by default, which the TSDL parser could not read. Add a CTF 2 metadata parser that maps CTF 2 field classes onto the existing descriptor model, and select the parser from the metadata content.
Also fix issues that CTF 2 / multi-channel LTTng traces exposed: