libside.git
5 days agoC/C++ API: Set empty attribute list to NULL master
Olivier Dion [Fri, 15 Nov 2024 17:26:40 +0000 (12:26 -0500)] 
C/C++ API: Set empty attribute list to NULL

If a list of attributes is empty, the compiler will assign an address
even though the object has a zero size. This address often aliases with
other objects and can not be interpreted as an attribute.

To help prevent user confusion when printing side attributes from a
debugger, set the attribute pointer to NULL when no attributes are
present.

Change-Id: I955b94b0ede00fc703b7145c1b7a39704ed43bae
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 days agoAPI: Fix definitions of side_type_gather{array,vla}
Olivier Dion [Fri, 15 Nov 2024 15:05:16 +0000 (10:05 -0500)] 
API: Fix definitions of side_type_gather{array,vla}

Element types must not be expanded yet.  Passing them through
`__VA_ARGS__' results in failed compilation.  Fix this by explicitly
dispatching arguments to implementation macros and wrapping element
types with `SIDE_PARAM'.

Change-Id: I87d6ea54b660e35ccd83be147bc02d17f4f0955f
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 weeks agoFix libside.pc name and description
Olivier Dion [Mon, 4 Nov 2024 18:34:50 +0000 (13:34 -0500)] 
Fix libside.pc name and description

These were copied from RSEQ and not changed.

Change-Id: I02cfb80cbea5e4646071340f04cd4529f2d8a464
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoStatic checker: Separate fields names checks
Olivier Dion [Fri, 25 Oct 2024 16:58:50 +0000 (12:58 -0400)] 
Static checker: Separate fields names checks

Separate the invocations of null and duplicated fields names checks.

Change-Id: I5bf8f43ff0957a440ba9785877ff19a44a6abd97
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoAdd tests without static checker enabled
Olivier Dion [Fri, 25 Oct 2024 16:16:32 +0000 (12:16 -0400)] 
Add tests without static checker enabled

Change-Id: I885fc14e49b29061b843729e10142ff9bd518732
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoAdd SIDE_STATIC_CHECK_DISABLE_DUPLICATED_FIELDS
Olivier Dion [Fri, 25 Oct 2024 16:12:31 +0000 (12:12 -0400)] 
Add SIDE_STATIC_CHECK_DISABLE_DUPLICATED_FIELDS

New tunable for the static checker that can be #define/#undef around
code where the static checking of duplicated/null fields is disabled.

Change-Id: I4cf51561d0a21f59b8577813d7aa1b9b0fc789a8
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoFix static checker test include dir
Mathieu Desnoyers [Thu, 24 Oct 2024 21:36:52 +0000 (17:36 -0400)] 
Fix static checker test include dir

Now works even if libside is not installed in the system.

Change-Id: Ide06e6087cce2b2658d1166f23a8cd61dc2f68af
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agostatic checker: Make static checker opt-out rather than opt-in
Mathieu Desnoyers [Thu, 24 Oct 2024 21:05:40 +0000 (17:05 -0400)] 
static checker: Make static checker opt-out rather than opt-in

Users must explicitly define SIDE_STATIC_CHECK_DISABLE to opt-out from
the libside static checker.

Change-Id: I517303e03d124a94000c2f974c9e55ab646bc87e
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agostatic checker: add side_statedump_event_call and side_statedump_event_call_variadic
Mathieu Desnoyers [Thu, 24 Oct 2024 21:04:32 +0000 (17:04 -0400)] 
static checker: add side_statedump_event_call and side_statedump_event_call_variadic

Add side_statedump_event_call and side_statedump_event_call_variadic to
the static checker. This will allow enabling the static checker by
default (opt-out).

Change-Id: Ie61a90af5911b7abe21037caa0e22630e1ae753c
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoAdd static checker tests
Olivier Dion [Wed, 23 Oct 2024 18:46:05 +0000 (14:46 -0400)] 
Add static checker tests

The static checkers ought to work with unit tests.  Therefore, adding
`*-sc*' variants for `test.c' and `test-cxx.  This only test valid
inputs.

Invalid inputs are tested under `tests/static-checker'.  Files can be
written with invalid DSL usage and added
`tests/static-checker/run-tests'.

