public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: jkratoch@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  jankratochvil/gdbserverbuildid: mainbuildid
Date: Mon, 17 Aug 2015 20:54:00 -0000	[thread overview]
Message-ID: <20150817205401.24069.qmail@sourceware.org> (raw)

The branch, jankratochvil/gdbserverbuildid has been updated
  discards  aa180b0c7f35cb8f20ffec5d74e9c63a88b422a0 (commit)
  discards  37b4f6ecd060252c96287ecc5e6c17476065b37d (commit)
  discards  37b7a7dc41042cd194d42e4b51ec62a76b67909f (commit)
  discards  e70bc7d408e34e531db1a3374fc4d8ba3966727f (commit)
  discards  b10b37757831c1d24112dae16c956a5aced002c8 (commit)
  discards  4db67c2978ebc2bab19838a0a4dc938595541856 (commit)
  discards  1fbb639307854a32484a4c24440214cd095b1dd3 (commit)
  discards  c5420b36ebe6cee180207253abb8c5807828f51c (commit)
  discards  f2291abd5dd1bf7eb65d304cd59da2ef00c4820f (commit)
  discards  0e45553a30b2b8b8adeb0a00a0eed1ab0f37eabf (commit)
  discards  3a8a0b30b2dccbed430eb6c38da165a9fde1feef (commit)
  discards  cfe1119c0322114641aee215f9e5f5293b723e82 (commit)
  discards  ab4afa2535c0182dc528a1e867c3f57b5d8292c4 (commit)
  discards  ff4f9d48102ed472ca527b52640fabc5f750c2cc (commit)
  discards  3754f48adfbdb91c9005e8945f910772c76e1c26 (commit)
  discards  15ee2159ec7f57bd4daa3e404baa41cee9f76637 (commit)
  discards  14cc6806a7ea29ab4b66d7353952d4a05d86ed89 (commit)
  discards  4ad6a791530bc04da99b523d6e7510b195d2543f (commit)
  discards  0f7e18c01c27f2b1ad53c6f8882db8752405ebb9 (commit)
  discards  46a81d5758e65c73e7e4eaf5257c6ff341c068a3 (commit)
  discards  51a6ed4c87273fe52e81b7947dd4ee3c878d3870 (commit)
  discards  116a250b31b5665873c7c58da676528520565f40 (commit)
  discards  6ae7a094e89cdcb07d56586f8c3b9986f0bce700 (commit)
  discards  5ca7075e738daca657d39426377c29632e832b07 (commit)
  discards  7038751dcc9c65cf412ff977869d614d233d7aa0 (commit)
  discards  af7cb14bcbbcaabbc8e0edb9dbe99e2ca4d56af3 (commit)
  discards  e67b73dbb7068902c37ef2e08caf3e0f70421832 (commit)
  discards  73ed2df5ca2a88300086c72adf5cf88961c3e0dd (commit)
  discards  e9100478ca7b48f167372bc4c0578df868cc5302 (commit)
  discards  d68335080a1989970d4a5dfcd16d32954f7b520d (commit)
       via  a4faa57625e8354219ccc5c0c22ed64d30990a9c (commit)
       via  e409aea34676677025d83d1b0ca5153b1ddc1b00 (commit)
       via  ef91dfde292089e454f63342bf4cc6b5fc51b048 (commit)
       via  b65862108ecb81b2f5bdd4b7325ca7cea8fba2da (commit)
       via  c042c3a5c6209625cad0a2671d4a146b6f942e32 (commit)
       via  3d1add591c515f8f5bdbc0e9cf0d60d0ca4e0810 (commit)
       via  e7b2efaeddb23cb53b3fb0e60a58f14d5bd547da (commit)
       via  463b80107127bbceee4b146197d576a315594869 (commit)
       via  3ec45cbb78911212f77a261f7e62d49144b1d7ac (commit)
       via  249f0191c52a135cbfc7721d0cdc8f783a965603 (commit)
       via  944f86c952083e8f022921226a18ff34d7f08f1a (commit)
       via  233fa00f011d0b2dedaa6680431f454f15d74741 (commit)
       via  d0bd1ea6bc0dd7b4b0cd6c8a140066b08b019141 (commit)
       via  d8d61243c6a097dddf7b7224c4fe488dbe0b41a5 (commit)
       via  f1661fce9fefd5e3190a75520fbb7f22a0b104dc (commit)
       via  d2b3d4db62cb5466a997ad9a278e5e8884c64838 (commit)
       via  2020b631c3e55c8bff0162e6403748af93021451 (commit)
       via  8b8251d655e27031fe477776f346a3f4ab2ba4ab (commit)
       via  740940f25b9788f8e96881cc53dde8566c9861bf (commit)
       via  689d3b1eab59efe92fc7fef265df74cdec16ea41 (commit)
       via  cee275608439f3e18a6b35132dca4a520b86b635 (commit)
       via  174fa76532b7de4ab71abb8265caacc3f494fb1d (commit)
       via  765f034443db1384d1896ae154817187a281bec9 (commit)
       via  f445c8ebbca61b6be9a9c39d7c6b83803bc788c6 (commit)
       via  aada6c38c98e1d611550d3ea09f79c271336c8f1 (commit)
       via  6ef1a4beb8acba2f1b796cb76878a02830b01dba (commit)
       via  95d808aa74c22213702c684daec079a23c50431a (commit)
       via  148c1b780165bb005eb0589b759d94c3298b489a (commit)
       via  199878b64f2627b21199d5f934405e7fb3c70d57 (commit)
       via  0901913cf7b0dad6ddf01241b20af881eb7a43f2 (commit)
      from  aa180b0c7f35cb8f20ffec5d74e9c63a88b422a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a4faa57625e8354219ccc5c0c22ed64d30990a9c
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:19 2015 +0200

    mainbuildid

