2 * SPDX-License-Identifier: MIT
4 * Copyright (c) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 * Babeltrace - Debug info utilities
11 #include <babeltrace2/babeltrace.h>
13 #include "debug-info.h"
17 const char *get_filename_from_path(const char *path
)
19 size_t i
= strlen(path
);
25 if (path
[i
- 1] == '/') {
27 * Path ends with a trailing slash, no filename to return.
28 * Return the original path.
44 bt_bool
is_event_common_ctx_dbg_info_compatible(const bt_field_class
*in_field_class
,
45 const char *debug_info_field_class_name
)
47 const bt_field_class_structure_member
*member
;
48 const bt_field_class
*ip_fc
, *vpid_fc
;
49 bt_bool match
= BT_FALSE
;
52 * If the debug info field is already present in the event common
53 * context. Do not try to add it.
56 bt_field_class_structure_borrow_member_by_name_const(
57 in_field_class
, debug_info_field_class_name
);
63 * Verify that the ip and vpid field are present and of the right field
66 member
= bt_field_class_structure_borrow_member_by_name_const(
67 in_field_class
, IP_FIELD_NAME
);
72 ip_fc
= bt_field_class_structure_member_borrow_field_class_const(
74 if (bt_field_class_get_type(ip_fc
) !=
75 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
) {
80 member
= bt_field_class_structure_borrow_member_by_name_const(
81 in_field_class
, VPID_FIELD_NAME
);
86 vpid_fc
= bt_field_class_structure_member_borrow_field_class_const(
89 if (bt_field_class_get_type(vpid_fc
) !=
90 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
) {
94 if (bt_field_class_integer_get_field_value_range(vpid_fc
) != 32) {