From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64678 invoked by alias); 31 Jul 2015 19:17:24 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 64656 invoked by uid 9674); 31 Jul 2015 19:17:23 -0000 Date: Fri, 31 Jul 2015 19:17:00 -0000 Message-ID: <20150731191723.64608.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] jankratochvil/gdbserverbuildid2: buildidwarn X-Git-Refname: refs/heads/jankratochvil/gdbserverbuildid2 X-Git-Reftype: branch X-Git-Oldrev: d91ac3ceb0adddb1ba5aaab06699fd2af3b45ca8 X-Git-Newrev: 8274a0f57cae1b111180eda9cf17fa404147f6b7 X-SW-Source: 2015-q3/txt/msg00010.txt.bz2 List-Id: The branch, jankratochvil/gdbserverbuildid2 has been updated discards d91ac3ceb0adddb1ba5aaab06699fd2af3b45ca8 (commit) discards 168149db3b7cde9b94d5f22766fad29fd042cfd6 (commit) discards 4e408474626b408a8704039e634043a2678f86fa (commit) discards 6bcded095e565a9ab4e3a3e63b13303e7f14782a (commit) discards fe1b7ec8c97bf675e57165603468335cd14c4e4c (commit) discards f637f94da2f0e92a68c04ef40688409bfa1d0246 (commit) discards 8251d735d186180ceb82b1bb98c65158a4e7c749 (commit) discards bc787422c4a3e3b05d6b17cc804176822550559f (commit) discards fffe8a3466e5b18eefc70a35e881a26510cac2d5 (commit) discards 12d35640805beb504883f5e811a773c2a458fb68 (commit) discards 9cb0c0a45bbf0797a69b9e4ea1b1c4059a7af9ec (commit) via 8274a0f57cae1b111180eda9cf17fa404147f6b7 (commit) via 47064c63501b06767a66a733c0a09dd618e3cb87 (commit) via 0c3319418b1c6a86d0d287b7c3f264b52465d2a8 (commit) via 7502e0f27a4c4cc2de93772cec605433f72da870 (commit) via 6f6dc7ffcfa08facd55e55e9889156b36085d9d3 (commit) via ca2b6169c11f974af7944bee906612b21372c9b4 (commit) via ca6232d06bc4517a99919e29e91f515bef5fb162 (commit) via be6b238478be554663c3fe3324488841ff13c4e7 (commit) via 600a5e1c4f32c2c6b31cb856553c36a365a5580a (commit) via 8cce31c49ad425dd1b23f5ff3b18e6ba928c5492 (commit) via deea42476fd8f7f148f5a0f76d157b03fb751246 (commit) from d91ac3ceb0adddb1ba5aaab06699fd2af3b45ca8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 8274a0f57cae1b111180eda9cf17fa404147f6b7 Author: Jan Kratochvil Date: Thu Jul 30 20:49:10 2015 +0200 buildidwarn commit 47064c63501b06767a66a733c0a09dd618e3cb87 Author: Jan Kratochvil Date: Thu Jul 30 20:48:50 2015 +0200 locatetest commit 0c3319418b1c6a86d0d287b7c3f264b52465d2a8 Author: Jan Kratochvil Date: Thu Jul 30 20:48:14 2015 +0200 mainbuildid commit 7502e0f27a4c4cc2de93772cec605433f72da870 Author: Jan Kratochvil Date: Thu Jul 30 20:31:46 2015 +0200 hexallocate commit 6f6dc7ffcfa08facd55e55e9889156b36085d9d3 Author: Jan Kratochvil Date: Tue Jul 28 22:13:31 2015 +0200 buildid commit ca2b6169c11f974af7944bee906612b21372c9b4 Author: Jan Kratochvil Date: Tue Jul 28 22:12:52 2015 +0200 buildidproto commit ca6232d06bc4517a99919e29e91f515bef5fb162 Author: Jan Kratochvil Date: Wed Jul 29 21:38:45 2015 +0200 buildidtobfd commit be6b238478be554663c3fe3324488841ff13c4e7 Author: Jan Kratochvil Date: Wed Jul 29 19:52:47 2015 +0200 buildidforcemove commit 600a5e1c4f32c2c6b31cb856553c36a365a5580a Author: Jan Kratochvil Date: Thu Jul 30 23:07:10 2015 +0200 buildidfreefix commit 8cce31c49ad425dd1b23f5ff3b18e6ba928c5492 Author: Jan Kratochvil Date: Sat Jul 25 23:11:36 2015 +0200 openp commit deea42476fd8f7f148f5a0f76d157b03fb751246 Author: Jan Kratochvil Date: Wed Jul 29 22:49:17 2015 +0200 filelib ----------------------------------------------------------------------- Summary of changes: gdb/defs.h | 2 + gdb/nto-tdep.c | 10 ++-- gdb/solib.c | 112 +++++++++++++++++----------------- gdb/source.c | 185 +++++++++++++++++++++++++++++-------------------------- gdb/source.h | 10 ++- gdb/symfile.c | 30 +++------ 6 files changed, 178 insertions(+), 171 deletions(-) First 500 lines of diff: diff --git a/gdb/defs.h b/gdb/defs.h index 59db425..2e91d83 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -327,6 +327,8 @@ extern int openp (const char *, enum openp_flags, const char *, 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, size_t build_idsz, const gdb_byte *build_id); + extern int source_full_path_of (const char *, char **); extern void mod_path (char *, char **); diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index d5644e4..5bb0e7f 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -90,7 +90,7 @@ nto_find_and_open_solib (char *solib, size_t build_idsz, const gdb_byte *build_i const char *base; const char *arch; int arch_len, len; - struct file_location result; + struct file_location file; #define PATH_FMT \ "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll" @@ -129,10 +129,10 @@ nto_find_and_open_solib (char *solib, size_t build_idsz, const gdb_byte *build_i arch_path); base = lbasename (solib); - result = openp_result (buf, OPF_TRY_CWD_FIRST | OPF_IS_BFD, base, build_idsz, build_id); - if (file_location_is_valid (&result) || base == solib) - return result; - file_location_free (&result); + 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, 1 /* is_bfd */, build_idsz, build_id); diff --git a/gdb/solib.c b/gdb/solib.c index 361382d..d9c5718 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -162,7 +162,7 @@ solib_find_3 (char *in_pathname, int is_bfd, int is_solib, const char *sysroot_o struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); char *sysroot; int prefix_len, orig_prefix_len; - struct file_location result; + struct file_location file; /* If the absolute prefix starts with "target:" but the filesystem accessed by the target_fileio_* methods is the local filesystem @@ -252,13 +252,13 @@ solib_find_3 (char *in_pathname, int is_bfd, int is_solib, const char *sysroot_o } /* Now see if we can open it. */ - result = file_location_from_filename (temp_pathname, is_bfd, build_idsz, build_id); - if (file_location_is_valid (&result)) + file = file_location_from_filename (temp_pathname, is_bfd, build_idsz, build_id); + if (file_location_is_valid (&file)) { do_cleanups (old_chain); - return result; + return file; } - file_location_free (&result); + file_location_free (&file); xfree (temp_pathname); @@ -280,13 +280,13 @@ solib_find_3 (char *in_pathname, int is_bfd, int is_solib, const char *sysroot_o in_pathname + 2, (char *) NULL); xfree (drive); - result = file_location_from_filename (temp_pathname, is_bfd, build_idsz, build_id); - if (file_location_is_valid (&result)) + file = file_location_from_filename (temp_pathname, is_bfd, build_idsz, build_id); + if (file_location_is_valid (&file)) { do_cleanups (old_chain); - return result; + return file; } - file_location_free (&result); + file_location_free (&file); xfree (temp_pathname); @@ -300,13 +300,13 @@ solib_find_3 (char *in_pathname, int is_bfd, int is_solib, const char *sysroot_o need_dir_separator ? SLASH_STRING : "", in_pathname + 2, (char *) NULL); - result = file_location_from_filename (temp_pathname, is_bfd, build_idsz, build_id); - if (file_location_is_valid (&result)) + file = file_location_from_filename (temp_pathname, is_bfd, build_idsz, build_id); + if (file_location_is_valid (&file)) { do_cleanups (old_chain); - return result; + return file; } - file_location_free (&result); + file_location_free (&file); xfree (temp_pathname); } @@ -317,13 +317,13 @@ solib_find_3 (char *in_pathname, int is_bfd, int is_solib, const char *sysroot_o if (build_idsz != 0) { - result = build_id_to_file (build_idsz, build_id, "", is_bfd); - if (file_location_is_valid (&result)) + file = build_id_to_file (build_idsz, build_id, "", is_bfd); + if (file_location_is_valid (&file)) { do_cleanups (old_chain); - return result; + return file; } - file_location_free (&result); + file_location_free (&file); } /* If the search in gdb_sysroot failed, and the path name is @@ -345,10 +345,10 @@ solib_find_3 (char *in_pathname, int is_bfd, int is_solib, const char *sysroot_o solib_search_path (if any). */ if (is_solib && solib_search_path != NULL) { - result = openp_result (solib_search_path, OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), in_pathname, build_idsz, build_id); - if (file_location_is_valid (&result)) - return result; - file_location_free (&result); + file = openp_file (solib_search_path, OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), in_pathname, build_idsz, build_id); + if (file_location_is_valid (&file)) + return file; + file_location_free (&file); } /* If not found, and we're looking for a solib, next search the @@ -357,43 +357,43 @@ solib_find_3 (char *in_pathname, int is_bfd, int is_solib, const char *sysroot_o from the opened path. */ if (is_solib && solib_search_path != NULL) { - result = openp_result (solib_search_path, OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), target_lbasename (fskind, in_pathname), build_idsz, build_id); - if (file_location_is_valid (&result)) - return result; - file_location_free (&result); + file = openp_file (solib_search_path, OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), target_lbasename (fskind, in_pathname), build_idsz, build_id); + if (file_location_is_valid (&file)) + return file; + file_location_free (&file); } /* If not found, and we're looking for a solib, try to use target supplied solib search method. */ if (is_solib && ops->find_and_open_solib) { - result = ops->find_and_open_solib (in_pathname, build_idsz, build_id); - if (file_location_is_valid (&result)) - return result; - file_location_free (&result); + file = ops->find_and_open_solib (in_pathname, build_idsz, build_id); + if (file_location_is_valid (&file)) + return file; + file_location_free (&file); } /* If not found, next search the inferior's $PATH environment variable. */ if (strcmp (sysroot, "") == 0) { - result = openp_result (get_in_environ (current_inferior ()->environment, "PATH"), OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), in_pathname, build_idsz, build_id); - if (file_location_is_valid (&result)) - return result; - file_location_free (&result); + file = openp_file (get_in_environ (current_inferior ()->environment, "PATH"), OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), in_pathname, build_idsz, build_id); + if (file_location_is_valid (&file)) + return file; + file_location_free (&file); } /* If not found, and we're looking for a solib, next search the inferior's $LD_LIBRARY_PATH environment variable. */ if (is_solib && strcmp (sysroot, "") == 0) { - result = openp_result (get_in_environ (current_inferior ()->environment, "LD_LIBRARY_PATH"), OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), in_pathname, build_idsz, build_id); - if (file_location_is_valid (&result)) - return result; - file_location_free (&result); + file = openp_file (get_in_environ (current_inferior ()->environment, "LD_LIBRARY_PATH"), OPF_TRY_CWD_FIRST | (is_bfd ? OPF_IS_BFD : 0), in_pathname, build_idsz, build_id); + if (file_location_is_valid (&file)) + return file; + file_location_free (&file); } - file_location_init (&result); - return result; + file_location_init (&file); + return file; } static struct file_location @@ -401,7 +401,7 @@ solib_find_2 (char *in_pathname, int is_bfd, int is_solib, size_t build_idsz, co { VEC (char_ptr) *sysroot_vec; struct cleanup *back_to; - struct file_location result; + struct file_location file; char *sysroot; int ix; @@ -410,27 +410,27 @@ solib_find_2 (char *in_pathname, int is_bfd, int is_solib, size_t build_idsz, co for (ix = 0; VEC_iterate (char_ptr, sysroot_vec, ix, sysroot); ++ix) { - result = solib_find_3 (in_pathname, is_bfd, is_solib, sysroot, build_idsz, build_id); - if (file_location_is_valid (&result)) + file = solib_find_3 (in_pathname, is_bfd, is_solib, sysroot, build_idsz, build_id); + if (file_location_is_valid (&file)) { do_cleanups (back_to); - return result; + return file; } - file_location_free (&result); + file_location_free (&file); } do_cleanups (back_to); - return result; + return file; } static char * solib_find_1 (char *in_pathname, size_t build_idsz, const gdb_byte *build_id, int *fd, int is_solib) { - struct file_location result = solib_find_2 (in_pathname, 0 /* is_bfd */, is_solib, build_idsz, build_id); + struct file_location file = solib_find_2 (in_pathname, 0 /* is_bfd */, is_solib, build_idsz, build_id); char *retval; - if (!file_location_is_valid (&result)) + if (!file_location_is_valid (&file)) { retval = NULL; if (fd != NULL) @@ -438,15 +438,15 @@ solib_find_1 (char *in_pathname, size_t build_idsz, const gdb_byte *build_id, } else { - retval = xstrdup (result.filename); + retval = xstrdup (file.filename); if (fd != NULL) { - gdb_assert (result.fd != -1); - *fd = result.fd; - result.fd = -1; + gdb_assert (file.fd != -1); + *fd = file.fd; + file.fd = -1; } } - file_location_free (&result); + file_location_free (&file); return retval; } @@ -461,9 +461,9 @@ solib_find_1 (char *in_pathname, size_t build_idsz, const gdb_byte *build_id, char * exec_file_find (char *in_pathname, int *fd) { - char *result = solib_find_1 (in_pathname, 0 /* build_idsz */, NULL, fd, 0 /* is_solib */); + char *file = solib_find_1 (in_pathname, 0 /* build_idsz */, NULL /* build_id */, fd, 0 /* is_solib */); - if (result == NULL) + if (file == NULL) { const char *fskind = effective_target_file_system_kind (); @@ -475,11 +475,11 @@ exec_file_find (char *in_pathname, int *fd) strcpy (new_pathname, in_pathname); strcat (new_pathname, ".exe"); - result = solib_find_1 (new_pathname, 0 /* build_idsz */, NULL, fd, 0 /* is_solib */); + file = solib_find_1 (new_pathname, 0 /* build_idsz */, NULL, fd, 0 /* is_solib */); } } - return result; + return file; } /* Return the full pathname of a shared library file, or NULL if not diff --git a/gdb/source.c b/gdb/source.c index 3894bd6..6fdf571 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -738,53 +738,53 @@ dirnames_to_char_ptr_vec_target_exc (const char *string) } void -file_location_init (struct file_location *result) +file_location_init (struct file_location *file) { - memset (result, 0, sizeof (*result)); - result->fd = -1; + memset (file, 0, sizeof (*file)); + file->fd = -1; } void -file_location_free (struct file_location *result) +file_location_free (struct file_location *file) { - if (result->fd != -1) + if (file->fd != -1) { - if (is_target_filename (result->filename)) + if (is_target_filename (file->filename)) { int target_errno; - target_fileio_close (result->fd, &target_errno); + target_fileio_close (file->fd, &target_errno); } else - close (result->fd); + close (file->fd); } - gdb_bfd_unref (result->abfd); - xfree (result->filename); + gdb_bfd_unref (file->abfd); + xfree (file->filename); } static void -file_location_cleanup (void *result_voidp) +file_location_cleanup (void *file_voidp) { - file_location_free (result_voidp); + file_location_free (file_voidp); } int -file_location_is_valid (const struct file_location *result) +file_location_is_valid (const struct file_location *file) { - return result->abfd != NULL || result->filename != NULL; + return file->abfd != NULL || file->filename != NULL; } struct file_location file_location_from_filename (const char *filename, int is_bfd, size_t build_idsz, const gdb_byte *build_id) { - struct file_location result; + struct file_location file; int load_via_target = 0; int fd_dup = -1; struct cleanup *back_to, *fd_dup_cleanup; - file_location_init (&result); - back_to = make_cleanup (file_location_cleanup, &result); - result.filename = xstrdup (filename); + file_location_init (&file); + back_to = make_cleanup (file_location_cleanup, &file); + file.filename = xstrdup (filename); if (is_target_filename (filename)) { @@ -806,52 +806,52 @@ file_location_from_filename (const char *filename, int is_bfd, size_t build_idsz { int target_errno; - result.fd = target_fileio_open (current_inferior (), + file.fd = target_fileio_open (current_inferior (), filename, FILEIO_O_RDONLY, 0, &target_errno); - if (result.fd == -1) + if (file.fd == -1) { - result.file_errno = fileio_errno_to_host (target_errno); + file.file_errno = fileio_errno_to_host (target_errno); discard_cleanups (back_to); - return result; + return file; } } else { /* WRITE_FILES is ignored if !IS_BFD. */ - result.fd = gdb_open_cloexec (filename, O_RDONLY | O_BINARY, 0); - if (result.fd == -1) + file.fd = gdb_open_cloexec (filename, O_RDONLY | O_BINARY, 0); + if (file.fd == -1) { - result.file_errno = errno; + file.file_errno = errno; discard_cleanups (back_to); - return result; + return file; } } if (build_idsz == 0 && !is_bfd) { discard_cleanups (back_to); - return result; + return file; } fd_dup_cleanup = make_cleanup (null_cleanup, NULL); if (!is_bfd) { - fd_dup = dup (result.fd); + fd_dup = dup (file.fd); if (fd_dup == -1) { - result.file_errno = errno; - close (result.fd); - result.fd = -1; + file.file_errno = errno; + close (file.fd); + file.fd = -1; discard_cleanups (back_to); - return result; + return file; } make_cleanup_close (fd_dup); } if (write_files && !load_via_target) - result.abfd = gdb_bfd_fopen (filename, gnutarget, FOPEN_RUB, result.fd); + file.abfd = gdb_bfd_fopen (filename, gnutarget, FOPEN_RUB, file.fd); else { char *canonical; @@ -864,16 +864,16 @@ file_location_from_filename (const char *filename, int is_bfd, size_t build_idsz else canonical = gdb_realpath (filename); canonical_cleanup = make_cleanup (xfree, canonical); - result.abfd = gdb_bfd_open (canonical, gnutarget, result.fd); + file.abfd = gdb_bfd_open (canonical, gnutarget, file.fd); do_cleanups (canonical_cleanup); } - result.fd = -1; - if (result.abfd == NULL) + file.fd = -1; + if (file.abfd == NULL) { - result.bfderr = bfd_get_error (); + file.bfderr = bfd_get_error (); do_cleanups (fd_dup_cleanup); discard_cleanups (back_to); - return result; + return file; } if (build_idsz == 0) @@ -881,72 +881,83 @@ file_location_from_filename (const char *filename, int is_bfd, size_t build_idsz gdb_assert (is_bfd); gdb_assert (fd_dup == -1); discard_cleanups (back_to); - return result; + return file; } - if (!build_id_verify (result.abfd, build_idsz, build_id)) + if (!build_id_verify (file.abfd, build_idsz, build_id)) { do_cleanups (back_to); - file_location_init (&result); - return result; + file_location_init (&file); + return file; } gdb_assert (!is_bfd == (fd_dup != -1)); if (!is_bfd) { - gdb_bfd_unref (result.abfd); - result.abfd = NULL; - gdb_assert (result.fd == -1); - result.fd = fd_dup; - gdb_assert (result.fd != -1); + gdb_bfd_unref (file.abfd); + file.abfd = NULL; + gdb_assert (file.fd == -1); + file.fd = fd_dup; + gdb_assert (file.fd != -1); } discard_cleanups (back_to); - return result; + return file; +} + +bfd * +file_location_to_bfd (struct file_location file) hooks/post-receive -- Repository for Project Archer.