commit e409aea34676677025d83d1b0ca5153b1ddc1b00
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Aug 16 22:11:19 2015 +0200

    sticky
    
    Message-ID: <559A7C37.6020501@redhat.com>
    
    On 07/03/2015 04:44 PM, Pedro Alves wrote:
    
    > (I still suspect that if we reverse the sense of the flag, then
    > its management ends up being more centralized, as then the
    > place that sets it is also the place that needs to check it,
    > instead of doing that in multiple places.  But, see below.)
    
    It didn't seem fair to impose a subjective preference, so I tried
    this in order to understand it myself, and I now agree that is really
    doesn't make much difference, as then we'd have to mark
    auto-discovered in a few more places that I wasn't originally
    seeing.  There's at least the execd handling in infrun.c, and
    also spu_symbol_file_add_from_memory.
    
    As I was playing with this already, I poked at the other review
    points I made, and came up with the variant of the patch below.
    
    > This function is called while the passed in PID is not the
    > current inferior.  E.g., the remote_add_inferior path.
    >
    > Therefore seems to me that these symbol_file_add_main / exec_file_attach
    > calls can change the symbols of the wrong inferior.
    
    ...
    
    > I also notice that reread_symbols has an exec_file_attach
    > call which seems to me results in losing the is_user_supplied
    > flag if the executable's timestamp changed, at least here:
    >
    >> +  /* Attempt to open the file that was executed to create this
    >> +     inferior.  If the user has explicitly specified executable
    >> +     and/or symbol files then warn the user if their choices do
    >> +     not match.  Otherwise, set exec_file and symfile_objfile to
    >> +     the new file.  */
    >> +  exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty);
    >> +
    >> +  if (exec_file_is_user_supplied)
    >>      {
    >>        reopen_exec_file ();
    >>        reread_symbols ();
    >
    >
    > I also notice that the clone-inferior command ends up with
    > an exec_file_attach call in clone_program_space.  That one
    > should probably be setting the is_user_supplied flag too,
    > I'd think.  Or at least, copying it from the original.
    >
    > At this point, I'm wondering about adding a parameter to
    > exec_file_attach to force considering (now and in future)
    > the right value to put in the flag in each case.
    
    I tried this too (see patch below).  As this requires touching the user-supplied
    paths anyway, it didn't really matter to tag files user-supplied or
    auto-discovered, so I reverted back to user-supplied.  For symbols,
    we already have the add_flags, so I added SYMFILE_USER_SUPPLIED instead
    of a new boolean.
    
    >
    >> @@ -2490,11 +2490,14 @@ attach_command_post_wait (char *args, int from_tty, int async_exec)
    >>    inferior = current_inferior ();
    >>    inferior->control.stop_soon = NO_STOP_QUIETLY;
    >>
    >> -  /* If no exec file is yet known, try to determine it from the
    >> -     process itself.  */
    >> -  if (get_exec_file (0) == NULL)
    >> -    exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty);
    >> -  else
    >> +  /* Attempt to open the file that was executed to create this
    >> +     inferior.  If the user has explicitly specified executable
    >> +     and/or symbol files then warn the user if their choices do
    >> +     not match.  Otherwise, set exec_file and symfile_objfile to
    >> +     the new file.  */
    >> +  exec_file_locate_attach (ptid_get_pid (inferior_ptid), from_tty);
    >> +
    >> +  if (exec_file_is_user_supplied)
    >>      {
    >>        reopen_exec_file ();
    >>        reread_symbols ();
    >
    > It seems to me that we should be able to move these reopen/reread
    > calls inside exec_file_locate_attach.
    
    I did this too.
    
    What do you think of the version below?
    
    I also tweaked the warnings a bit, to explicitly say "mismatch".
    
    This would still need docs/NEWS changes, and a test would be good too.

commit ef91dfde292089e454f63342bf4cc6b5fc51b048
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:19 2015 +0200

    hexallocate

commit b65862108ecb81b2f5bdd4b7325ca7cea8fba2da
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:19 2015 +0200

    locatetest

commit c042c3a5c6209625cad0a2671d4a146b6f942e32
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:19 2015 +0200

    Tests for validate symbol file using build-id
    
    New testcase.
    
    gdb/testsuite/ChangeLog
    2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    
    	Tests for validate symbol file using build-id.
    	* gdb.base/solib-mismatch-lib.c: New file.
    	* gdb.base/solib-mismatch-libmod.c: New file.
    	* gdb.base/solib-mismatch.c: New file.
    	* gdb.base/solib-mismatch.exp: New file.

commit 3d1add591c515f8f5bdbc0e9cf0d60d0ca4e0810
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:18 2015 +0200

    buildidwarn

commit e7b2efaeddb23cb53b3fb0e60a58f14d5bd547da
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:18 2015 +0200

    buildidsolibbfdopen

commit 463b80107127bbceee4b146197d576a315594869
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:18 2015 +0200

    buildidverify

commit 3ec45cbb78911212f77a261f7e62d49144b1d7ac
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:18 2015 +0200

    buildidsolibsearch

commit 249f0191c52a135cbfc7721d0cdc8f783a965603
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:18 2015 +0200

    buildidtofile

commit 944f86c952083e8f022921226a18ff34d7f08f1a
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:17 2015 +0200

    buildidproto

commit 233fa00f011d0b2dedaa6680431f454f15d74741
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:17 2015 +0200

    buildidtobfd

commit d0bd1ea6bc0dd7b4b0cd6c8a140066b08b019141
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:17 2015 +0200

    buildidforcemove

commit d8d61243c6a097dddf7b7224c4fe488dbe0b41a5
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:17 2015 +0200

    buildidfreefix

commit f1661fce9fefd5e3190a75520fbb7f22a0b104dc
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:16 2015 +0200

    openpsymfile

commit d2b3d4db62cb5466a997ad9a278e5e8884c64838
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:16 2015 +0200

    openpsolib

commit 2020b631c3e55c8bff0162e6403748af93021451
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:16 2015 +0200

    openp

commit 8b8251d655e27031fe477776f346a3f4ab2ba4ab
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:16 2015 +0200

    filelib

commit 740940f25b9788f8e96881cc53dde8566c9861bf
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:15 2015 +0200

    openfromtargetdoclose

commit 689d3b1eab59efe92fc7fef265df74cdec16ea41
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:15 2015 +0200

    openfromtargetfd

commit cee275608439f3e18a6b35132dca4a520b86b635
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:15 2015 +0200

    openfromtarget

commit 174fa76532b7de4ab71abb8265caacc3f494fb1d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:14 2015 +0200

    openpnullpathname

commit 765f034443db1384d1896ae154817187a281bec9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:14 2015 +0200

    openpmode

commit f445c8ebbca61b6be9a9c39d7c6b83803bc788c6
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:14 2015 +0200

    openppath

commit aada6c38c98e1d611550d3ea09f79c271336c8f1
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:13 2015 +0200

    openpenum

commit 6ef1a4beb8acba2f1b796cb76878a02830b01dba
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:13 2015 +0200

    sysrootdefault

commit 95d808aa74c22213702c684daec079a23c50431a
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:13 2015 +0200

    sysrootdelim

commit 148c1b780165bb005eb0589b759d94c3298b489a
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Aug 13 16:17:12 2015 +0200

    sysrootconst

commit 199878b64f2627b21199d5f934405e7fb3c70d57
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sat Aug 15 11:38:53 2015 +0200

    Validate symbol file using build-id
    
    Consumer part of the "build-id" attribute.
    
    gdb/ChangeLog
    2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    	    Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	Validate symbol file using build-id.
    	* NEWS (Changes since GDB 7.10): Add 'set validate-build-id'
    	and 'show validate-build-id'.  Add build-id attribute.
    	* solib-darwin.c (_initialize_darwin_solib): Assign validate value.
    	* solib-dsbt.c (_initialize_dsbt_solib): Ditto.
    	* solib-frv.c (_initialize_frv_solib): Ditto.
    	* solib-spu.c (set_spu_solib_ops): Ditto.
    	* solib-svr4.c: Include rsp-low.h.
    	(NOTE_GNU_BUILD_ID_NAME): New define.
    	(svr4_validate): New function.
    	(svr4_copy_library_list): Duplicate field build_id.
    	(library_list_start_library): Parse 'build-id' attribute.
    	(svr4_library_attributes): Add 'build-id' attribute.
    	(_initialize_svr4_solib): Assign validate value.
    	* solib-target.c (solib.h): Include.
    	(_initialize_solib_target): Assign validate value.
    	* solib.c (validate_build_id, show_validate_build_id): New.
    	(solib_map_sections): Use ops->validate.
    	(clear_so): Free build_id.
    	(default_solib_validate): New function.
    	(_initialize_solib): Add "validate-build-id".
    	* solib.h (default_solib_validate): New declaration.
    	* solist.h (struct so_list): New fields 'build_idsz' and 'build_id'.
    	(target_so_ops): New field 'validate'.
    
    gdb/doc/ChangeLog
    2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb.texinfo (Files): Add 'set validate-build-id'
    	and 'show validate-build-id'.

commit 0901913cf7b0dad6ddf01241b20af881eb7a43f2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sat Aug 15 11:38:52 2015 +0200

    gdbserver build-id attribute generator
    
    Producer part of the new "build-id" XML attribute.
    
    gdb/ChangeLog
    2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    	    Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	gdbserver build-id attribute generator.
    	* features/library-list-svr4.dtd (library-list-svr4): New
    	'build-id' attribute.
    
    gdb/doc/ChangeLog
    2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    	    Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	gdbserver build-id attribute generator.
    	* gdb.texinfo (Library List Format for SVR4 Targets): Add
    	'build-id' in description, example, new attribute in dtd.
    
    gdb/gdbserver/ChangeLog
    2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    	    Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	gdbserver build-id attribute generator.
    	* linux-low.c (linux-maps.h, search.h, rsp-low.h): Include.
    	(ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New.
    	(ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New.
    	(find_phdr): New.
    	(get_dynamic): Use find_pdhr to traverse program headers.
    	(struct mapping_entry, mapping_entry_s, free_mapping_entry_vec)
    	(compare_mapping_entry_range, struct find_memory_region_callback_data)
    	(read_build_id, find_memory_region_callback, lrfind_mapping_entry)
    	(get_hex_build_id): New.
    	(linux_qxfer_libraries_svr4): Add optional build-id attribute
    	to reply XML document.

-----------------------------------------------------------------------

Summary of changes:
 gdb/build-id.c                           |    8 ++++-
 gdb/build-id.h                           |    4 +-
 gdb/dwarf2read.c                         |    2 +-
 gdb/exec.c                               |   18 ++++++---
 gdb/gdbserver/linux-low.c                |    7 +++-
 gdb/solib-svr4.c                         |   11 +++---
 gdb/source.c                             |    2 +-
 gdb/testsuite/gdb.base/main-mismatch.exp |   55 ++++++++++++++----------------
 8 files changed, 60 insertions(+), 47 deletions(-)

First 500 lines of diff:
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 1db4099..59c0265 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -62,7 +62,7 @@ build_id_bfd_get (bfd *abfd)
 /* See build-id.h.  */
 
 int
-build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
+build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check, int advice)
 {
   const struct bfd_build_id *found = build_id_bfd_get (abfd);
   char *message, *check_hex = alloca (check_len * 2 + 1);
@@ -88,6 +88,12 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
     return 1;
   back_to = make_cleanup (xfree, message);
 
+  if (!advice)
+    {
+      warning ("%s", message);
+      do_cleanups (back_to);
+      return !validate_build_id;
+    }
   if (validate_build_id)
     {
       warning (_("Symbol file \"%s\" could not be validated (%s) and "
diff --git a/gdb/build-id.h b/gdb/build-id.h
index 0924f72..1280824 100644
--- a/gdb/build-id.h
+++ b/gdb/build-id.h
@@ -27,8 +27,8 @@ extern const struct bfd_build_id *build_id_bfd_get (bfd *abfd);
 /* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value.
    Otherwise, issue a warning and return false.  */
 
-extern int build_id_verify (bfd *abfd,
-			    size_t check_len, const bfd_byte *check);
+extern int build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check,
+			    int advice);
 
 extern struct file_location build_id_to_file (size_t build_id_len, const bfd_byte *build_id, const char *suffix, enum openp_flags opts);
 
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b2463da..bf1b51c 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2495,7 +2495,7 @@ dwarf2_get_dwz_file (void)
   dwz_bfd = gdb_bfd_open (filename, gnutarget, -1);
   if (dwz_bfd != NULL)
     {
-      if (!build_id_verify (dwz_bfd, buildid_len, buildid))
+      if (!build_id_verify (dwz_bfd, buildid_len, buildid, 1 /* advice */))
 	{
 	  gdb_bfd_unref (dwz_bfd);
 	  dwz_bfd = NULL;
diff --git a/gdb/exec.c b/gdb/exec.c
index aeec5c2..e735be5 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -35,6 +35,7 @@
 #include "progspace.h"
 #include "gdb_bfd.h"
 #include "gcore.h"
+#include "build-id.h"
 
 #include <fcntl.h>
 #include "readline/readline.h"
@@ -143,21 +144,21 @@ exec_file_and_symbols_resync (struct inferior *inf, int from_tty)
 {
   char *exec_file, *full_exec_path = NULL;
   struct cleanup *old_chain = save_current_program_space ();
+  size_t build_idsz;
+  gdb_byte *build_id;
+
 
   /* Switch over temporarily, while reading executable and
      symbols.  */
   set_current_program_space (inf->pspace);
 
+  solib_main_build_id (&build_idsz, &build_id);
+  make_cleanup (xfree, build_id);
+
   /* Try to determine a filename from the process itself.  */
   exec_file = target_pid_to_exec_file (inf->pid);
   if (exec_file != NULL)
     {
-      size_t build_idsz;
-      gdb_byte *build_id;
-
-      solib_main_build_id (&build_idsz, &build_id);
-      make_cleanup (xfree, build_id);
-
       /* 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))
@@ -183,6 +184,8 @@ exec_file_and_symbols_resync (struct inferior *inf, int from_tty)
 	warning (_("Detected exec-file mismatch on %s.  Running %s; Loaded %s"),
 		 target_pid_to_str (pid_to_ptid (inf->pid)),
 		 full_exec_path, exec_filename);
+      if (build_idsz != 0)
+	build_id_verify (exec_bfd, build_idsz, build_id, 0 /* advice */);
       reopen_exec_file ();
     }
   else if (full_exec_path != NULL)
@@ -197,6 +200,9 @@ exec_file_and_symbols_resync (struct inferior *inf, int from_tty)
 	warning (_("Detected symbol-file mismatch on %s.  Running %s; Loaded %s"),
 		 target_pid_to_str (pid_to_ptid (inf->pid)),
 		 full_exec_path, symbol_filename);
+
+      if (build_idsz != 0)
+	build_id_verify (symfile_objfile->obfd, build_idsz, build_id, 0 /* advice */);
     }
   else if (full_exec_path != NULL)
     symbol_file_add_main (0, full_exec_path, from_tty);
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 2bd7b02..76a1430 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6773,8 +6773,11 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
   struct find_memory_region_callback_data data;
   
   /* COREFILTER_ANON_PRIVATE and COREFILTER_ANON_SHARED do not have an
-     associated file so it is not expected it could have an ELF header.  */ 
-  const enum filterflags filterflags = (COREFILTER_MAPPED_PRIVATE
+     associated file but they may represent a " (deleted)" file with
+     valid ELF header.  */ 
+  const enum filterflags filterflags = (COREFILTER_ANON_PRIVATE
+					| COREFILTER_ANON_SHARED
+					| COREFILTER_MAPPED_PRIVATE
 					| COREFILTER_MAPPED_SHARED
 					| COREFILTER_ELF_HEADERS
 					| COREFILTER_HUGETLB_PRIVATE
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 196c96a..c6e9f04 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1246,9 +1246,10 @@ svr4_library_list_start_list (struct gdb_xml_parser *parser,
   struct svr4_library_list *list = user_data;
   const char *version = xml_find_attribute (attributes, "version")->value;
   struct gdb_xml_value *main_lm = xml_find_attribute (attributes, "main-lm");
-  const struct gdb_xml_value *const att_build_id
-    = xml_find_attribute (attributes, "build-id");
-  const char *const hex_build_id = att_build_id ? att_build_id->value : NULL;
+  const struct gdb_xml_value *const att_main_build_id
+    = xml_find_attribute (attributes, "main-build-id");
+  const char *const main_hex_build_id = (att_main_build_id
+					 ? att_main_build_id->value : NULL);
 
   if (strcmp (version, "1.0") != 0)
     gdb_xml_error (parser,
@@ -1257,8 +1258,8 @@ svr4_library_list_start_list (struct gdb_xml_parser *parser,
 
   if (main_lm)
     list->main_lm = *(ULONGEST *) main_lm->value;
-  hex2bin_allocate (hex_build_id, &list->main_build_id, &list->main_build_idsz,
-		    _("main executable"));
+  hex2bin_allocate (main_hex_build_id, &list->main_build_id,
+		    &list->main_build_idsz, _("main executable"));
 }
 
 /* The allowed elements and attributes for an XML library list.
diff --git a/gdb/source.c b/gdb/source.c
index a7e2561..8490d8b 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -899,7 +899,7 @@ file_location_from_filename (const char *filename, enum openp_flags opts, size_t
       return file;
     }
 
-  if (!build_id_verify (file.abfd, build_idsz, build_id))
+  if (!build_id_verify (file.abfd, build_idsz, build_id, 1 /* advice */))
     {
       do_cleanups (back_to);
       file_location_enoent (&file);
diff --git a/gdb/testsuite/gdb.base/main-mismatch.exp b/gdb/testsuite/gdb.base/main-mismatch.exp
index 3a5e18d..84129e2 100644
--- a/gdb/testsuite/gdb.base/main-mismatch.exp
+++ b/gdb/testsuite/gdb.base/main-mismatch.exp
@@ -70,40 +70,37 @@ if { [build_executable $testfile.exp $binmainfilegdb $srcmainfilegdb $exec_opts]
     return -1
 }
 
-proc main_matching_test { symsloaded } {
-    global gdb_prompt
-    global binmainfilerun
+set test_spawn_id [spawn_wait_for_attach $binmainfilerun]
+set testpid [spawn_id_get_pid $test_spawn_id]
 
-    clean_restart
+file copy -force $binmainfilegdb $binmainfilerun
 
-    set test_spawn_id [spawn_wait_for_attach $binmainfilerun]
-    set testpid [spawn_id_get_pid $test_spawn_id]
+clean_restart $binmainfilerun
 
-    set test "attach"
-    gdb_test_multiple "attach $testpid" "$test" {
-	-re "Attaching to program.*\r\n$gdb_prompt $" {
-	    pass "$test"
-	}
+#gdb_test "set debug remote 1"
+
+set test "attach"
+gdb_test_multiple "attach $testpid" "$test" {
+    -re "Attaching to process $testpid\r\n.*\r\n$gdb_prompt $" {
+	pass "$test"
     }
+}
 
-    if { $symsloaded } {
-	gdb_test "bt" " in main \[^\r\n\]*"
-    } else {
-	set test "bt"
-	gdb_test_multiple $test $test {
-	    -re " in main \[^\r\n\]*\r\n$gdb_prompt $" {
-		fail $test
-	    }
-	    -re "\r\n$gdb_prompt $" {
-		pass $test
-	    }
-	}
+set test "bt"
+gdb_test_multiple $test $test {
+    -re " in main \[^\r\n\]*\r\n$gdb_prompt $" {
+	fail $test
+    }
+    -re "\r\n$gdb_prompt $" {
+	pass $test
     }
+}
 
-    kill_wait_spawned_process $test_spawn_id
+kill_wait_spawned_process $test_spawn_id
 
-    return 0
-}
+return
+
+# gdb_test "bt" " in main \[^\r\n\]*"
 
 proc main_locate_test { solibfile symsloaded } {
   global binmainfiledirrun
@@ -129,7 +126,7 @@ file copy -force "${binmainfiledirgdb}/${binmainfilebase}" \
 
 # Test unstripped, .dynamic matching
 with_test_prefix "test unstripped, .dynamic matching" {
-  main_matching_test 0
+#  main_matching_test 0
 }
 
 # Keep original so for debugging purposes
@@ -142,7 +139,7 @@ if {$result != 0} {
 
 # Test --only-keep-debug, .dynamic matching so
 with_test_prefix "test --only-keep-debug" {
-  main_matching_test 0
+#  main_matching_test 0
 }
 
 # Test locating file by its build-id - if the regular filename does not match.
@@ -174,5 +171,5 @@ file copy -force "${binmainfilerun}" "${binmainfilegdb}"
 
 # Now test it does not mis-invalidate matching libraries
 with_test_prefix "test matching libraries" {
-  main_matching_test 1
+#  main_matching_test 1
 }


hooks/post-receive
--
Repository for Project Archer.


             reply	other threads:[~2015-08-17 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 20:54 jkratoch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-19 16:20 jkratoch
2015-08-18 20:50 jkratoch
2015-08-17 16:00 jkratoch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150817205401.24069.qmail@sourceware.org \
    --to=jkratoch@sourceware.org \
    --cc=archer-commits@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).