Add support for debuginfod to the binutils (disable by default, enabled via a configu...
[deliverable/binutils-gdb.git] / binutils / objdump.c
index 210b67e79b221441e98a9f0d107b0f6f1f60b048..27b0fb6039404f8a3fe4266d155bbb47b4bce7f6 100644 (file)
@@ -2945,6 +2945,33 @@ open_debug_file (const char * pathname)
   return data;
 }
 
+#if HAVE_LIBDEBUGINFOD
+/* Return a hex string represention of the build-id.  */
+
+unsigned char *
+get_build_id (void * data)
+{
+  unsigned i;
+  char * build_id_str;
+  bfd * abfd = (bfd *) data;
+  const struct bfd_build_id * build_id;
+
+  build_id = abfd->build_id;
+  if (build_id == NULL)
+    return NULL;
+
+  build_id_str = malloc (build_id->size * 2 + 1);
+  if (build_id_str == NULL)
+    return NULL;
+
+  for (i = 0; i < build_id->size; i++)
+    sprintf (build_id_str + (i * 2), "%02x", build_id->data[i]);
+  build_id_str[build_id->size * 2] = '\0';
+
+  return (unsigned char *)build_id_str;
+}
+#endif /* HAVE_LIBDEBUGINFOD */
+
 static void
 dump_dwarf_section (bfd *abfd, asection *section,
                    void *arg ATTRIBUTE_UNUSED)
This page took 0.023723 seconds and 4 git commands to generate.