+int get_elf_info(struct bin_info_data *bin_data, int *has_build_id,
+ int *has_debug_link) {
+ struct lttng_ust_elf *elf;
+ int ret = 0;
+
+ elf = lttng_ust_elf_create(bin_data->resolved_path);
+ if (!elf) {
+ ret = -1;
+ goto end;
+ }
+
+ ret = lttng_ust_elf_get_memsz(elf, &bin_data->memsz);
+ if (ret) {
+ goto end;
+ }
+
+ ret = lttng_ust_elf_get_build_id(elf, &bin_data->build_id,
+ &bin_data->build_id_len, has_build_id);
+ if (ret) {
+ goto end;
+ }
+ ret = lttng_ust_elf_get_debug_link(elf, &bin_data->dbg_file,
+ &bin_data->crc, has_debug_link);
+ if (ret) {
+ goto end;
+ }
+
+ bin_data->is_pic = lttng_ust_elf_is_pic(elf);
+
+end:
+ lttng_ust_elf_destroy(elf);
+ return ret;
+}
+
+static
+int trace_baddr(struct bin_info_data *bin_data)