Change-Id: Iac5419bfb846d4272ed02ba9c5d1377467e85684
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoAdd static checker
Olivier Dion [Tue, 3 Sep 2024 18:27:58 +0000 (14:27 -0400)] 
Add static checker

For supporting the static checker, all macros part of the Domain
Specific Language (DSL) of libside must be defined with a level of
indirection.

`<side/static-check.h>', is included by `<side/api.h>' when
`SIDE_STATIC_CHECK_ENABLE' is defined.  The whole DSL is undefined and
redefined with a dispatching technique.  See the comments in the file
for details on how this works.

The static checker works by defining dummy C type and letting the
compiler found incompatible types at event definitions and call sites.

Change-Id: I7535a4829a6381039e66850ad825b9918626755d
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoChange SIDE_ACCEPT_COMMA() to SIDE_EXPECT_SEMICOLLON()
Olivier Dion [Thu, 24 Oct 2024 20:18:35 +0000 (16:18 -0400)] 
Change SIDE_ACCEPT_COMMA() to SIDE_EXPECT_SEMICOLLON()

Change-Id: I8762f6aca32418cc200bfa4f5a04b6159781fb5b
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoAdd missing side_type for C native types
Olivier Dion [Thu, 24 Oct 2024 16:42:47 +0000 (12:42 -0400)] 
Add missing side_type for C native types

Change-Id: Ie2535b70e09ca59f32ef690d2f34f1e3b1f61d37
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoAdd attributes to optional types
Olivier Dion [Thu, 24 Oct 2024 16:14:12 +0000 (12:14 -0400)] 
Add attributes to optional types

Change-Id: I3297006a806ec929a809dc09caca2cccbb99b96f
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoFix double referencing of SIDE_TYPE_OPTIONAL
Olivier Dion [Thu, 24 Oct 2024 15:43:33 +0000 (11:43 -0400)] 
Fix double referencing of SIDE_TYPE_OPTIONAL

An optional type was a pointer to a `struct side_type'.  This results in
having OPTIONAL -> OPTIONAL -> TYPE when defining an optional.

Fix this by defining a `struct side_type_optional' that has a pointer to
a `struct side_type', just like other containers.

Change-Id: I4100fad7485d309e4f3ba798227eac0694fcc294
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoRefactor side_visit_type
Olivier Dion [Thu, 24 Oct 2024 15:11:00 +0000 (11:11 -0400)] 
Refactor side_visit_type

Seperate the visiting of types and comparison testing.

Change-Id: I85f43957ebc7bbc7bbb564d438141fccf4476510
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoDon't abort on unknown type label
Olivier Dion [Thu, 24 Oct 2024 15:09:25 +0000 (11:09 -0400)] 
Don't abort on unknown type label

When a mismatch is detected by the visitor, type label are converted
to string to help debugging.  On unknown label, instead of aborting
during the error dump, return `<UNKNOWN>'.

Also added missing `SIDE_TYPE_OPTIONAL' case.

Change-Id: Ia654c1a293c8a033a15aed3c9fe6473182cbc018
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 weeks agoSeparate API definition from implementation
Olivier Dion [Tue, 3 Sep 2024 18:27:58 +0000 (14:27 -0400)] 
Separate API definition from implementation

The new file `<side/api.h>' defines the DSL and expands to its
implementation in `<side/instrumentation-c-api.h>'.

Introduce the following DSL change: identifiers defined by
`side_{arg,}_define_{array,struct,vla,enum,variant,optional}'
must not be rereferenced with the `&' operator, but simply by their
name.

Change-Id: I883de215000e10abfbd27c93fddba3bae3abf5b2
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoMake all container types pointers
Olivier Dion [Wed, 23 Oct 2024 13:16:50 +0000 (09:16 -0400)] 
Make all container types pointers

Array and VLA were not pointers in `struct side_type' like other
container types such as struct and variant. Make those pointers to
ensure container types are all similar.

API change (user-visible): This prevents defining array and VLA fields
inline. That is, it is now necessary to define the array/VLA type
before referencing it in a field.

Change-Id: Ia3634a40514d827cb23ce242fb6bd05c7c583e34
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoAdd optional type
Olivier Dion [Tue, 15 Oct 2024 16:27:50 +0000 (12:27 -0400)] 
Add optional type

The `SIDE_TYPE_OPTIONAL' denotes a field that can be absent from the
trace.  Such field has no attribute.  Instead, the optional type is
simply a pointer to another type.

