flt.lttng-utils.debug-info: adapt debug-info component to API changes
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 19 Feb 2019 18:55:40 +0000 (13:55 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:38 +0000 (18:19 -0400)
commit58f6d595f244a048c5ca4d83a94e1f67af2e7890
treef37d2267f7e3ae23045a0f5710ccfdc04adea40c
parent1122415c8d0e87cdf3c844bb20c2159d10eb13a3
flt.lttng-utils.debug-info: adapt debug-info component to API changes

General idea
------------
Given that:
* debug-info filter component needs to add new fields to the
  events common context,
* Metadata and data objects are immutable after being added to
  the trace class or trace respectively.

The debug-info component needs output a new augmented trace containing
the new fields along side all the received input data. It thus needs to
act both as a sink AND a source of graph messages in the sense that it
consumes and creates graph messages.

For every message received, the corresponding output objects(e.g.
stream) are created in an output trace. Those objects are stored in
hashmaps corresponding to their types for later use. These hashmaps map
input object to their corresponding output objects.

For example, when handling a packet beginning message, we need to create
a new output packet. To do that, the corresponding output stream is
needed, amongst other things. This output stream was created earlier
when a stream beginning message was received and can be recovered from
the stream hashmap.

For each type of message received from the upstream iterator, we must
create a copy of that message and its corresponding trace IR objects,
and send it downstream. This is true for all but one message type,
inactivity messages can be forwarded directly as they are independent of
the data and metadata IR objects.

Implementation
--------------
This commit adds the concept of mapping between input and output objects
and implements copy functions to create (nearly) identical output
objects based on the input ones.

The entry point of the mapping of objects is the struct trace_id_maps
structure.

The metadata_map and data_map hashtables have input trace class and
input trace objects, respectively, as key and are pointing to struct
trace_ir_metadata_maps and struct trace_ir_data_maps. Each of the IR
object maps contained in these structs have the input object of their
specific types as key.

All input and mapped output objects are identical except for the stream
classes. Event-common-context of the stream classes needs to be modified
to include the debug-info fields if and only if the right fields
(instruction pointer (ip) and vpid) are present in the input stream
class.
Here are the objects kept in the mapping:
  - Trace class
  - Stream class
  - Event class
  - Clock class
  - Trace
  - Stream
  - Packet

The memory layout of each processes is kept up to date using the
lttng-ust-statedump and lib-load events. This information is then used
to resolve source locations based on ip and vpid values found in the
event-common-context of events.

Future Improvements
---------------------
Decoupling the trace-ir-mapping library from the debug-info component so
it can be used in other filter components.

Other fixes
-----------
- Don't resolve debug-info on build id mismatch
- When parsing the build id of a statedump event, confirm that it
  matches the one present on disk for that file.
- Prevent NULL pointer access of arg_debug_info_field_name
- Typo in the lttng_ust_statedump:debug_link event name.
- Typo in the crc field name of the lttng_ust_statedump:debug_link
  event.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
27 files changed:
configure.ac
plugins/Makefile.am
plugins/libctfcopytrace/Makefile.am [deleted file]
plugins/libctfcopytrace/clock-fields.c [deleted file]
plugins/libctfcopytrace/clock-fields.h [deleted file]
plugins/libctfcopytrace/ctfcopytrace.c [deleted file]
plugins/libctfcopytrace/ctfcopytrace.h [deleted file]
plugins/libctfcopytrace/logging.c [deleted file]
plugins/libctfcopytrace/logging.h [deleted file]
plugins/lttng-utils/Makefile.am
plugins/lttng-utils/bin-info.c
plugins/lttng-utils/bin-info.h
plugins/lttng-utils/copy.c [deleted file]
plugins/lttng-utils/copy.h [deleted file]
plugins/lttng-utils/debug-info.c
plugins/lttng-utils/debug-info.h
plugins/lttng-utils/plugin.c
plugins/lttng-utils/trace-ir-data-copy.c [new file with mode: 0644]
plugins/lttng-utils/trace-ir-data-copy.h [new file with mode: 0644]
plugins/lttng-utils/trace-ir-mapping.c [new file with mode: 0644]
plugins/lttng-utils/trace-ir-mapping.h [new file with mode: 0644]
plugins/lttng-utils/trace-ir-metadata-copy.c [new file with mode: 0644]
plugins/lttng-utils/trace-ir-metadata-copy.h [new file with mode: 0644]
plugins/lttng-utils/trace-ir-metadata-field-class-copy.c [new file with mode: 0644]
plugins/lttng-utils/trace-ir-metadata-field-class-copy.h [new file with mode: 0644]
plugins/lttng-utils/utils.c
plugins/lttng-utils/utils.h
This page took 0.027927 seconds and 4 git commands to generate.