doc/api/libbabeltrace2/DoxygenLayout.xml: use `topics` tab
[babeltrace.git] / src / plugins / lttng-utils / debug-info / debug-info.c
index fe3424146fe3b719a79ac7d2247d77c560cdb465..f8ef8182942cc161d0dc2b353c72db2390a9380d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Babeltrace - Debug Information State Tracker
+ * SPDX-License-Identifier: MIT
  *
  * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
  * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
@@ -7,23 +7,7 @@
  * Copyright (c) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  * Copyright (c) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Babeltrace - Debug Information State Tracker
  */
 
 #define BT_COMP_LOG_SELF_COMP self_comp
 
 #define DEFAULT_DEBUG_INFO_FIELD_NAME  "debug_info"
 #define LTTNG_UST_STATEDUMP_PREFIX     "lttng_ust"
-#define VPID_FIELD_NAME                        "vpid"
-#define IP_FIELD_NAME                  "ip"
-#define BADDR_FIELD_NAME               "baddr"
-#define CRC32_FIELD_NAME               "crc"
-#define BUILD_ID_FIELD_NAME            "build_id"
-#define FILENAME_FIELD_NAME            "filename"
-#define IS_PIC_FIELD_NAME              "is_pic"
-#define MEMSZ_FIELD_NAME               "memsz"
-#define PATH_FIELD_NAME                        "path"
 
 struct debug_info_component {
        bt_logging_level log_level;
@@ -74,7 +49,7 @@ struct debug_info_msg_iter {
        struct debug_info_component *debug_info_component;
        bt_self_message_iterator *input_iterator;
        bt_self_component *self_comp;
-       bt_self_component_port_input_message_iterator *msg_iter;
+       bt_message_iterator *msg_iter;
 
        struct trace_ir_maps *ir_maps;
        /* in_trace -> debug_info_mapping. */
@@ -213,7 +188,7 @@ struct debug_info_source *debug_info_source_create_from_bin(
                        g_strdup_printf("%"PRId64, src_loc->line_no);
                if (!debug_info_src->line_no) {
                        BT_COMP_LOGE_APPEND_CAUSE(self_comp,
-                               "Error occured when setting `line_no` field.");
+                               "Error occurred when setting `line_no` field.");
                        goto error;
                }
 
@@ -931,7 +906,7 @@ void handle_event_statedump(struct debug_info_msg_iter *debug_it,
        } else if (q_event_name == debug_info->q_statedump_build_id) {
                /* Build ID info */
                handle_event_statedump_build_id(debug_info, event);
-       } else if (q_event_name == debug_info-> q_lib_unload) {
+       } else if (q_event_name == debug_info->q_lib_unload) {
                handle_event_lib_unload(debug_info, event);
        }
 
@@ -1535,8 +1510,7 @@ end:
 }
 
 static
-bt_message *handle_msg_iterator_inactivity(struct debug_info_msg_iter *debug_it,
-               const bt_message *in_message)
+bt_message *handle_msg_iterator_inactivity(const bt_message *in_message)
 {
        /*
         * This message type can be forwarded directly because it does
@@ -1689,7 +1663,7 @@ const bt_message *handle_message(struct debug_info_msg_iter *debug_it,
                out_message = handle_stream_end_message(debug_it, in_message);
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               out_message = handle_msg_iterator_inactivity(debug_it, in_message);
+               out_message = handle_msg_iterator_inactivity(in_message);
                break;
        case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
                out_message = handle_discarded_events_message(debug_it, in_message);
@@ -1781,11 +1755,10 @@ end:
        return status;
 }
 
-BT_HIDDEN
 bt_component_class_initialize_method_status debug_info_comp_init(
                bt_self_component_filter *self_comp_flt,
-               bt_self_component_filter_configuration *config,
-               const bt_value *params, __attribute__((unused)) void *init_method_data)
+               bt_self_component_filter_configuration *config __attribute__((unused)),
+               const bt_value *params, void *init_method_data __attribute__((unused)))
 {
        struct debug_info_component *debug_info_comp;
        bt_component_class_initialize_method_status status =
@@ -1847,7 +1820,6 @@ end:
        return status;
 }
 
-BT_HIDDEN
 void debug_info_comp_finalize(bt_self_component_filter *self_comp_flt)
 {
        struct debug_info_component *debug_info =
@@ -1863,13 +1835,12 @@ void debug_info_comp_finalize(bt_self_component_filter *self_comp_flt)
        destroy_debug_info_comp(debug_info);
 }
 
-BT_HIDDEN
 bt_message_iterator_class_next_method_status debug_info_msg_iter_next(
                bt_self_message_iterator *self_msg_iter,
                const bt_message_array_const msgs, uint64_t capacity,
                uint64_t *count)
 {
-       bt_self_component_port_input_message_iterator *upstream_iterator = NULL;
+       bt_message_iterator *upstream_iterator = NULL;
        bt_message_iterator_next_status upstream_iterator_ret_status;
        struct debug_info_msg_iter *debug_info_msg_iter;
        struct debug_info_component *debug_info = NULL;
@@ -1894,7 +1865,7 @@ bt_message_iterator_class_next_method_status debug_info_msg_iter_next(
        BT_ASSERT_DBG(upstream_iterator);
 
        upstream_iterator_ret_status =
-               bt_self_component_port_input_message_iterator_next(
+               bt_message_iterator_next(
                        upstream_iterator, &input_msgs, count);
        if (upstream_iterator_ret_status !=
                        BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) {
@@ -1961,7 +1932,7 @@ void debug_info_msg_iter_destroy(struct debug_info_msg_iter *debug_info_msg_iter
        }
 
        if (debug_info_msg_iter->msg_iter) {
-               bt_self_component_port_input_message_iterator_put_ref(
+               bt_message_iterator_put_ref(
                        debug_info_msg_iter->msg_iter);
        }
 
@@ -1980,21 +1951,21 @@ end:
        return;
 }
 
-BT_HIDDEN
 bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init(
                bt_self_message_iterator *self_msg_iter,
                bt_self_message_iterator_configuration *config,
-               bt_self_component *self_comp,
-               bt_self_component_port_output *self_port)
+               bt_self_component_port_output *self_port __attribute__((unused)))
 {
        bt_message_iterator_class_initialize_method_status status;
-       bt_self_component_port_input_message_iterator_create_from_message_iterator_status
+       bt_message_iterator_create_from_message_iterator_status
                msg_iter_status;
        struct bt_self_component_port_input *input_port = NULL;
-       bt_self_component_port_input_message_iterator *upstream_iterator = NULL;
+       bt_message_iterator *upstream_iterator = NULL;
        struct debug_info_msg_iter *debug_info_msg_iter = NULL;
        gchar *debug_info_field_name;
        int ret;
+       bt_self_component *self_comp =
+               bt_self_message_iterator_borrow_component(self_msg_iter);
        bt_logging_level log_level = bt_component_get_logging_level(
                bt_self_component_as_component(self_comp));
 
@@ -2020,14 +1991,14 @@ bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init(
        }
 
        /* Create an iterator on the upstream component. */
-       msg_iter_status = bt_self_component_port_input_message_iterator_create_from_message_iterator(
+       msg_iter_status = bt_message_iterator_create_from_message_iterator(
                self_msg_iter, input_port, &upstream_iterator);
-       if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
+       if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
                status = (int) msg_iter_status;
                goto error;
        }
 
-       BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+       BT_MESSAGE_ITERATOR_MOVE_REF(
                debug_info_msg_iter->msg_iter, upstream_iterator);
 
        /* Create hashtable that will contain debug info mapping. */
@@ -2056,7 +2027,7 @@ bt_message_iterator_class_initialize_method_status debug_info_msg_iter_init(
        }
 
        bt_self_message_iterator_configuration_set_can_seek_forward(config,
-               bt_self_component_port_input_message_iterator_can_seek_forward(
+               bt_message_iterator_can_seek_forward(
                        debug_info_msg_iter->msg_iter));
 
        bt_self_message_iterator_set_data(self_msg_iter, debug_info_msg_iter);
@@ -2072,7 +2043,6 @@ end:
        return status;
 }
 
-BT_HIDDEN
 bt_message_iterator_class_can_seek_beginning_method_status
 debug_info_msg_iter_can_seek_beginning(bt_self_message_iterator *self_msg_iter,
                bt_bool *can_seek)
@@ -2081,11 +2051,10 @@ debug_info_msg_iter_can_seek_beginning(bt_self_message_iterator *self_msg_iter,
                bt_self_message_iterator_get_data(self_msg_iter);
        BT_ASSERT(debug_info_msg_iter);
 
-       return (int) bt_self_component_port_input_message_iterator_can_seek_beginning(
+       return (int) bt_message_iterator_can_seek_beginning(
                debug_info_msg_iter->msg_iter, can_seek);
 }
 
-BT_HIDDEN
 bt_message_iterator_class_seek_beginning_method_status
 debug_info_msg_iter_seek_beginning(bt_self_message_iterator *self_msg_iter)
 {
@@ -2098,7 +2067,7 @@ debug_info_msg_iter_seek_beginning(bt_self_message_iterator *self_msg_iter)
        BT_ASSERT(debug_info_msg_iter);
 
        /* Ask the upstream component to seek to the beginning. */
-       seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning(
+       seek_beg_status = bt_message_iterator_seek_beginning(
                debug_info_msg_iter->msg_iter);
        if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) {
                status = (int) seek_beg_status;
@@ -2113,7 +2082,6 @@ end:
        return status;
 }
 
-BT_HIDDEN
 void debug_info_msg_iter_finalize(bt_self_message_iterator *it)
 {
        struct debug_info_msg_iter *debug_info_msg_iter;
This page took 0.027502 seconds and 4 git commands to generate.