The determination of absence for an optional field is determined by the
`selector' member of the `side_arg_optional' structure, which must be
the constant value `SIDE_OPTIONAL_ENABLED' if the field is present,
otherwise `SIDE_OPTION_DISABLED'.

Change-Id: Ie23bcac27efef66938981d59b715a950465ede75
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoAdd test cxx to gitignore
Mathieu Desnoyers [Wed, 23 Oct 2024 15:42:08 +0000 (11:42 -0400)] 
Add test cxx to gitignore

Change-Id: I09ddf58825a2467bfac0f7bf715ffa3738818cc8
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoAdd contextual description on failed runtime check
Olivier Dion [Tue, 20 Aug 2024 22:31:31 +0000 (18:31 -0400)] 
Add contextual description on failed runtime check

The following is an example of error output emitted before aborting:

================================================================================
                                 ERROR!
Type mismatch between description and arguments
Expecting `SIDE_TYPE_U32' but got `SIDE_TYPE_U64' in:

myprovider:myevent
        field: "abc"
================================================================================
Aborted

Change-Id: I695cafe59a92970f7c51ec894eb02fc0008c1c64
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoAdd C++ unit test
Olivier Dion [Mon, 19 Aug 2024 17:36:08 +0000 (13:36 -0400)] 
Add C++ unit test

Change-Id: I79e850e40b4e7d97f859b7ada8f1f6708ca3395f
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoSupport Clang
Olivier Dion [Mon, 7 Oct 2024 16:22:03 +0000 (12:22 -0400)] 
Support Clang

Most of the warnings emitted where due to either gcc extension or C99
extension used in C++.  Turn-off these warnings by using _Pragma.

Change-Id: I0421d888154df1a98543cc0c0fb7e4b448d25da1
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoIntroduce dynamic compound literal
Olivier Dion [Mon, 7 Oct 2024 16:11:42 +0000 (12:11 -0400)] 
Introduce dynamic compound literal

