From 46d8a85a760c53f3c4419e5ef6b3e3f300fbcbc6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 22 Jul 2016 11:41:35 -0400 Subject: [PATCH] Use lttng-ust's new load event to track library mappings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- lib/debug-info.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/debug-info.c b/lib/debug-info.c index aa19ce40..53d1eab2 100644 --- a/lib/debug-info.c +++ b/lib/debug-info.c @@ -59,20 +59,22 @@ struct debug_info { GQuark q_statedump_build_id; GQuark q_statedump_start; GQuark q_dl_open; + GQuark q_lib_load; }; static int debug_info_init(struct debug_info *info) { - info->q_statedump_bin_info = g_quark_from_string( + info->q_statedump_bin_info = g_quark_from_static_string( "lttng_ust_statedump:bin_info"); - info->q_statedump_debug_link = g_quark_from_string( + info->q_statedump_debug_link = g_quark_from_static_string( "lttng_ust_statedump:debug_link)"); - info->q_statedump_build_id = g_quark_from_string( + info->q_statedump_build_id = g_quark_from_static_string( "lttng_ust_statedump:build_id"); - info->q_statedump_start = g_quark_from_string( + info->q_statedump_start = g_quark_from_static_string( "lttng_ust_statedump:start"); - info->q_dl_open = g_quark_from_string("lttng_ust_dl:dlopen"); + info->q_dl_open = g_quark_from_static_string("lttng_ust_dl:dlopen"); + info->q_lib_load = g_quark_from_static_string("lttng_ust_lib:load"); return bin_info_init(); } @@ -784,7 +786,17 @@ void debug_info_handle_event(struct debug_info *debug_info, if (event_class->name == debug_info->q_statedump_bin_info) { /* State dump */ handle_statedump_bin_info_event(debug_info, event); - } else if (event_class->name == debug_info->q_dl_open) { + } else if (event_class->name == debug_info->q_dl_open || + event_class->name == debug_info->q_lib_load) { + /* + * dl_open and lib_load events are both checked for since + * only dl_open was produced as of lttng-ust 2.8. + * + * lib_load, which is produced from lttng-ust 2.9+, is a lot + * more reliable since it will be emitted when other functions + * of the dlopen family are called (e.g. dlmopen) and when + * library are transitively loaded. + */ handle_dlopen_event(debug_info, event); } else if (event_class->name == debug_info->q_statedump_start) { /* Start state dump */ -- 2.34.1