This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v12 22/32] Add dummy build-id params to prototypes
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 21 Aug 2015 23:23:06 +0200
- Subject: [PATCH v12 22/32] Add dummy build-id params to prototypes
- Authentication-results: sourceware.org; auth=none
- References: <20150821212006 dot 6673 dot 35100 dot stgit at host1 dot jankratochvil dot net>
Hi,
it is a lot of text with no functionality. Add build-id parameters where
needed, pass them where they are already available, otherwise pass 0 in the top
callers.
Jan
gdb/ChangeLog
2015-08-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* cli/cli-cmds.c (find_and_open_script): Pass zero build-id.
* defs.h (openp, openp_file, source_full_path_of): Add build-id
parameters.
* dwarf2read.c (try_open_dwop_file): Pass zero build-id.
* exec.c (exec_file_locate_attach): Likewise.
* infrun.c (follow_exec): Likewise.
* nto-tdep.c (nto_find_and_open_solib): Add build-id parameters, pass
them.
* nto-tdep.h (nto_find_and_open_solib): Add build-id parameters.
* solib-aix.c (solib_aix_bfd_open): Add build-id parameters, pass them.
* solib-darwin.c (darwin_bfd_open): Likewise.
* solib-dsbt.c (enable_break): Pass zero build-id.
* solib-frv.c (enable_break2): Likewise.
* solib-spu.c (spu_bfd_open): Add build-id parameters, pass them.
* solib-svr4.c (enable_break): Pass zero build-id.
* solib.c (solib_find_3, solib_find_2, solib_find_1, exec_file_find)
(solib_find_file, solib_find, solib_bfd_open): Add build-id
parameters, pass them.
(solib_map_sections): Pass so->build-id* to bfd_open.
(reload_shared_libraries_1): Pass so->build-id* to solib_bfd_open.
* solist.h (struct target_so_ops): Add build-id parameters to bfd_open
and find_and_open_solib.
(exec_file_find, solib_find, solib_bfd_open): Add build-id parameters.
* source.c (file_location_from_filename): Add build-id parameters.
(filename_to_bfd): Pass zero build-id.
(openp): Add build-id parameters, pass them.
(openp_bfd): Pass zero build-id.
(openp_file, source_full_path_of): Add build-id parameters, pass them.
(find_and_open_source): Pass zero build-id.
* source.h (file_location_from_filename): Add build-id parameters.
---
0 files changed
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d495463..da47b03 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -510,7 +510,8 @@ find_and_open_script (const char *script_file, int search_path,
/* Search for and open 'file' on the search path used for source
files. Put the full location in *FULL_PATHP. */
- fd = openp (source_path, search_flags, file, full_pathp);
+ fd = openp (source_path, search_flags, file, 0 /* build_idsz */,
+ NULL /* build_id */, full_pathp);
if (fd == -1)
{
diff --git a/gdb/defs.h b/gdb/defs.h
index ac735c2..1bc7b69 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -347,15 +347,18 @@ enum openp_flags
OPF_BFD_CANONICAL = (1 << 3),
};
-extern int openp (const char *, enum openp_flags, const char *, char **);
+extern int openp (const char *, enum openp_flags, const char *,
+ size_t build_idsz, const gdb_byte *build_id, char **);
extern bfd *openp_bfd (const char *path, enum openp_flags opts,
const char *string);
extern struct file_location openp_file (const char *path, enum openp_flags opts,
- const char *string);
+ const char *string, size_t build_idsz,
+ const gdb_byte *build_id);
-extern int source_full_path_of (const char *, char **);
+extern int source_full_path_of (const char *, size_t build_idsz,
+ const gdb_byte *build_id, char **);
extern void mod_path (char *, char **);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ae06e14..3fb446f 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10473,7 +10473,8 @@ try_open_dwop_file (const char *file_name, int is_dwp, int search_cwd)
flags = OPF_NONE;
if (is_dwp)
flags |= OPF_SEARCH_IN_PATH;
- desc = openp (search_path, flags, file_name, &absolute_name);
+ desc = openp (search_path, flags, file_name, 0 /* build_idsz */,
+ NULL /* build_id */, &absolute_name);
xfree (search_path);
if (desc < 0)
return NULL;
diff --git a/gdb/exec.c b/gdb/exec.c
index 6dd2aa6..0593478 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -155,7 +155,8 @@ exec_file_locate_attach (int pid, int from_tty)
/* If gdb_sysroot is not empty and the discovered filename
is absolute then prefix the filename with gdb_sysroot. */
if (*gdb_sysroot != '\0' && IS_ABSOLUTE_PATH (exec_file))
- full_exec_path = exec_file_find (exec_file, NULL);
+ full_exec_path = exec_file_find (exec_file, 0 /* build_idsz */,
+ NULL /* build_id */, NULL);
if (full_exec_path == NULL)
{
@@ -166,7 +167,8 @@ exec_file_locate_attach (int pid, int from_tty)
Attempt to qualify the filename against the source path.
(If that fails, we'll just fall back on the original
filename. Not much more we can do...) */
- if (!source_full_path_of (exec_file, &full_exec_path))
+ if (!source_full_path_of (exec_file, 0 /* build_idsz */,
+ NULL /* build_id */, &full_exec_path))
full_exec_path = xstrdup (exec_file);
}
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 25036a4..c1beafd 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1165,7 +1165,8 @@ follow_exec (ptid_t ptid, char *execd_pathname)
if (*gdb_sysroot != '\0')
{
- char *name = exec_file_find (execd_pathname, NULL);
+ char *name = exec_file_find (execd_pathname, 0 /* build_idsz */,
+ NULL /* build_id */, NULL);
execd_pathname = alloca (strlen (name) + 1);
strcpy (execd_pathname, name);
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 9f9e3bc..48a0005 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -83,7 +83,8 @@ nto_map_arch_to_cputype (const char *arch)
}
struct file_location
-nto_find_and_open_solib (char *solib)
+nto_find_and_open_solib (char *solib, size_t build_idsz,
+ const gdb_byte *build_id)
{
char *buf, *arch_path, *nto_root;
const char *endian;
@@ -129,13 +130,15 @@ nto_find_and_open_solib (char *solib)
arch_path);
base = lbasename (solib);
- file = openp_file (buf, OPF_TRY_CWD_FIRST | OPF_IS_BFD, base);
+ file = openp_file (buf, OPF_TRY_CWD_FIRST | OPF_IS_BFD, base, build_idsz,
+ build_id);
if (file_location_is_valid (&file) || base == solib)
return file;
file_location_free (&file);
xsnprintf (arch_path, arch_len, "/%s", solib);
- return file_location_from_filename (arch_path, OPF_IS_BFD);
+ return file_location_from_filename (arch_path, OPF_IS_BFD, build_idsz,
+ build_id);
}
void
diff --git a/gdb/nto-tdep.h b/gdb/nto-tdep.h
index 5828765..73e5dd6 100644
--- a/gdb/nto-tdep.h
+++ b/gdb/nto-tdep.h
@@ -154,7 +154,8 @@ void nto_relocate_section_addresses (struct so_list *,
int nto_map_arch_to_cputype (const char *);
-struct file_location nto_find_and_open_solib (char *);
+struct file_location nto_find_and_open_solib (char *, size_t build_idsz,
+ const gdb_byte *build_id);
enum gdb_osabi nto_elf_osabi_sniffer (bfd *abfd);
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 99258f6..c376430 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -633,7 +633,7 @@ solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
/* Implement the "bfd_open" target_so_ops method. */
static bfd *
-solib_aix_bfd_open (char *pathname)
+solib_aix_bfd_open (char *pathname, size_t build_idsz, const gdb_byte *build_id)
{
/* The pathname is actually a synthetic filename with the following
form: "/path/to/sharedlib(member.o)" (double-quotes excluded).
@@ -650,7 +650,7 @@ solib_aix_bfd_open (char *pathname)
struct cleanup *cleanup;
if (pathname[path_len - 1] != ')')
- return solib_bfd_open (pathname);
+ return solib_bfd_open (pathname, build_idsz, build_id);
/* Search for the associated parens. */
sep = strrchr (pathname, '(');
@@ -660,7 +660,7 @@ solib_aix_bfd_open (char *pathname)
to open pathname without decoding, possibly leading to
a failure), rather than triggering an assert failure). */
warning (_("missing '(' in shared object pathname: %s"), pathname);
- return solib_bfd_open (pathname);
+ return solib_bfd_open (pathname, build_idsz, build_id);
}
filename_len = sep - pathname;
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 2a33cd7..be0bb54 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -578,7 +578,7 @@ darwin_lookup_lib_symbol (struct objfile *objfile,
}
static bfd *
-darwin_bfd_open (char *pathname)
+darwin_bfd_open (char *pathname, size_t build_idsz, const gdb_byte *build_id)
{
char *found_pathname;
int found_file;
@@ -586,7 +586,7 @@ darwin_bfd_open (char *pathname)
bfd *res;
/* Search for shared library file. */
- found_pathname = solib_find (pathname, &found_file);
+ found_pathname = solib_find (pathname, build_idsz, build_id, &found_file);
if (found_pathname == NULL)
perror_with_name (pathname);
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 7da5833..d55a9ed 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -835,7 +835,7 @@ enable_break (void)
TRY
{
- tmp_bfd = solib_bfd_open (buf);
+ tmp_bfd = solib_bfd_open (buf, 0, NULL);
}
CATCH (ex, RETURN_MASK_ALL)
{
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index f7ef38b..87b0a68 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -558,7 +558,7 @@ enable_break2 (void)
TRY
{
- tmp_bfd = solib_bfd_open (buf);
+ tmp_bfd = solib_bfd_open (buf, 0, NULL);
}
CATCH (ex, RETURN_MASK_ALL)
{
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 64a5c9c..8358f93 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -344,7 +344,7 @@ spu_bfd_fopen (char *name, CORE_ADDR addr)
/* Open shared library BFD. */
static bfd *
-spu_bfd_open (char *pathname)
+spu_bfd_open (char *pathname, size_t build_idsz, const gdb_byte *build_id)
{
char *original_name = strrchr (pathname, '@');
bfd *abfd;
@@ -354,7 +354,7 @@ spu_bfd_open (char *pathname)
/* Handle regular SVR4 libraries. */
if (!original_name)
- return svr4_so_ops.bfd_open (pathname);
+ return svr4_so_ops.bfd_open (pathname, build_idsz, build_id);
/* Decode object ID. */
if (sscanf (original_name, "@0x%llx <%d>", &addr, &fd) != 2)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 070b95f..8739c31 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -2366,7 +2366,7 @@ enable_break (struct svr4_info *info, int from_tty)
TRY
{
- tmp_bfd = solib_bfd_open (interp_name);
+ tmp_bfd = solib_bfd_open (interp_name, 0, NULL);
}
CATCH (ex, RETURN_MASK_ALL)
{
diff --git a/gdb/solib.c b/gdb/solib.c
index 4fe4cb3..b044e72 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -148,7 +148,7 @@ show_solib_search_path (struct ui_file *file, int from_tty,
static struct file_location
solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
- const char *sysroot)
+ const char *sysroot, size_t build_idsz, const gdb_byte *build_id)
{
const struct target_so_ops *ops = solib_ops (target_gdbarch ());
char *temp_pathname;
@@ -247,7 +247,8 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
}
/* Now see if we can open it. */
- file = file_location_from_filename (temp_pathname, opts);
+ file = file_location_from_filename (temp_pathname, opts, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
do_cleanups (old_chain);
@@ -275,7 +276,8 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
in_pathname + 2, (char *) NULL);
xfree (drive);
- file = file_location_from_filename (temp_pathname, opts);
+ file = file_location_from_filename (temp_pathname, opts, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
do_cleanups (old_chain);
@@ -295,7 +297,8 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
need_dir_separator ? SLASH_STRING : "",
in_pathname + 2, (char *) NULL);
- file = file_location_from_filename (temp_pathname, opts);
+ file = file_location_from_filename (temp_pathname, opts, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
do_cleanups (old_chain);
@@ -330,7 +333,7 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
if (is_solib && solib_search_path != NULL)
{
file = openp_file (solib_search_path, OPF_TRY_CWD_FIRST | opts,
- in_pathname);
+ in_pathname, build_idsz, build_id);
if (file_location_is_valid (&file))
{
file.filename = gdb_realpath_and_xfree (file.filename);
@@ -346,7 +349,8 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
if (is_solib && solib_search_path != NULL)
{
file = openp_file (solib_search_path, OPF_TRY_CWD_FIRST | opts,
- target_lbasename (fskind, in_pathname));
+ target_lbasename (fskind, in_pathname), build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
file.filename = gdb_realpath_and_xfree (file.filename);
@@ -359,7 +363,7 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
supplied solib search method. */
if (is_solib && ops->find_and_open_solib)
{
- file = ops->find_and_open_solib (in_pathname);
+ file = ops->find_and_open_solib (in_pathname, build_idsz, build_id);
if (file_location_is_valid (&file))
return file;
file_location_free (&file);
@@ -370,7 +374,8 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
{
file = openp_file (get_in_environ (current_inferior ()->environment,
"PATH"),
- OPF_TRY_CWD_FIRST | opts, in_pathname);
+ OPF_TRY_CWD_FIRST | opts, in_pathname, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
file.filename = gdb_realpath_and_xfree (file.filename);
@@ -385,7 +390,8 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
{
file = openp_file (get_in_environ (current_inferior ()->environment,
"LD_LIBRARY_PATH"),
- OPF_TRY_CWD_FIRST | opts, in_pathname);
+ OPF_TRY_CWD_FIRST | opts, in_pathname, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
file.filename = gdb_realpath_and_xfree (file.filename);
@@ -402,7 +408,8 @@ solib_find_3 (char *in_pathname, enum openp_flags opts, int is_solib,
of GDB_SYSROOT. */
static struct file_location
-solib_find_2 (char *in_pathname, enum openp_flags opts, int is_solib)
+solib_find_2 (char *in_pathname, enum openp_flags opts, int is_solib,
+ size_t build_idsz, const gdb_byte *build_id)
{
VEC (char_ptr) *sysroot_vec;
struct cleanup *back_to;
@@ -415,7 +422,8 @@ solib_find_2 (char *in_pathname, enum openp_flags opts, int is_solib)
for (ix = 0; VEC_iterate (char_ptr, sysroot_vec, ix, sysroot); ++ix)
{
- file = solib_find_3 (in_pathname, opts, is_solib, sysroot);
+ file = solib_find_3 (in_pathname, opts, is_solib, sysroot, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
do_cleanups (back_to);
@@ -432,9 +440,11 @@ solib_find_2 (char *in_pathname, enum openp_flags opts, int is_solib)
for functions not yet converted to the file_location style. */
static char *
-solib_find_1 (char *in_pathname, int *fd, int is_solib)
+solib_find_1 (char *in_pathname, size_t build_idsz, const gdb_byte *build_id,
+ int *fd, int is_solib)
{
- struct file_location file = solib_find_2 (in_pathname, OPF_NONE, is_solib);
+ struct file_location file = solib_find_2 (in_pathname, OPF_NONE, is_solib,
+ build_idsz, build_id);
char *retval;
if (!file_location_is_valid (&file))
@@ -466,9 +476,11 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
above. */
char *
-exec_file_find (char *in_pathname, int *fd)
+exec_file_find (char *in_pathname, size_t build_idsz, const gdb_byte *build_id,
+ int *fd)
{
- char *result = solib_find_1 (in_pathname, fd, 0);
+ char *result = solib_find_1 (in_pathname, build_idsz, build_id, fd,
+ 0 /* is_solib */);
if (result == NULL)
{
@@ -482,7 +494,8 @@ exec_file_find (char *in_pathname, int *fd)
strcpy (new_pathname, in_pathname);
strcat (new_pathname, ".exe");
- result = solib_find_1 (new_pathname, fd, 0);
+ result = solib_find_1 (new_pathname, build_idsz, build_id, fd,
+ 0 /* is_solib */);
}
}
@@ -498,7 +511,8 @@ exec_file_find (char *in_pathname, int *fd)
above. */
static struct file_location
-solib_find_file (char *in_pathname, enum openp_flags opts)
+solib_find_file (char *in_pathname, enum openp_flags opts, size_t build_idsz,
+ const gdb_byte *build_id)
{
const char *solib_symbols_extension
= gdbarch_solib_symbols_extension (target_gdbarch ());
@@ -526,16 +540,19 @@ solib_find_file (char *in_pathname, enum openp_flags opts)
}
}
- return solib_find_2 (in_pathname, opts, 1 /* is_solib */);
+ return solib_find_2 (in_pathname, opts, 1 /* is_solib */, build_idsz,
+ build_id);
}
/* It is an solib_find_file wrapper returning filename and optionally FD
for functions not yet converted to the file_location style. */
char *
-solib_find (char *in_pathname, int *fd)
+solib_find (char *in_pathname, size_t build_idsz, const gdb_byte *build_id,
+ int *fd)
{
- struct file_location file = solib_find_file (in_pathname, OPF_NONE);
+ struct file_location file = solib_find_file (in_pathname, OPF_NONE,
+ build_idsz, build_id);
char *retval;
if (!file_location_is_valid (&file))
@@ -589,7 +606,7 @@ solib_bfd_fopen (char *pathname, int fd)
/* Find shared library PATHNAME and open a BFD for it. */
bfd *
-solib_bfd_open (char *pathname)
+solib_bfd_open (char *pathname, size_t build_idsz, const gdb_byte *build_id)
{
char *found_pathname;
int found_file;
@@ -597,7 +614,7 @@ solib_bfd_open (char *pathname)
const struct bfd_arch_info *b;
/* Search for shared library file. */
- found_pathname = solib_find (pathname, &found_file);
+ found_pathname = solib_find (pathname, build_idsz, build_id, &found_file);
if (found_pathname == NULL)
{
/* Return failure if the file could not be found, so that we can
@@ -652,7 +669,7 @@ solib_map_sections (struct so_list *so)
filename = tilde_expand (so->so_name);
old_chain = make_cleanup (xfree, filename);
- abfd = ops->bfd_open (filename);
+ abfd = ops->bfd_open (filename, so->build_idsz, so->build_id);
do_cleanups (old_chain);
if (abfd == NULL)
@@ -1475,7 +1492,7 @@ reload_shared_libraries_1 (int from_tty)
filename = tilde_expand (so->so_original_name);
make_cleanup (xfree, filename);
- abfd = solib_bfd_open (filename);
+ abfd = solib_bfd_open (filename, so->build_idsz, so->build_id);
if (abfd != NULL)
{
found_pathname = xstrdup (bfd_get_filename (abfd));
diff --git a/gdb/solist.h b/gdb/solist.h
index 7d0a21e..34af30f 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -140,10 +140,13 @@ struct target_so_ops
int (*in_dynsym_resolve_code) (CORE_ADDR pc);
/* Find and open shared library binary file. */
- bfd *(*bfd_open) (char *pathname);
+ bfd *(*bfd_open) (char *pathname, size_t build_idsz,
+ const gdb_byte *build_id);
/* Optional extra hook for finding and opening a solib. */
- struct file_location (*find_and_open_solib) (char *soname);
+ struct file_location (*find_and_open_solib) (char *soname,
+ size_t build_idsz,
+ const gdb_byte *build_id);
/* Hook for looking up global symbols in a library-specific way. */
struct block_symbol (*lookup_lib_global_symbol)
@@ -187,16 +190,19 @@ void free_so (struct so_list *so);
struct so_list *master_so_list (void);
/* Find main executable binary file. */
-extern char *exec_file_find (char *in_pathname, int *fd);
+extern char *exec_file_find (char *in_pathname, size_t build_idsz,
+ const gdb_byte *build_id, int *fd);
/* Find shared library binary file. */
-extern char *solib_find (char *in_pathname, int *fd);
+extern char *solib_find (char *in_pathname, size_t build_idsz,
+ const gdb_byte *build_id, int *fd);
/* Open BFD for shared library file. */
extern bfd *solib_bfd_fopen (char *pathname, int fd);
/* Find solib binary file and open it. */
-extern bfd *solib_bfd_open (char *in_pathname);
+extern bfd *solib_bfd_open (char *in_pathname, size_t build_idsz,
+ const gdb_byte *build_id);
/* FIXME: gdbarch needs to control this variable. */
extern struct target_so_ops *current_target_so_ops;
diff --git a/gdb/source.c b/gdb/source.c
index 029c3b5..9a38df4 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -795,7 +795,8 @@ file_location_is_valid (const struct file_location *file)
/* Return new file_location from FILENAME and OPTS. */
struct file_location
-file_location_from_filename (const char *filename, enum openp_flags opts)
+file_location_from_filename (const char *filename, enum openp_flags opts,
+ size_t build_idsz, const gdb_byte *build_id)
{
struct file_location file;
struct cleanup *back_to;
@@ -954,7 +955,9 @@ bfd *
filename_to_bfd (const char *filename)
{
return file_location_to_bfd (file_location_from_filename (filename,
- OPF_IS_BFD));
+ OPF_IS_BFD,
+ 0 /* build_idsz */,
+ NULL /* build_id */));
}
/* Wrapper of openp_file returning filename string.
@@ -967,14 +970,14 @@ filename_to_bfd (const char *filename)
int
openp (const char *path, enum openp_flags opts, const char *string,
- char **filename_opened)
+ size_t build_idsz, const gdb_byte *build_id, char **filename_opened)
{
struct file_location file;
int retval;
gdb_assert ((opts & OPF_IS_BFD) == 0);
- file = openp_file (path, opts, string);
+ file = openp_file (path, opts, string, build_idsz, build_id);
gdb_assert (file.abfd == NULL);
if (file.fd == -1)
{
@@ -1002,7 +1005,9 @@ openp_bfd (const char *path, enum openp_flags opts, const char *string)
{
gdb_assert ((opts & OPF_IS_BFD) == 0);
- return file_location_to_bfd (openp_file (path, opts | OPF_IS_BFD, string));
+ return file_location_to_bfd (openp_file (path, opts | OPF_IS_BFD, string,
+ 0 /* build_idsz */,
+ NULL /* build_id */));
}
/* Open a file named STRING, searching path PATH (dir names sep by some char).
@@ -1010,6 +1015,9 @@ openp_bfd (const char *path, enum openp_flags opts, const char *string)
OPTS specifies the function behaviour in specific cases.
+ If BUILD_IDSZ is non-zero then BUILD_ID (of BUILD_IDSZ length) specifies
+ required build-id of the file.
+
Call file_location_is_valid on returned file_location to check
whether this function has succeeded. */
@@ -1017,7 +1025,8 @@ openp_bfd (const char *path, enum openp_flags opts, const char *string)
>>>> eg executable, non-directory. */
struct file_location
-openp_file (const char *path, enum openp_flags opts, const char *string)
+openp_file (const char *path, enum openp_flags opts, const char *string,
+ size_t build_idsz, const gdb_byte *build_id)
{
int fd;
char *filename;
@@ -1055,7 +1064,8 @@ openp_file (const char *path, enum openp_flags opts, const char *string)
{
filename = alloca (strlen (string) + 1);
strcpy (filename, string);
- file = file_location_from_filename (filename, opts);
+ file = file_location_from_filename (filename, opts, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
return file;
file_location_free (&file);
@@ -1152,7 +1162,8 @@ openp_file (const char *path, enum openp_flags opts, const char *string)
if (is_target_filename (filename) || is_regular_file (filename))
{
- file = file_location_from_filename (filename, opts);
+ file = file_location_from_filename (filename, opts, build_idsz,
+ build_id);
if (file_location_is_valid (&file))
{
do_cleanups (back_to);
@@ -1181,12 +1192,13 @@ openp_file (const char *path, enum openp_flags opts, const char *string)
Else, this functions returns 0, and FULL_PATHNAME is set to NULL. */
int
-source_full_path_of (const char *filename, char **full_pathname)
+source_full_path_of (const char *filename, size_t build_idsz,
+ const gdb_byte *build_id, char **full_pathname)
{
int fd;
fd = openp (source_path, OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH,
- filename, full_pathname);
+ filename, build_idsz, build_id, full_pathname);
if (fd < 0)
{
*full_pathname = NULL;
@@ -1361,7 +1373,8 @@ find_and_open_source (const char *filename,
}
gdb_assert (OPEN_MODE == (O_RDONLY | O_BINARY));
- result = openp (path, OPF_SEARCH_IN_PATH, filename, fullname);
+ result = openp (path, OPF_SEARCH_IN_PATH, filename, 0 /* build_idsz */,
+ NULL /* build_id */, fullname);
if (result < 0)
{
/* Didn't work. Try using just the basename. */
@@ -1369,7 +1382,8 @@ find_and_open_source (const char *filename,
if (p != filename)
{
gdb_assert (OPEN_MODE == (O_RDONLY | O_BINARY));
- result = openp (path, OPF_SEARCH_IN_PATH, p, fullname);
+ result = openp (path, OPF_SEARCH_IN_PATH, p, 0 /* build_idsz */,
+ NULL /* build_id */, fullname);
}
}
diff --git a/gdb/source.h b/gdb/source.h
index f511959..e2e2044 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -140,8 +140,9 @@ extern void file_location_free (struct file_location *file);
extern int file_location_is_valid (const struct file_location *file);
-extern struct file_location file_location_from_filename (const char *filename,
- enum openp_flags opts);
+extern struct file_location
+ file_location_from_filename (const char *filename, enum openp_flags opts,
+ size_t build_idsz, const gdb_byte *build_id);
extern bfd *file_location_to_bfd (struct file_location file);