* modules.
*/
static const char* log_level_env_var_names[] = {
- "BABELTRACE_FLT_LTTNG_UTILS_DEBUG_INFO_LOG_LEVEL",
"BABELTRACE_PLUGIN_CTF_BFCR_LOG_LEVEL",
"BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL",
"BABELTRACE_PLUGIN_CTF_MSG_ITER_LOG_LEVEL",
debug-info.h \
dwarf.c \
dwarf.h \
- logging.c \
- logging.h \
trace-ir-data-copy.c \
trace-ir-data-copy.h \
trace-ir-mapping.c \
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (bin->log_level)
#define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/BIN-INFO"
-#include "logging.h"
+#include "logging/log.h"
+#include <babeltrace2/logging.h>
#include <dwarf.h>
#include <errno.h>
#include <fcntl.h>
#define BUILD_ID_NOTE_NAME "GNU"
BT_HIDDEN
-int bin_info_init(void)
+int bin_info_init(bt_logging_level log_level)
{
int ret = 0;
if (elf_version(EV_CURRENT) == EV_NONE) {
- BT_LOGI("ELF library initialization failed: %s.",
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_INFO, log_level, BT_LOG_TAG,
+ "ELF library initialization failed: %s.",
elf_errmsg(-1));
ret = -1;
}
BT_HIDDEN
struct bin_info *bin_info_create(struct bt_fd_cache *fdc, const char *path,
uint64_t low_addr, uint64_t memsz, bool is_pic,
- const char *debug_info_dir, const char *target_prefix)
+ const char *debug_info_dir, const char *target_prefix,
+ bt_logging_level log_level)
{
struct bin_info *bin = NULL;
goto error;
}
+ bin->log_level = log_level;
if (target_prefix) {
bin->elf_path = g_build_filename(target_prefix, path, NULL);
} else {
* SOFTWARE.
*/
+#include <babeltrace2/logging.h>
#include <stdint.h>
#include <stdbool.h>
#include <gelf.h>
#define BUILD_ID_PREFIX_DIR_LEN 2
struct bin_info {
+ bt_logging_level log_level;
+
/* Base virtual memory address. */
uint64_t low_addr;
/* Upper bound of exec address space. */
* @returns 0 on success, -1 on failure
*/
BT_HIDDEN
-int bin_info_init(void);
+int bin_info_init(bt_logging_level log_level);
/**
* Instantiate a structure representing an ELF executable, possibly
BT_HIDDEN
struct bin_info *bin_info_create(struct bt_fd_cache *fdc, const char *path,
uint64_t low_addr, uint64_t memsz, bool is_pic,
- const char *debug_info_dir, const char *target_prefix);
+ const char *debug_info_dir, const char *target_prefix,
+ bt_logging_level log_level);
/**
* Destroy the given bin_info instance
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO"
-#include "logging.h"
+#include "logging/log.h"
#include <glib.h>
#define PATH_FIELD_NAME "path"
struct debug_info_component {
+ bt_logging_level log_level;
gchar *arg_debug_dir;
gchar *arg_debug_info_field_name;
gchar *arg_target_prefix;
};
struct debug_info_msg_iter {
+ bt_logging_level log_level;
struct debug_info_component *debug_info_component;
bt_self_message_iterator *input_iterator;
bt_self_component *self_comp;
};
struct debug_info {
+ bt_logging_level log_level;
struct debug_info_component *comp;
const bt_trace *input_trace;
uint64_t destruction_listener_id;
info->q_lib_load = g_quark_from_string("lttng_ust_lib:load");
info->q_lib_unload = g_quark_from_string("lttng_ust_lib:unload");
- return bin_info_init();
+ return bin_info_init(info->log_level);
}
static
int ret;
struct debug_info_source *debug_info_src = NULL;
struct source_location *src_loc = NULL;
+ bt_logging_level log_level = bin->log_level;
debug_info_src = g_new0(struct debug_info_source, 1);
static
struct debug_info_source *proc_debug_info_sources_get_entry(
+ struct debug_info *debug_info,
struct proc_debug_info_sources *proc_dbg_info_src, uint64_t ip)
{
struct debug_info_source *debug_info_src = NULL;
goto end;
}
- dbg_info_src = proc_debug_info_sources_get_entry(proc_dbg_info_src, ip);
+ dbg_info_src = proc_debug_info_sources_get_entry(debug_info,
+ proc_dbg_info_src, ip);
end:
return dbg_info_src;
goto end;
}
+ debug_info->log_level = comp->log_level;
debug_info->vpid_to_proc_dbg_info_src = g_hash_table_new_full(
g_int64_hash, g_int64_equal, (GDestroyNotify) g_free,
(GDestroyNotify) proc_debug_info_sources_destroy);
static
void debug_info_destroy(struct debug_info *debug_info)
{
+ bt_logging_level log_level;
bt_trace_status status;
if (!debug_info) {
goto end;
}
+ log_level = debug_info->log_level;
+
if (debug_info->vpid_to_proc_dbg_info_src) {
g_hash_table_destroy(debug_info->vpid_to_proc_dbg_info_src);
}
bin = bin_info_create(debug_info->fd_cache, path, baddr, memsz, is_pic,
debug_info->comp->arg_debug_dir,
- debug_info->comp->arg_target_prefix);
+ debug_info->comp->arg_target_prefix,
+ debug_info->log_level);
if (!bin) {
goto end;
}
static
void fill_debug_info_bin_field(struct debug_info_source *dbg_info_src,
- bool full_path, bt_field *curr_field)
+ bool full_path, bt_field *curr_field,
+ bt_logging_level log_level)
{
bt_field_status status;
static
void fill_debug_info_func_field(struct debug_info_source *dbg_info_src,
- bt_field *curr_field)
+ bt_field *curr_field, bt_logging_level log_level)
{
bt_field_status status;
static
void fill_debug_info_src_field(struct debug_info_source *dbg_info_src,
- bool full_path, bt_field *curr_field)
+ bool full_path, bt_field *curr_field,
+ bt_logging_level log_level)
{
bt_field_status status;
}
}
-void fill_debug_info_field_empty(bt_field *debug_info_field)
+static
+void fill_debug_info_field_empty(bt_field *debug_info_field,
+ bt_logging_level log_level)
{
bt_field_status status;
bt_field *bin_field, *func_field, *src_field;
dbg_info_src = debug_info_query(debug_info, vpid, ip);
- fill_debug_info_bin_field(dbg_info_src, debug_info->comp->arg_full_path,
- bt_field_structure_borrow_member_field_by_name(
- debug_info_field, "bin"));
+ fill_debug_info_bin_field(dbg_info_src,
+ debug_info->comp->arg_full_path,
+ bt_field_structure_borrow_member_field_by_name(
+ debug_info_field, "bin"),
+ debug_info->log_level);
fill_debug_info_func_field(dbg_info_src,
- bt_field_structure_borrow_member_field_by_name(
- debug_info_field, "func"));
- fill_debug_info_src_field(dbg_info_src, debug_info->comp->arg_full_path,
- bt_field_structure_borrow_member_field_by_name(
- debug_info_field, "src"));
+ bt_field_structure_borrow_member_field_by_name(
+ debug_info_field, "func"),
+ debug_info->log_level);
+ fill_debug_info_src_field(dbg_info_src,
+ debug_info->comp->arg_full_path,
+ bt_field_structure_borrow_member_field_by_name(
+ debug_info_field, "src"),
+ debug_info->log_level);
}
static
int64_t ip;
gchar *debug_info_field_name =
debug_it->debug_info_component->arg_debug_info_field_name;
+ bt_logging_level log_level = debug_it->log_level;
in_common_ctx_field = bt_event_borrow_common_context_field_const(
in_event);
} else {
BT_LOGD("No debug information for this trace. Setting debug "
"info fields to empty strings.");
- fill_debug_info_field_empty(out_debug_info_field);
+ fill_debug_info_field_empty(out_debug_info_field, log_level);
}
end:
return;
bt_event_class *out_event_class;
bt_packet *out_packet;
bt_event *out_event;
+ bt_logging_level log_level = debug_it->log_level;
bt_message *out_message = NULL;
out_event = bt_message_event_borrow_event(out_message);
/* Copy the original fields to the output event. */
- copy_event_content(in_event, out_event);
+ copy_event_content(in_event, out_event, log_level);
/*
* Try to set the debug-info fields based on debug information that is
const bt_stream *in_stream;
bt_message *out_message;
bt_stream *out_stream;
+ bt_logging_level log_level = debug_it->log_level;
in_stream = bt_message_stream_beginning_borrow_stream_const(in_message);
BT_ASSERT(in_stream);
const bt_stream *in_stream;
bt_message *out_message = NULL;
bt_stream *out_stream;
+ bt_logging_level log_level = debug_it->log_level;
in_stream = bt_message_stream_end_borrow_stream_const(in_message);
BT_ASSERT(in_stream);
const bt_clock_snapshot *cs;
bt_message *out_message = NULL;
bt_packet *out_packet;
+ bt_logging_level log_level = debug_it->log_level;
const bt_packet *in_packet =
bt_message_packet_beginning_borrow_packet_const(in_message);
const bt_packet *in_packet;
bt_message *out_message = NULL;
bt_packet *out_packet;
+ bt_logging_level log_level = debug_it->log_level;
in_packet = bt_message_packet_end_borrow_packet_const(in_message);
BT_ASSERT(in_packet);
bt_stream *out_stream;
uint64_t cs_value;
bt_message_stream_activity_clock_snapshot_state cs_state;
+ bt_logging_level log_level = debug_it->log_level;
const bt_stream *in_stream =
bt_message_stream_activity_beginning_borrow_stream_const(
bt_stream *out_stream;
uint64_t cs_value;
bt_message_stream_activity_clock_snapshot_state cs_state;
+ bt_logging_level log_level = debug_it->log_level;
in_stream = bt_message_stream_activity_end_borrow_stream_const(
in_message);
bt_property_availability prop_avail;
bt_message *out_message = NULL;
bt_stream *out_stream;
+ bt_logging_level log_level = debug_it->log_level;
in_stream = bt_message_discarded_events_borrow_stream_const(
in_message);
bt_property_availability prop_avail;
bt_message *out_message = NULL;
bt_stream *out_stream;
+ bt_logging_level log_level = debug_it->log_level;
in_stream = bt_message_discarded_packets_borrow_stream_const(
in_message);
int ret;
struct debug_info_component *debug_info_comp;
bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
+ bt_logging_level log_level = bt_component_get_logging_level(
+ bt_self_component_as_component(
+ bt_self_component_filter_as_self_component(self_comp)));
BT_LOGI("Initializing debug_info component: "
"comp-addr=%p, params-addr=%p", self_comp, params);
goto error;
}
+ debug_info_comp->log_level = log_level;
bt_self_component_set_data(
- bt_self_component_filter_as_self_component(self_comp),
- debug_info_comp);
+ bt_self_component_filter_as_self_component(self_comp),
+ debug_info_comp);
status = bt_self_component_filter_add_input_port(self_comp, "in",
NULL, NULL);
bt_self_component_get_data(
bt_self_component_filter_as_self_component(
self_comp));
+ bt_logging_level log_level = debug_info->log_level;
+
BT_LOGI("Finalizing debug_info self_component: comp-addr=%p",
self_comp);
struct debug_info_msg_iter *debug_info_msg_iter = NULL;
gchar *debug_info_field_name;
int ret;
+ bt_logging_level log_level = bt_component_get_logging_level(
+ bt_self_component_as_component(
+ bt_self_component_filter_as_self_component(self_comp)));
/* Borrow the upstream input port. */
input_port = bt_self_component_filter_borrow_input_port_by_name(
goto error;
}
+ debug_info_msg_iter->log_level = log_level;
+
/* Create an iterator on the upstream component. */
upstream_iterator = bt_self_component_port_input_message_iterator_create(
input_port);
debug_info_msg_iter->ir_maps = trace_ir_maps_create(
bt_self_component_filter_as_self_component(self_comp),
- debug_info_field_name);
+ debug_info_field_name, log_level);
if (!debug_info_msg_iter->ir_maps) {
status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
goto error;
}
- ret = bt_fd_cache_init(&debug_info_msg_iter->fd_cache,
- BT_LOG_OUTPUT_LEVEL);
+ ret = bt_fd_cache_init(&debug_info_msg_iter->fd_cache, log_level);
if (ret) {
status = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
goto error;
+++ /dev/null
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@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.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_plugin_lttng_utils_debug_info_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(bt_plugin_lttng_utils_debug_info_log_level,
- "BABELTRACE_FLT_LTTNG_UTILS_DEBUG_INFO_LOG_LEVEL");
+++ /dev/null
-#ifndef PLUGINS_LTTNG_UTILS_DEBUG_INFO_LOGGING_H
-#define PLUGINS_LTTNG_UTILS_DEBUG_INFO_LOGGING_H
-
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@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.
- */
-
-#define BT_LOG_OUTPUT_LEVEL bt_plugin_lttng_utils_debug_info_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(bt_plugin_lttng_utils_debug_info_log_level);
-
-#endif /* PLUGINS_LTTNG_UTILS_DEBUG_INFO_LOGGING_H */
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/TRACE-IR-DATA-COPY"
-#include "logging.h"
+#include "logging/log.h"
#include <inttypes.h>
#include <stdint.h>
#include "trace-ir-data-copy.h"
BT_HIDDEN
-void copy_trace_content(const bt_trace *in_trace, bt_trace *out_trace)
+void copy_trace_content(const bt_trace *in_trace, bt_trace *out_trace,
+ bt_logging_level log_level)
{
bt_trace_status status;
const char *trace_name;
}
BT_HIDDEN
-void copy_stream_content(const bt_stream *in_stream, bt_stream *out_stream)
+void copy_stream_content(const bt_stream *in_stream, bt_stream *out_stream,
+ bt_logging_level log_level)
{
const char *stream_name;
bt_stream_status status;
}
BT_HIDDEN
-void copy_packet_content(const bt_packet *in_packet, bt_packet *out_packet)
+void copy_packet_content(const bt_packet *in_packet, bt_packet *out_packet,
+ bt_logging_level log_level)
{
const bt_field *in_context_field;
bt_field *out_context_field;
if (in_context_field) {
out_context_field = bt_packet_borrow_context_field(out_packet);
BT_ASSERT(out_context_field);
- copy_field_content(in_context_field, out_context_field);
+ copy_field_content(in_context_field, out_context_field,
+ log_level);
}
BT_LOGD("Copied content of packet: in-p-addr=%p, out-p-addr=%p",
}
BT_HIDDEN
-void copy_event_content(const bt_event *in_event, bt_event *out_event)
+void copy_event_content(const bt_event *in_event, bt_event *out_event,
+ bt_logging_level log_level)
{
const bt_field *in_common_ctx_field, *in_specific_ctx_field,
*in_payload_field;
bt_event_borrow_common_context_field(out_event);
BT_ASSERT(out_common_ctx_field);
copy_field_content(in_common_ctx_field,
- out_common_ctx_field);
+ out_common_ctx_field, log_level);
}
in_specific_ctx_field =
bt_event_borrow_specific_context_field(out_event);
BT_ASSERT(out_specific_ctx_field);
copy_field_content(in_specific_ctx_field,
- out_specific_ctx_field);
+ out_specific_ctx_field, log_level);
}
in_payload_field = bt_event_borrow_payload_field_const(in_event);
out_payload_field = bt_event_borrow_payload_field(out_event);
BT_ASSERT(out_payload_field);
copy_field_content(in_payload_field,
- out_payload_field);
+ out_payload_field, log_level);
}
BT_LOGD("Copied content of event: in-e-addr=%p, out-e-addr=%p",
}
BT_HIDDEN
-void copy_field_content(const bt_field *in_field, bt_field *out_field)
+void copy_field_content(const bt_field *in_field, bt_field *out_field,
+ bt_logging_level log_level)
{
bt_field_class_type in_fc_type, out_fc_type;
out_field, in_member_name);
copy_field_content(in_member_field,
- out_member_field);
+ out_member_field, log_level);
}
break;
}
out_element_field =
bt_field_array_borrow_element_field_by_index(
out_field, i);
- copy_field_content(in_element_field, out_element_field);
+ copy_field_content(in_element_field, out_element_field,
+ log_level);
}
break;
}
in_option_field = bt_field_variant_borrow_selected_option_field_const(in_field);
out_option_field = bt_field_variant_borrow_selected_option_field(out_field);
- copy_field_content(in_option_field, out_option_field);
+ copy_field_content(in_option_field, out_option_field,
+ log_level);
break;
}
#include "trace-ir-mapping.h"
BT_HIDDEN
-void copy_trace_content(const bt_trace *in_trace, bt_trace *out_trace);
+void copy_trace_content(const bt_trace *in_trace, bt_trace *out_trace,
+ bt_logging_level log_level);
BT_HIDDEN
-void copy_stream_content(const bt_stream *in_stream, bt_stream *out_stream);
+void copy_stream_content(const bt_stream *in_stream, bt_stream *out_stream,
+ bt_logging_level log_level);
BT_HIDDEN
-void copy_packet_content(const bt_packet *in_packet, bt_packet *out_packet);
+void copy_packet_content(const bt_packet *in_packet, bt_packet *out_packet,
+ bt_logging_level log_level);
BT_HIDDEN
-void copy_event_content(const bt_event *in_event, bt_event *out_event);
+void copy_event_content(const bt_event *in_event, bt_event *out_event,
+ bt_logging_level log_level);
BT_HIDDEN
-void copy_field_content(const bt_field *in_field, bt_field *out_field);
+void copy_field_content(const bt_field *in_field, bt_field *out_field,
+ bt_logging_level log_level);
#endif /* BABELTRACE_PLUGIN_DEBUG_INFO_TRACE_DATA_COPY_H */
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (ir_maps->log_level)
#define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/TRACE-IR-MAPPING"
-#include "logging.h"
+#include "logging/log.h"
#include <stdbool.h>
}
/* If not, create a new one and add it to the mapping. */
- ret = copy_trace_class_content(in_trace_class, out_trace_class);
+ ret = copy_trace_class_content(in_trace_class, out_trace_class,
+ ir_maps->log_level);
if (ret) {
BT_LOGE_STR("Error copy content to output trace class");
out_trace_class = NULL;
}
/* If not, create a new one and add it to the mapping. */
- copy_trace_content(in_trace, out_trace);
+ copy_trace_content(in_trace, out_trace, ir_maps->log_level);
BT_LOGD("Created new mapped trace: in-t-addr=%p, out-t-addr=%p",
in_trace, out_trace);
bt_stream_class *out_stream_class;
bt_stream *out_stream = NULL;
- BT_LOGD("Creating new mapped stream: in-s-addr=%p", in_stream);
-
BT_ASSERT(ir_maps);
BT_ASSERT(in_stream);
+ BT_LOGD("Creating new mapped stream: in-s-addr=%p", in_stream);
in_trace = bt_stream_borrow_trace_const(in_stream);
* time of the stream objects.
*/
- copy_stream_content(in_stream, out_stream);
+ copy_stream_content(in_stream, out_stream, ir_maps->log_level);
g_hash_table_insert(d_maps->stream_map, (gpointer) in_stream,
out_stream);
struct trace_ir_metadata_maps *md_maps;
int ret;
- BT_LOGD("Creating new mapped event class: in-ec-addr=%p",
- in_event_class);
-
BT_ASSERT(ir_maps);
BT_ASSERT(in_event_class);
+ BT_LOGD("Creating new mapped event class: in-ec-addr=%p",
+ in_event_class);
in_trace_class = bt_stream_class_borrow_trace_class_const(
bt_event_class_borrow_stream_class_const(
* Release our ref since the stream object will be managing the life
* time of the packet objects.
*/
- copy_packet_content(in_packet, out_packet);
+ copy_packet_content(in_packet, out_packet, ir_maps->log_level);
g_hash_table_insert(d_maps->packet_map,
(gpointer) in_packet, out_packet);
goto error;
}
+ d_maps->log_level = ir_maps->log_level;
d_maps->input_trace = in_trace;
/* Create the hashtables used to map data objects. */
goto error;
}
+ md_maps->log_level = ir_maps->log_level;
md_maps->input_trace_class = in_trace_class;
/*
* Create the field class resolving context. This is needed to keep
status = bt_trace_remove_destruction_listener(maps->input_trace,
maps->destruction_listener_id);
if (status != BT_TRACE_STATUS_OK) {
- BT_LOGD("Trace destruction listener removal failed.");
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_DEBUG, maps->log_level,
+ BT_LOG_TAG,
+ "Trace destruction listener removal failed.");
}
g_free(maps);
status = bt_trace_class_remove_destruction_listener(maps->input_trace_class,
maps->destruction_listener_id);
if (status != BT_TRACE_CLASS_STATUS_OK) {
- BT_LOGD("Trace destruction listener removal failed.");
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_DEBUG, maps->log_level, BT_LOG_TAG,
+ "Trace destruction listener removal failed.");
}
g_free(maps);
BT_HIDDEN
struct trace_ir_maps *trace_ir_maps_create(bt_self_component *self_comp,
- const char *debug_info_field_name)
+ const char *debug_info_field_name, bt_logging_level log_level)
{
- struct trace_ir_maps *trace_ir_maps =
+ struct trace_ir_maps *ir_maps =
g_new0(struct trace_ir_maps, 1);
- if (!trace_ir_maps) {
- BT_LOGE_STR("Error allocating trace_ir_maps");
+ if (!ir_maps) {
+ BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ "Error allocating trace_ir_maps");
goto error;
}
+ ir_maps->log_level = log_level;
+
/* Copy debug info field name received from the user. */
- trace_ir_maps->debug_info_field_class_name =
+ ir_maps->debug_info_field_class_name =
g_strdup(debug_info_field_name);
- if (!trace_ir_maps->debug_info_field_class_name) {
+ if (!ir_maps->debug_info_field_class_name) {
BT_LOGE_STR("Cannot copy debug info field name");
goto error;
}
- trace_ir_maps->self_comp = self_comp;
+ ir_maps->self_comp = self_comp;
- trace_ir_maps->data_maps = g_hash_table_new_full(g_direct_hash,
+ ir_maps->data_maps = g_hash_table_new_full(g_direct_hash,
g_direct_equal, (GDestroyNotify) NULL,
(GDestroyNotify) trace_ir_data_maps_destroy);
- trace_ir_maps->metadata_maps = g_hash_table_new_full(g_direct_hash,
+ ir_maps->metadata_maps = g_hash_table_new_full(g_direct_hash,
g_direct_equal, (GDestroyNotify) NULL,
(GDestroyNotify) trace_ir_metadata_maps_destroy);
goto end;
error:
- trace_ir_maps_destroy(trace_ir_maps);
- trace_ir_maps = NULL;
+ trace_ir_maps_destroy(ir_maps);
+ ir_maps = NULL;
end:
- return trace_ir_maps;
+ return ir_maps;
}
};
struct trace_ir_metadata_maps {
+ bt_logging_level log_level;
const bt_trace_class *input_trace_class;
bt_trace_class *output_trace_class;
};
struct trace_ir_data_maps {
+ bt_logging_level log_level;
const bt_trace *input_trace;
bt_trace *output_trace;
};
struct trace_ir_maps {
+ bt_logging_level log_level;
+
/*
* input trace -> trace_ir_data_maps.
* input trace: weak reference. Owned by an upstream component.
BT_HIDDEN
struct trace_ir_maps *trace_ir_maps_create(bt_self_component *self_comp,
- const char *debug_info_field_name);
+ const char *debug_info_field_name, bt_logging_level log_level);
BT_HIDDEN
void trace_ir_maps_clear(struct trace_ir_maps *maps);
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/TRACE-IR-META-COPY"
-#include "logging.h"
+#include "logging/log.h"
#include <inttypes.h>
#include <stdint.h>
BT_HIDDEN
int copy_trace_class_content(const bt_trace_class *in_trace_class,
- bt_trace_class *out_trace_class)
+ bt_trace_class *out_trace_class, bt_logging_level log_level)
{
int ret = 0;
uint64_t i, env_field_count;
static
int copy_clock_class_content(const bt_clock_class *in_clock_class,
- bt_clock_class *out_clock_class)
+ bt_clock_class *out_clock_class, bt_logging_level log_level)
{
bt_clock_class_status status;
const char *clock_class_name, *clock_class_description;
{
bt_clock_class *out_clock_class;
int ret;
+ bt_logging_level log_level = md_maps->log_level;
BT_LOGD("Creating new mapped clock class: in-cc-addr=%p",
in_clock_class);
goto end;
}
/* If not, create a new one and add it to the mapping. */
- ret = copy_clock_class_content(in_clock_class, out_clock_class);
+ ret = copy_clock_class_content(in_clock_class, out_clock_class,
+ log_level);
if (ret) {
BT_LOGE_STR("Cannot copy clock class");
goto end;
bt_stream_class_status status;
const char *in_name;
int ret = 0;
+ bt_logging_level log_level = ir_maps->log_level;
BT_LOGD("Copying content of stream class: in-sc-addr=%p, out-sc-addr=%p",
in_stream_class, out_stream_class);
struct trace_ir_metadata_maps *md_maps;
const char *in_event_class_name, *in_emf_uri;
bt_property_availability prop_avail;
- bt_event_class_log_level log_level;
+ bt_event_class_log_level ec_log_level;
bt_event_class_status status;
bt_field_class *out_specific_context_fc, *out_payload_fc;
const bt_field_class *in_event_specific_context, *in_event_payload;
int ret = 0;
+ bt_logging_level log_level = ir_maps->log_level;
BT_LOGD("Copying content of event class: in-ec-addr=%p, out-ec-addr=%p",
in_event_class, out_event_class);
}
/* Copy event class loglevel. */
- prop_avail = bt_event_class_get_log_level(in_event_class, &log_level);
+ prop_avail = bt_event_class_get_log_level(in_event_class,
+ &ec_log_level);
if (prop_avail == BT_PROPERTY_AVAILABILITY_AVAILABLE) {
bt_event_class_set_log_level(out_event_class,
- log_level);
+ ec_log_level);
}
/* Copy event class emf uri. */
bt_field_class *debug_field_class = NULL, *bin_field_class = NULL,
*func_field_class = NULL, *src_field_class = NULL;
int ret = 0;
+ bt_logging_level log_level = md_maps->log_level;
BT_LOGD("Copying content of event common context field class: "
"in-fc-addr=%p, out-fc-addr=%p", in_field_class, out_field_class);
BT_HIDDEN
int copy_trace_class_content(const bt_trace_class *in_trace_class,
- bt_trace_class *out_trace_class);
+ bt_trace_class *out_trace_class,
+ bt_logging_level log_level);
BT_HIDDEN
int copy_stream_class_content(struct trace_ir_maps *trace_ir_maps,
* SOFTWARE.
*/
+#define BT_LOG_OUTPUT_LEVEL (md_maps->log_level)
#define BT_LOG_TAG "PLUGIN/FLT.LTTNG-UTILS.DEBUG-INFO/TRACE-IR-META-FC-COPY"
-#include "logging.h"
+#include "logging/log.h"
#include "common/assert.h"
#include "common/common.h"
* structures ultimately leading to a field class.
*/
static
-const bt_field_class *walk_field_path(const bt_field_path *fp,
- const bt_field_class *fc)
+const bt_field_class *walk_field_path(struct trace_ir_metadata_maps *md_maps,
+ const bt_field_path *fp, const bt_field_class *fc)
{
uint64_t i, fp_item_count;
const bt_field_class *curr_fc;
switch (fp_scope) {
case BT_SCOPE_PACKET_CONTEXT:
- fc = walk_field_path(fp, fc_resolving_ctx->packet_context);
+ fc = walk_field_path(md_maps, fp,
+ fc_resolving_ctx->packet_context);
break;
case BT_SCOPE_EVENT_COMMON_CONTEXT:
- fc = walk_field_path(fp, fc_resolving_ctx->event_common_context);
+ fc = walk_field_path(md_maps, fp,
+ fc_resolving_ctx->event_common_context);
break;
case BT_SCOPE_EVENT_SPECIFIC_CONTEXT:
- fc = walk_field_path(fp, fc_resolving_ctx->event_specific_context);
+ fc = walk_field_path(md_maps, fp,
+ fc_resolving_ctx->event_specific_context);
break;
case BT_SCOPE_EVENT_PAYLOAD:
- fc = walk_field_path(fp, fc_resolving_ctx->event_payload);
+ fc = walk_field_path(md_maps, fp,
+ fc_resolving_ctx->event_payload);
break;
default:
abort();
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL);
ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
/* Test setting invalid build_id */
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL);
ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
/* Test setting debug link */
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL);
ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
/* Test bin_info_has_address */
}
bin = bin_info_create(&fdc, bin_path, SO_LOW_ADDR, SO_MEMSZ, true,
- data_dir, NULL);
+ data_dir, NULL, BT_LOG_OUTPUT_LEVEL);
ok(bin != NULL, "bin_info_create successful (%s)", bin_path);
/* Test bin_info_has_address */
plan_tests(NR_TESTS);
- ret = bin_info_init();
+ ret = bin_info_init(BT_LOG_OUTPUT_LEVEL);
ok(ret == 0, "bin_info_init successful");
test_bin_info_elf(opt_debug_info_dir);