In C++, compound literal are temporary objects which have a lifetime
bound to its expression.  To extend the lifetime of such objects, the
`SIDE_DYNAMIC_COMPOUND_LITERAL' macro is introduced.

In C, this macro expands to `SIDE_COMPOUND_LITERAL'.  In C++, it
allocates the necessary size to store the object onto the stack using
`alloca(3)'.  The memory is then initialized by copying the expression
to it.

This is necessary for attributes of dynamic fields.  However,
`SIDE_DYNAMIC_COMPOUND_LITERAL' only return a pointer to the object and
not its size.  To overcome this, the API is changed and the
`side_dynamic_attr_list()' macro must be used on dynamic arguments of
dynamic fields.  The macro itself is not defined by libside.  Instead,
macro dispatching is done to get the pointer to the object and its size.

Change-Id: Ieddaa6b2209c03031cef916033efd57564229db5
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoMake it compatible with C++
Olivier Dion [Mon, 19 Aug 2024 17:35:41 +0000 (13:35 -0400)] 
Make it compatible with C++

The main change are for initialization order of compound literal.  Other
changes include:

  - Initialization of zero size member (char end [0]),

  - Declaration of events in anonymous namespace for circular dependency
    of static variables.

Change-Id: Icb99c22a7df313ecb0e31a8d96ea6e9ec00cffed
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 weeks agoAdd C native types macro helpers
Olivier Dion [Tue, 6 Aug 2024 21:09:48 +0000 (17:09 -0400)] 
Add C native types macro helpers

The SIDE ABI specifies fixed sizes integers and floating points.
However, as a convenience for C/C++, the SIDE C API supports C native
types (e.g. char) which are translated to their equivalent.

Note that the translation of C native types is toolchain dependent and
therefore could produce different results.

The main use case is for auto-generating SIDE events for public API of
shared libraries.

Change-Id: I845f0dd42ba2dc2de1f540f751e9cd65aa4a8c98
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 weeks agoReplace side_event_cond by side_event_enabled
Mathieu Desnoyers [Wed, 9 Oct 2024 17:20:22 +0000 (13:20 -0400)] 
Replace side_event_cond by side_event_enabled

This will allow users to test for side_event_enabled in scenario where
they wish to early return rather than conditionally do something.

Change-Id: I054f8087afaf40447949a1fbab37bef2c343da19
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 weeks agoAdd missing public header files for installation
Olivier Dion [Wed, 7 Aug 2024 14:23:06 +0000 (10:23 -0400)] 
Add missing public header files for installation

Change-Id: Idc490bb09826d999f49d2cfdb9111df67b3c2d3a
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoRemove specification draft
Mathieu Desnoyers [Mon, 5 Aug 2024 13:52:22 +0000 (09:52 -0400)] 
Remove specification draft

The SIDE specification is moved to https://git.efficios.com/side-spec.git

Change-Id: I65b14b0b3a87bcd246d91f701aa63a25ea324ce5
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoRename RFC document to SIDE-SPECRC-1.0.md
Mathieu Desnoyers [Tue, 30 Jul 2024 15:42:13 +0000 (11:42 -0400)] 
Rename RFC document to SIDE-SPECRC-1.0.md

Change-Id: Ie0b78aa30d62ffa442eabd313f4d0087403f1a74
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoUpdate side spec
Mathieu Desnoyers [Tue, 30 Jul 2024 15:40:49 +0000 (11:40 -0400)] 
Update side spec

Change-Id: Iecf9193956440888b7f71f508ba4ade6113fe8a8
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoAdd missing license and copyright headers
Michael Jeanson [Tue, 23 Jul 2024 15:25:02 +0000 (11:25 -0400)] 
Add missing license and copyright headers

Also convert rfc-side-abi.txt to markdown, it was already almost valid
and allows licensing comments.

Change-Id: Ide55ddda455c20509c4b02258f93eef7daf434e9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoUpdate autotools archive macros
Michael Jeanson [Mon, 3 Jul 2023 18:20:14 +0000 (14:20 -0400)] 
Update autotools archive macros

Change-Id: Id845d45a0bd13e504a250db3720e6259ac513d68
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoAdd git-review config
Michael Jeanson [Tue, 23 Jul 2024 20:21:50 +0000 (16:21 -0400)] 
Add git-review config

Add .gitreview for contributors wishing to use gerrit for patch
reviews.

Change-Id: I1eb09fe09c54100100c99f893f775c7d26229686
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoAdd key characteristics to rfc
Mathieu Desnoyers [Tue, 28 May 2024 19:46:19 +0000 (15:46 -0400)] 
Add key characteristics to rfc

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoClarify TODO for user events integration
Mathieu Desnoyers [Thu, 23 May 2024 19:12:25 +0000 (15:12 -0400)] 
Clarify TODO for user events integration

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoRemove enum before/after for description visitor
Mathieu Desnoyers [Wed, 22 May 2024 19:55:16 +0000 (15:55 -0400)] 
Remove enum before/after for description visitor

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoRemove enum before/after for arg vec visitor
Mathieu Desnoyers [Wed, 22 May 2024 19:26:01 +0000 (15:26 -0400)] 
Remove enum before/after for arg vec visitor

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoIntroduce event/type description visitor
Mathieu Desnoyers [Wed, 22 May 2024 18:40:16 +0000 (14:40 -0400)] 
Introduce event/type description visitor

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agopretty print tracer: Use argument vector visitor
Mathieu Desnoyers [Thu, 16 May 2024 19:26:56 +0000 (15:26 -0400)] 
pretty print tracer: Use argument vector visitor

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoIntroduce argument vector visitor
Mathieu Desnoyers [Thu, 16 May 2024 19:26:47 +0000 (15:26 -0400)] 
Introduce argument vector visitor

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agopretty print: do not print 2 levels of brackets for variant
Mathieu Desnoyers [Thu, 16 May 2024 19:18:43 +0000 (15:18 -0400)] 
pretty print: do not print 2 levels of brackets for variant

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agopretty print tracer: use { } for structures and fields
Mathieu Desnoyers [Thu, 16 May 2024 18:39:52 +0000 (14:39 -0400)] 
pretty print tracer: use { } for structures and fields

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agopretty print tracer: add missing comma in caller printout
Mathieu Desnoyers [Thu, 16 May 2024 18:35:03 +0000 (14:35 -0400)] 
pretty print tracer: add missing comma in caller printout

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agopretty-print tracer: cleanup dynamic {} and remove caller addr
Mathieu Desnoyers [Thu, 16 May 2024 18:31:28 +0000 (14:31 -0400)] 
pretty-print tracer: cleanup dynamic {} and remove caller addr

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoFix: tracer: utf16/32 gather types handling
Mathieu Desnoyers [Wed, 15 May 2024 14:34:46 +0000 (10:34 -0400)] 
Fix: tracer: utf16/32 gather types handling

tracer_convert_string_to_utf8 should return the size of the input
(including null terminator) rather than the size of the utf8 output.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoUpdate rfc
Mathieu Desnoyers [Fri, 10 May 2024 18:10:26 +0000 (14:10 -0400)] 
Update rfc

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoRename rfc-libside.txt to rfc-side-abi.txt
Mathieu Desnoyers [Fri, 10 May 2024 15:22:51 +0000 (11:22 -0400)] 
Rename rfc-libside.txt to rfc-side-abi.txt

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoUpdate libside RFC
Mathieu Desnoyers [Fri, 10 May 2024 15:21:33 +0000 (11:21 -0400)] 
Update libside RFC

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoUpdate libside rfc
Mathieu Desnoyers [Wed, 8 May 2024 20:11:25 +0000 (16:11 -0400)] 
Update libside rfc

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoAdd libside RFC
Mathieu Desnoyers [Wed, 8 May 2024 20:09:14 +0000 (16:09 -0400)] 
Add libside RFC

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agofix: handle EINTR correctly in get_cpu_mask_from_sysfs
Mathieu Desnoyers [Thu, 2 May 2024 14:44:36 +0000 (10:44 -0400)] 
fix: handle EINTR correctly in get_cpu_mask_from_sysfs

If the read() in get_cpu_mask_from_sysfs() fails with EINTR, the code is
supposed to retry, but the while loop condition has (bytes_read > 0),
which is false when read() fails with EINTR. The result is that the code
exits the loop, having only read part of the string.

Use (bytes_read != 0) in the while loop condition instead, since the
(bytes_read < 0) case is already handled in the loop.

Original fix in liburcu from Benjamin Marzinski <bmarzins@redhat.com>:

  commit 9922f33e2986 ("fix: handle EINTR correctly in get_cpu_mask_from_sysfs")

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoside: Introduce caller address
Mathieu Desnoyers [Tue, 23 Apr 2024 19:36:03 +0000 (15:36 -0400)] 
side: Introduce caller address

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoside: explicit statedump request key
Mathieu Desnoyers [Tue, 23 Apr 2024 15:46:54 +0000 (11:46 -0400)] 
side: explicit statedump request key

Make the statedump request key explicit rather than hiding it as a
Thread-Local Storage variable within libside. It's type is still opaque
to the application (void *), but this allows schemes where the statedump
callbacks are not required to emit statedump events from the same
thread: it can pass the statedump_request_key to another thread
responsible for emitting those events.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agorcu: Update following librseq public API updates
Mathieu Desnoyers [Tue, 23 Apr 2024 15:48:56 +0000 (11:48 -0400)] 
rcu: Update following librseq public API updates

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoCleanup function argument alignment
Mathieu Desnoyers [Tue, 23 Apr 2024 15:45:28 +0000 (11:45 -0400)] 
Cleanup function argument alignment

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 months agoImplement side_cpu_relax for x86
Mathieu Desnoyers [Mon, 19 Feb 2024 18:58:55 +0000 (13:58 -0500)] 
Implement side_cpu_relax for x86

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 months agoDocument application fork/clone vs statedump locking limitations
Mathieu Desnoyers [Mon, 19 Feb 2024 18:28:53 +0000 (13:28 -0500)] 
Document application fork/clone vs statedump locking limitations

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 months agoHandle statedump agent thread state across fork
Mathieu Desnoyers [Mon, 19 Feb 2024 18:19:43 +0000 (13:19 -0500)] 
Handle statedump agent thread state across fork

Implement pthread_atfork handlers to deal with statedump agent thread
state across fork.

For glibc, this requires glibc 2.24 or more recent.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 months agoImplement agent thread wakeup scheme with pthread cond var
Mathieu Desnoyers [Fri, 22 Dec 2023 20:03:07 +0000 (15:03 -0500)] 
Implement agent thread wakeup scheme with pthread cond var

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 months agoImplement agent thread
Mathieu Desnoyers [Fri, 22 Dec 2023 18:29:16 +0000 (13:29 -0500)] 
Implement agent thread

Currently uses 1 second polling for state. To be replaced by a proper
wait/wakeup.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 months agolist: fix safe list iteration
Mathieu Desnoyers [Fri, 22 Dec 2023 18:28:07 +0000 (13:28 -0500)] 
list: fix safe list iteration

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 months agoStatedump improvements
Mathieu Desnoyers [Fri, 22 Dec 2023 17:00:55 +0000 (12:00 -0500)] 
Statedump improvements

- Introduce polling vs agent thread statedump callbacks,
- Use uint64_t for tracer key.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoExtend statedump API
Mathieu Desnoyers [Mon, 18 Dec 2023 21:37:08 +0000 (16:37 -0500)] 
Extend statedump API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoIntroduce side ptrace hook
Mathieu Desnoyers [Mon, 18 Dec 2023 18:29:19 +0000 (13:29 -0500)] 
Introduce side ptrace hook

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoUse RCU for statedump
Mathieu Desnoyers [Mon, 18 Dec 2023 15:16:39 +0000 (10:16 -0500)] 
Use RCU for statedump

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoAdd rculist
Mathieu Desnoyers [Mon, 18 Dec 2023 14:49:55 +0000 (09:49 -0500)] 
Add rculist

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoIntroduce list_types.h
Mathieu Desnoyers [Mon, 18 Dec 2023 14:28:00 +0000 (09:28 -0500)] 
Introduce list_types.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoImplement statedump unit test
Mathieu Desnoyers [Fri, 15 Dec 2023 21:44:47 +0000 (16:44 -0500)] 
Implement statedump unit test

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoImplement statedump request notifications
Mathieu Desnoyers [Fri, 15 Dec 2023 20:53:02 +0000 (15:53 -0500)] 
Implement statedump request notifications

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoUse TLS variable for key state
Mathieu Desnoyers [Fri, 15 Dec 2023 20:17:25 +0000 (15:17 -0500)] 
Use TLS variable for key state

Keep this hidden from the application.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoAdd "key" to callback registration
Mathieu Desnoyers [Fri, 15 Dec 2023 19:17:00 +0000 (14:17 -0500)] 
Add "key" to callback registration

This is in preparation to support the state-dump feature.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoUpdate gitignore
Mathieu Desnoyers [Fri, 15 Dec 2023 16:29:06 +0000 (11:29 -0500)] 
Update gitignore

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRemove backup file
Mathieu Desnoyers [Fri, 15 Dec 2023 16:26:33 +0000 (11:26 -0500)] 
Remove backup file

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoAdd indirection for visitor arguments
Mathieu Desnoyers [Mon, 11 Dec 2023 16:23:10 +0000 (11:23 -0500)] 
Add indirection for visitor arguments

In order to keep the argument vector const, add an indirection for
visitor arguments to a non-const area of memory, which is clearly
documented as modified by libside.

Add a "cached_arg" placeholder pointer to the visitor structures.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoImplement 128-bit integer support
Mathieu Desnoyers [Wed, 6 Dec 2023 15:57:17 +0000 (10:57 -0500)] 
Implement 128-bit integer support

TODO in tracer example: Implement 128-bit integer with len_bits != 128
or nonzero offset_bit.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoAPI: Add 128-bit integer support
Mathieu Desnoyers [Mon, 4 Dec 2023 16:47:53 +0000 (11:47 -0500)] 
API: Add 128-bit integer support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoAdd __int128 support
Mathieu Desnoyers [Mon, 4 Dec 2023 16:47:34 +0000 (11:47 -0500)] 
Add __int128 support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoInteger 128 split byte order helpers
Mathieu Desnoyers [Mon, 4 Dec 2023 14:51:43 +0000 (09:51 -0500)] 
Integer 128 split byte order helpers

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRevert "Remove const on all side_arg"
Mathieu Desnoyers [Fri, 1 Dec 2023 21:58:53 +0000 (16:58 -0500)] 
Revert "Remove const on all side_arg"

This reverts commit 511ee756cf8aa9259489b4386feb2911bb58c20a.

Re-introduce constness of side_arg to ensure that side_calls are pure.

This will facilitate integration with various runtimes and eliminate
corner-cases.

We plan on copying side argument vectors within libside when translating
from visitor types to flattened types.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoUse zero-sized array as last field of event description
Mathieu Desnoyers [Fri, 1 Dec 2023 21:55:45 +0000 (16:55 -0500)] 
Use zero-sized array as last field of event description

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoAdd u128/s128 integer to ABI
Mathieu Desnoyers [Fri, 1 Dec 2023 21:46:45 +0000 (16:46 -0500)] 
Add u128/s128 integer to ABI

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoAPI: Intitialize arg flags to 0
Mathieu Desnoyers [Fri, 1 Dec 2023 15:13:52 +0000 (10:13 -0500)] 
API: Intitialize arg flags to 0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoABI: Introduce incomplete type flag
Mathieu Desnoyers [Fri, 1 Dec 2023 15:13:35 +0000 (10:13 -0500)] 
ABI: Introduce incomplete type flag

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRemove const on all side_arg
Mathieu Desnoyers [Thu, 30 Nov 2023 21:24:19 +0000 (16:24 -0500)] 
Remove const on all side_arg

Remove const from side_arg and types containing a side_arg so they can
be altered by libside for visitor caching.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRemove packed from visitor ABI
Mathieu Desnoyers [Fri, 24 Nov 2023 22:40:32 +0000 (17:40 -0500)] 
Remove packed from visitor ABI

The visitor ABI is a contract between instrumented applications and
userspace tracers only, and follows C calling convention, so packing
those data structures serve no purpose.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoMove side_callback to libside internals
Mathieu Desnoyers [Fri, 24 Nov 2023 22:29:26 +0000 (17:29 -0500)] 
Move side_callback to libside internals

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRemove packed from struct side_callback
Mathieu Desnoyers [Fri, 24 Nov 2023 21:55:03 +0000 (16:55 -0500)] 
Remove packed from struct side_callback

This is internal to libside.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRename side state "p" field to "parent"
Mathieu Desnoyers [Fri, 24 Nov 2023 21:07:40 +0000 (16:07 -0500)] 
Rename side state "p" field to "parent"

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoMove nr_callbacks to event state
Mathieu Desnoyers [Fri, 24 Nov 2023 20:56:47 +0000 (15:56 -0500)] 
Move nr_callbacks to event state

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoUse uintptr_t for enabled state to eliminate partial register stalls
Mathieu Desnoyers [Fri, 24 Nov 2023 20:51:40 +0000 (15:51 -0500)] 
Use uintptr_t for enabled state to eliminate partial register stalls

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoside event state does not need side_ptr_t
Mathieu Desnoyers [Fri, 24 Nov 2023 20:43:08 +0000 (15:43 -0500)] 
side event state does not need side_ptr_t

This is not relevant for tracers: only between instrumented application
and libside.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRemove event state abi version validation from tracer
Mathieu Desnoyers [Fri, 24 Nov 2023 20:17:39 +0000 (15:17 -0500)] 
Remove event state abi version validation from tracer

This is internal to libside.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoDocument ABI extensibility schemes
Mathieu Desnoyers [Fri, 24 Nov 2023 20:14:06 +0000 (15:14 -0500)] 
Document ABI extensibility schemes

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoMove ABI headers under side/abi/
Mathieu Desnoyers [Fri, 24 Nov 2023 19:14:44 +0000 (14:14 -0500)] 
Move ABI headers under side/abi/

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoRemove unneeded fwd declaration
Mathieu Desnoyers [Fri, 24 Nov 2023 17:10:27 +0000 (12:10 -0500)] 
Remove unneeded fwd declaration

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoSplit trace.h into API/ABI sub-headers
Mathieu Desnoyers [Fri, 24 Nov 2023 17:07:57 +0000 (12:07 -0500)] 
Split trace.h into API/ABI sub-headers

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoIntroduce event state ABI version
Mathieu Desnoyers [Thu, 23 Nov 2023 22:36:09 +0000 (17:36 -0500)] 
Introduce event state ABI version

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 months agoExtensible struct side_event_state
Mathieu Desnoyers [Thu, 23 Nov 2023 22:06:06 +0000 (17:06 -0500)] 
Extensible struct side_event_state

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.03865 seconds and 4 git commands to generate.