[v12,24/32] solib_find: Search also by build-id

Message ID 20150821212321.6673.63163.stgit@host1.jankratochvil.net
State New, archived
Headers

Commit Message

Jan Kratochvil Aug. 21, 2015, 9:23 p.m. UTC
  Hi,

solib_find() can now try to search also by build-id.


Jan


gdb/ChangeLog
2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* solib.c: Include build-id.h.
	(solib_find_3): Call build_id_to_file.
---
 0 files changed
  

Patch

diff --git a/gdb/solib.c b/gdb/solib.c
index b044e72..a425e4d 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -47,6 +47,7 @@ 
 #include "gdb_bfd.h"
 #include "filestuff.h"
 #include "source.h"
+#include "build-id.h"
 
 /* Architecture-specific operations.  */
 
@@ -313,6 +314,17 @@  solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
 
   /* We try to find the library in various ways.  */
 
+  if (build_idsz != 0)
+    {
+      file = build_id_to_file (build_idsz, build_id, "", opts);
+      if (file_location_is_valid (&file))
+	{
+	  do_cleanups (old_chain);
+	  return file;
+	}
+      file_location_free (&file);
+    }
+
   /* If the search in gdb_sysroot failed, and the path name is
      absolute at this point, make it relative.  (openp will try and open the
      file according to its absolute path otherwise, which is not what we want.)