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: Support build-id for main executables
Date: Fri, 21 Aug 2015 20:56:00 -0000	[thread overview]
Message-ID: <20150821205653.64389.qmail@sourceware.org> (raw)

The branch, jankratochvil/gdbserverbuildid has been updated
  discards  b4e4b4764ce753d336d6b6de12c5ec5296bd4d2b (commit)
  discards  eae34a38b1b6073a6380a670f832abeb31ac8e3e (commit)
  discards  e30bfa019ec125c5c91edae344546a22c82b8fb5 (commit)
  discards  6e63fc41f7eb6f24fe07e39468576d5460816cfd (commit)
  discards  adf6af424c8843a91660a011d23492fd2775bd77 (commit)
  discards  75428cfacf113f24c18c011cd371f1c17d55927a (commit)
  discards  232606b55fd080d61dc80088be4f90273a42152b (commit)
  discards  2f69fd3f00008f55d525365efb264d1411ffe706 (commit)
  discards  157a9ea4235c203ffef98a1d01076b331a9dc7b3 (commit)
  discards  b81b03b2d5a74e42fb3db91683f2e2e21350e384 (commit)
  discards  46116c84f334482a7919c903e70e49302ded3113 (commit)
  discards  57b773b9c32050bf0171feef3890ce59dce04be7 (commit)
  discards  7126338cca73b4c8c626209d5135921be145c2a6 (commit)
  discards  8a46a0bb6d85d35867afff33b23f5141a4d44257 (commit)
  discards  52a72e3685e8d87315f61ab0eeb9abec75649c7e (commit)
  discards  406712ee5ea7c37d0f585ce576e1577135cf72fe (commit)
  discards  fa37623340e12495a724e520fa4c2c2419cc350c (commit)
  discards  08a325927e2c8cacb0c68f18394bb4a4aeea55cb (commit)
  discards  0092a2b7a1b7cb7cc73b9dbc663ffa4aff582738 (commit)
  discards  5c773a41ae721c2260f8bdd440b2352d2f9d8754 (commit)
  discards  1bf9fe0773948520ea46435f5cec76236384f898 (commit)
  discards  405b76a55bd811ecd691e330dc62ded0410a0398 (commit)
  discards  9190ee41e215de2239fb7fdfe1b350379e8fa406 (commit)
  discards  86c34d43e014fdde2a8ead404bccf250515a1c9b (commit)
  discards  0e392b9bb75d77f7b72f4e774c50471c28f86f5d (commit)
  discards  0a26b660f625479dd1b44f9399d8635f59496d25 (commit)
  discards  940be657e23cd76a0ccf1a40bec9b2d2ee3a1fe3 (commit)
       via  7bce29f38b898ec67253353fcaba5d28b586d5f8 (commit)
       via  c9d5a399077df5045baee43ac6c49c33bc9e7ea2 (commit)
       via  64bce16d58873a8e3f5c4e5cf65eceb287bc03ce (commit)
       via  93abb77b088733ae4d6fce5dd68fdd01636d541e (commit)
       via  b5345e50374931b0eaf83eb294c7df63c09eb904 (commit)
       via  a27f039a9b910b5f6bbb6a010d540ebb2c79bc26 (commit)
       via  9a40139b873ac7dda461d53f73354983bda3f301 (commit)
       via  5cf75d5606fc6851c8b5a2830670cb0bc7a7950d (commit)
       via  52b044071251b1bb45471dc892b0f0e1ff5c19c9 (commit)
       via  90980b9e455cd5a0cbb59b681025ab623240e0d6 (commit)
       via  c983ce6cb7f311e103e3163f64bce842e2487114 (commit)
       via  2b1b193832fc3a1183a9a95bd1af962d2ef0bbff (commit)
       via  6af974ef5b85c275830f3a3d71813c4add8936d2 (commit)
       via  54342970f11ed58b4839a0c7979d2bb73f5eae15 (commit)
       via  82d67fa4a55a7b04e43e592e654a7faa973be5df (commit)
       via  c67f00356d3bbd718307151f3ee3b9b2eaa53701 (commit)
       via  5e0c4cbdabe0893412a2308396892f02102c7616 (commit)
       via  cdc59a92f80bc6338783c0a28c72cf983ddbbd0b (commit)
       via  0715940c746aa9c9ea9f71ef0e30a13580db5528 (commit)
       via  2f22ecc85185c1109a23d101779813ac6e5abab4 (commit)
       via  63acab658b6c55bbfa9771505017040bb3ef0a18 (commit)
       via  779171c3b2bbc7023c1f32615ad6677c1f07c191 (commit)
       via  51aed3fba80dca8e18424a855ac19c5f19582e12 (commit)
       via  3d40c116d6b6f65070c2305759be4c76771fc5a2 (commit)
       via  f7fce11ee9f77c91b69bcf03d97b858e07d97ef4 (commit)
       via  fbd6de721a7bb03673dc4844b7f4494b285a4dee (commit)
       via  868c0d04b42a19fd622d99c32465601a148b29c8 (commit)
      from  b4e4b4764ce753d336d6b6de12c5ec5296bd4d2b (commit)

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

- Log -----------------------------------------------------------------
commit 7bce29f38b898ec67253353fcaba5d28b586d5f8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:56 2015 +0200

    Support build-id for main executables
    
    Hi,
    
    make all the existing shlibs build-id functionality working also for the main
    executables.
    
    I think target_so_ops::open_symbol_file_object() is already replaced by what
    exec_file_and_symbols_resync(), target_pid_to_exec_file() etc. does but
    open_symbol_file_object() has been forgotten.
    
    This patch adds target_so_ops::main_build_id() which could be possibly marged
    with open_symbol_file_object() but I made it a separate function as I think it
    is easier to rather remove target_so_ops::open_symbol_file_object().
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* NEWS (Changes since GDB 7.10): Mention also main-build-id.
    	* build-id.c (build_id_verify): Add parameter advice.
    	* build-id.h (build_id_verify): Likewise.
    	* dwarf2read.c (dwarf2_get_dwz_file): Update build_id_verify caller.
    	* exec.c: Include build-id.h.
    	(exec_file_and_symbols_resync): Detect and use build-id by
    	solib_main_build_id.
    	* features/library-list-svr4.dtd: Add main-build-id.
    	* solib-svr4.c (struct svr4_info, struct svr4_library_list): Add fields
    	main_build_idsz and main_build_id.
    	(hex2bin_allocate): Generalize messages to binary files.
    	(svr4_library_list_start_list): Parse main-build-id.
    	(svr4_library_list_attributes): Add main-build-id.
    	(svr4_current_sos_direct): Set svr4_info main_build_id*.
    	(svr4_main_build_id): New function.
    	(svr4_clear_solib): Clear svr4_info main_build_id*.
    	(_initialize_svr4_solib): Install svr4_main_build_id.
    	* solib.c (solib_main_build_id): New function.
    	* solist.h (struct target_so_ops): Add method main_build_id.
    	(solib_main_build_id): New prototype.
    	* source.c (file_location_from_filename): Update build_id_verify caller.
    
    gdb/gdbserver/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* linux-low.c (linux_qxfer_libraries_svr4): Print main-build-id.
    
    gdb/doc/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb.texinfo (Files): Add 'set validate-build-id'
    	and 'show validate-build-id'.
    
    gdb/testsuite/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb.base/main-mismatch-mod.c: New file.
    	* gdb.base/main-mismatch.c: New file.
    	* gdb.base/main-mismatch.exp: New file.

commit c9d5a399077df5045baee43ac6c49c33bc9e7ea2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:55 2015 +0200

    Make only user-specified executable and symbol filenames 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.
    
    ----------
    
    - pass user-supplied / auto-discovered as arguments to exec_file_attach and
      symbol_file_add_main
    
    - Change exec_file_locate_attach parameter from pid to inferior
      pointer.
    
    - Flip current program space temporarily to make sure we add/reload
      symbols to/of the right inferior/program space.
    
    - Move reopen_exec_file and reread_symbols calls inside
      exec_file_locate_attach.
    
    - Warning message tweaks.
    
    - Rename exec_file_locate_attach -> exec_file_and_symbols_resync

commit 64bce16d58873a8e3f5c4e5cf65eceb287bc03ce
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:55 2015 +0200

    Code cleanup: New hex2bin_allocate()
    
    Hi,
    
    make hex->bin parsing standalone, to be reused in later patch.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* solib-svr4.c (hex2bin_allocate): New function from ...
    	(library_list_start_library): ... here, call it.

commit 93abb77b088733ae4d6fce5dd68fdd01636d541e
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:55 2015 +0200

    testcase: Test also locating shlibs by build-id
    
    Hi,
    
    testcase from the previous patch tests verification of build-id in shared
    libraries found by their name.  This test adds testing that a library can be
    found by its build-id (debug-file-directory/.build-id/XX/YYYYY...YYYYY).
    
    
    Jan
    
    
    gdb/testsuite/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb.base/solib-mismatch.exp (nocrlf, expected_header): Make them
    	global.
    	(solib_locate_test): New function.

commit b5345e50374931b0eaf83eb294c7df63c09eb904
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:55 2015 +0200

    Tests for validate symbol file using build-id
    
    Hi,
    
    new testcase only.
    
    Jan
    
    
    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 a27f039a9b910b5f6bbb6a010d540ebb2c79bc26
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:55 2015 +0200

    build_id_verify: Make it more verbose
    
    Hi,
    
    it was discussed on this list that if build-ids do not match they should be
    printed for troubleshooting.  It is mostly independent from the other patches.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* build-id.c: Include rsp-low.h.
    	(build_id_verify): Print non-matching build-ids, update the messages.

commit 9a40139b873ac7dda461d53f73354983bda3f301
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:54 2015 +0200

    solib_bfd_open: Optimize opening twice
    
    Hi,
    
    this is one of the optimizations allowed by file_location that prevents opening
    file twice when target build-id is known and it needs to be verified.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* solib.c (solib_bfd_fopen): Replace solib_find and solib_bfd_fopen by
    	solib_find_file.

commit 5cf75d5606fc6851c8b5a2830670cb0bc7a7950d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:54 2015 +0200

    Verify the build-id
    
    Hi,
    
    now it is possible to filter-out from openp() search files with non-matching
    build-id.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* source.c: Include build-id.h.
    	(file_location_from_filename): Call build_id_verify for the build-id
    	parameters.

commit 52b044071251b1bb45471dc892b0f0e1ff5c19c9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:54 2015 +0200

    solib_find: Search also by build-id
    
    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.

commit 90980b9e455cd5a0cbb59b681025ab623240e0d6
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:54 2015 +0200

    build_id_to_bfd: Make it return file_location
    
    Hi,
    
    refactor build_id_to_bfd so that it returns file_location.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* build-id.c: Include source.h.
    	(build_id_to_bfd): Rename to ...
    	(build_id_to_file): ... here, return file_location, add parameter opts,
    	make it public.
    	(build_id_to_debug_bfd): Use build_id_to_file.
    	* build-id.h (build_id_to_file): New prototype.

commit c983ce6cb7f311e103e3163f64bce842e2487114
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:54 2015 +0200

    Add dummy build-id params to prototypes
    
    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.

commit 2b1b193832fc3a1183a9a95bd1af962d2ef0bbff
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:53 2015 +0200

    build_id_to_debug_bfd: Make it also non-.debug capable
    
    Hi,
    
    generalize the function by adding 'suffix' parameter.  To be reused later.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* build-id.c (build_id_to_debug_bfd): Rename to ...
    	(build_id_to_bfd): ... here, add parameter suffix.
    	(build_id_to_debug_bfd): New function.

commit 6af974ef5b85c275830f3a3d71813c4add8936d2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:53 2015 +0200

    symfile_bfd_open: Make it use openp_bfd()
    
    Hi,
    
    another function gets converted to the new API.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* symfile.c (symfile_bfd_open): Use openp_bfd instead of openp and
    	gdb_bfd_open.

commit 54342970f11ed58b4839a0c7979d2bb73f5eae15
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:53 2015 +0200

    solib_find: Make it use file_location
    
    Hi,
    
    refactor the solib*() code to use file_location functions.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* nto-tdep.c: Include source.h.
    	(nto_find_and_open_solib): Return file_location, remove parameter
    	temp_pathname.  Change openp to openp_file.
    	* nto-tdep.h (nto_find_and_open_solib): Update prototype.
    	* solib.c (solib_find_2): Rename to ...
    	(solib_find_3): ... here, return file_location, change parameter fd to
    	opts.  Change gdb_open_cloexec to file_location_from_filename and openp
    	to openp_file calls.
    	(solib_find_1): Rename to ...
    	(solib_find_2): ... here, return file_location, change parameter fd to
    	opts.
    	(solib_find_1): New function.
    	(solib_find): Rename to ...
    	(solib_find_file) ... here, return file_location, change parameter fd
    	to opts.
    	(solib_find): New function.
    	* solist.h (find_and_open_solib): Return file_location, remove
    	parameter temp_pathname.

commit 82d67fa4a55a7b04e43e592e654a7faa973be5df
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:53 2015 +0200

    Refactor openp() to return file_location
    
    Hi,
    
    openp() remains as a backward compatibility wrapper around renamed
    openp->openp_file().
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* defs.h (enum openp_flags): Remove OPF_OPEN_RW_TMP, add
    	OPF_BFD_CANONICAL.
    	(openp_bfd, openp_file): Add prototypes.
    	* exec.c (exec_file_attach): Replace openp by openp_bfd calls.
    	* source.c (file_location_from_filename): Support OPF_BFD_CANONICAL.
    	(openp, openp_bfd): New functions.
    	(openp): Rename to ...
    	(openp_file): ... here, return file_location, remove filename_opened
    	parameter.

commit c67f00356d3bbd718307151f3ee3b9b2eaa53701
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:53 2015 +0200

    Add file_location utility functions
    
    Hi,
    
    build id verification faces a problem current codebase calls openp() and
    similar functions which search many directories and after they find the file
    they return its filename.  Caller then typically opens that file as BFD.
    
    But to search the directories openp() needs to open each file it iterates to
    verify their build-id.  Then it would close the file and caller would reopen it
    again.  This is inefficient (+racy), so a new intermediate representation of
    the found files is created (file_location).
    
    Another possibility would be to depends on bfd cache as being done in
    exec_file_attach.  But then a similar problem is needed for callers which want
    only fd (and not bfd).  Besides that I find depending on pending
    make_cleanup_bfd_unref() from openp() calls would be tricky.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* defs.h (enum openp_flags): Add OPF_IS_BFD.
    	* gdb_bfd.c (fileio_errno_to_host): Make it public.
    	* gdb_bfd.h (fileio_errno_to_host): Add prototype.
    	* source.c: Include inferior.h and gdb/fileio.h.
    	(file_location_enoent, file_location_free, file_location_cleanup)
    	(file_location_is_valid, file_location_from_filename)
    	(file_location_to_bfd, filename_to_bfd): New functions.
    	* source.h (struct file_location): New definition.
    	(file_location_enoent, file_location_free, file_location_is_valid)
    	(file_location file_location_from_filename, file_location_to_bfd)
    	(filename_to_bfd): New prototypes.

commit 5e0c4cbdabe0893412a2308396892f02102c7616
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:52 2015 +0200

    gdb_bfd_open_from_target: Optionally do not close fd
    
    Hi,
    
    gdb_bfd_open_from_target currently always embedded passed fd into returned BFD
    and closed that fd after closing that BFD.  As one cannot do dup() for target
    fileio FDs one could not use FD after BFD using it has been closed.
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb_bfd.c (gdb_bfd_iovec_fileio_close_nop): New function.
    	(gdb_bfd_open_from_target): Add parameter do_close.  Optionally pass
    	gdb_bfd_iovec_fileio_close_nop.
    	(gdb_bfd_open): Update caller.
    	* gdb_bfd.h (gdb_bfd_open_from_target): Update prototype.

commit cdc59a92f80bc6338783c0a28c72cf983ddbbd0b
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:52 2015 +0200

    gdb_bfd_open_from_target: Support real fd
    
    Hi,
    
    gdb_bfd_open_from_target is extended so that it can be now passed also some
    non-(-1) fd.  non-(-1) fd was not supported for remote files in mainline.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb_bfd.c (gdb_bfd_iovec_fileio_open_fd): New function.
    	(gdb_bfd_open_from_target): Conditionally use it.

commit 0715940c746aa9c9ea9f71ef0e30a13580db5528
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:52 2015 +0200

    Provide new gdb_bfd_open_from_target
    
    Hi,
    
    later code needs to call the gdb_bfd_openr_iovec part of gdb_bfd_open with more
    special parameters.  So it is refactored out first (and extended later in the
    next patches).
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb_bfd.c (gdb_bfd_open_from_target): New function from ...
    	(gdb_bfd_open): ... here.  Call it.
    	* gdb_bfd.h (gdb_bfd_open_from_target): New prototype.

commit 2f22ecc85185c1109a23d101779813ac6e5abab4
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:52 2015 +0200

    Code cleanup: openp parameter filename_opened is never NULL
    
    Hi,
    
    this parameter is never passed as NULL in the codebase so the check can be
    removed.
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* source.c (openp): Update function comment for filename_opened.
    	Remove NULL check for filename_opened.

commit 63acab658b6c55bbfa9771505017040bb3ef0a18
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:51 2015 +0200

    Code cleanup: Remove openp parameter mode
    
    Hi,
    
    simplify the code, make it also suitable for more code refactorings.
    The new flag OPF_OPEN_RW_TMP is removed later in this patch series.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* cli/cli-cmds.c (find_and_open_script): Update openp caller.
    	* defs.h (enum openp_flags): Add OPF_OPEN_RW_TMP.
    	(openp): Remove parameter mode.
    	* dwarf2read.c (try_open_dwop_file): Update openp caller.
    	* exec.c (exec_file_attach): Likewise.
    	* nto-tdep.c (nto_find_and_open_solib): Remove parameter o_flags,
    	update openp caller.
    	* nto-tdep.h (nto_find_and_open_solib): Remove parameter o_flags.
    	* solib.c (solib_find_2): Update openp and find_and_open_solib caller.
    	* solist.h (struct target_so_ops): Remove parameter o_flags from
    	find_and_open_solib method.
    	* source.c (openp): Change parameter mode to a new variable.
    	(source_full_path_of, find_and_open_source): Update openp caller.
    	* symfile.c (symfile_bfd_open): Likewise.

commit 779171c3b2bbc7023c1f32615ad6677c1f07c191
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:51 2015 +0200

    Code cleanup: Remove OPF_RETURN_REALPATH
    
    Hi,
    
    OPF_RETURN_REALPATH is used only at the end of openp() to convert the returned
    values.  That is not useful, code can be simplified if callers that passed
    OPF_RETURN_REALPATH adjust the returned values on their own.  Or at least it
    helps further refactorizations.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* cli/cli-cmds.c (find_and_open_script): Remove OPF_RETURN_REALPATH.
    	Call gdb_realpath_and_xfree.
    	* defs.h (enum openp_flags): Add OPF_NONE, remove OPF_RETURN_REALPATH.
    	* dwarf2read.c (try_open_dwop_file): Remove OPF_RETURN_REALPATH.  Call
    	gdb_realpath_and_xfree.
    	* nto-tdep.c (nto_find_and_open_solib): Remove OPF_RETURN_REALPATH.
    	Call gdb_realpath_and_xfree and xstrdup.
    	* solib.c (solib_find_2): New variable temp_pathname_is_realpath.
    	Remove OPF_RETURN_REALPATH.  Conditionally call gdb_realpath_and_xfree.
    	* source.c (openp): Remove OPF_RETURN_REALPATH processing.
    	(source_full_path_of, find_and_open_source): Remove
    	OPF_RETURN_REALPATH.  Call gdb_realpath_and_xfree.
    	* symfile.c (symfile_bfd_open): Likewise.
    	* utils.c (gdb_realpath_and_xfree): New function.
    	* utils.h (gdb_realpath_and_xfree): New prototype.

commit 51aed3fba80dca8e18424a855ac19c5f19582e12
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:51 2015 +0200

    Code cleanup: Add enum for openp_flags
    
    Hi,
    
    it is for many reasons better, in C++ it could be even type safe.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* cli/cli-cmds.c (find_and_open_script): Use enum openp_flags for
    	search_flags.
    	* defs.h (OPF_TRY_CWD_FIRST, OPF_SEARCH_IN_PATH, OPF_RETURN_REALPATH):
    	Wrap them to a new ...
    	(enum openp_flags): ... enum.
    	(openp): Update prototype.
    	* dwarf2read.c (try_open_dwop_file): Use enum openp_flags for flags.
    	* source.c (openp): Update opts parameter type.  Move out OPF_*
    	comments.

commit 3d40c116d6b6f65070c2305759be4c76771fc5a2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:51 2015 +0200

    Change sysroot to ":target:"
    
    Hi,
    
    that is try "" first and "target:" second.
    
    Various performance problems should be fixed by trying to look up the remote
    file first on local filesystem.  Thanks to build-ids it is quick and safe to
    verify both files are the same build.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* NEWS (Changes since GDB 7.10): Mention sysroot.
    	* main.c (captured_main): Initialize new gdb_sysroot.
    
    gdb/testsuite/ChangeLog
    
    	* gdb.base/attach.exp (do_attach_tests): Update sysroot parsing.
    	* gdb.base/break-probes.exp: Likewise.

commit f7fce11ee9f77c91b69bcf03d97b858e07d97ef4
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:51 2015 +0200

    Permit multiple sysroot directories
    
    Hi,
    
    the goal is to have both "" and "target:" as the default gdb_sysroot, in this
    order.  Therefore permit multiple directory components of gdb_sysroot.
    
    
    Jan
    
    
    gdb/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* NEWS (Changes since GDB 7.10): Mention set sysroot and show sysroot.
    	* solib.c: Include source.h.
    	(solib_find_1): Rename to ...
    	(solib_find_2): ... here and change the sysroot variable to parameter.
    	(solib_find_1): Call it using dirnames_to_char_ptr_vec_target_exc.
    	* source.c (dirnames_to_char_ptr_vec_target_exc): New function.
    	* source.h (dirnames_to_char_ptr_vec_target_exc): New declaration.
    
    gdb/doc/ChangeLog
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* gdb.texinfo (Files): Permit set sysroot and show sysroot to have
    	multiple components.

commit fbd6de721a7bb03673dc4844b7f4494b285a4dee
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:50 2015 +0200

    Code cleanup: Make solib_find_1 variable const
    
    Hi,
    
    it gets used in the next patch.
    
    
    Jan
    
    
    2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
    
    	* solib.c (solib_find_1): Make sysroot variable const.

commit 868c0d04b42a19fd622d99c32465601a148b29c8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Aug 21 21:40:50 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.
    	* build-id.c: Include gdbcmd.h.
    	(validate_build_id, show_validate_build_id, _initialize_build_id): New.
    	* build-id.h (validate_build_id): New declaration.
    	* solib-svr4.c: Include rsp-low.h.
    	(svr4_copy_library_list): Duplicate field build_id.
    	(library_list_start_library): Parse 'build-id' attribute.
    	(svr4_library_attributes): Add 'build-id' attribute.
    	* solib.c (free_so): Free build_id.
    	* solist.h (struct so_list): New fields 'build_idsz' and 'build_id'.

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

Summary of changes:
 gdb/NEWS            |    4 ++--
 gdb/build-id.c      |   32 +++++++++++++-------------------
 gdb/doc/gdb.texinfo |   29 ++++++++++++-----------------
 gdb/exec.c          |    8 +++-----
 4 files changed, 30 insertions(+), 43 deletions(-)

First 500 lines of diff:
diff --git a/gdb/NEWS b/gdb/NEWS
index a45aaa6..28c319e 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -52,8 +52,8 @@ show validate-build-id
 * New features in the GDB remote stub, GDBserver
 
   ** library-list-svr4 contains also optional attribute 'build-id' for
-     each library.  GDB does not load library with build-id that
-     does not match such attribute.
+     each library and one optional attribute 'main-build-id'.  GDB does
+     not load binaries with build-id that does not match such attribute.
 
 *** Changes in GDB 7.10
 
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 216d4b5..289c356 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -64,10 +64,15 @@ build_id_bfd_get (bfd *abfd)
 int
 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);
+  const struct bfd_build_id *found;
+  char *message, *check_hex;
   struct cleanup *back_to;
 
+  if (check_len == 0 || !validate_build_id)
+    return 1;
+
+  found = build_id_bfd_get (abfd);
+  check_hex = alloca (check_len * 2 + 1);
   bin2hex (check, check_hex, check_len);
 
   if (found == NULL)
@@ -89,24 +94,13 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check, int advice)
   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 "
-		 "will be ignored; or use 'set validate-build-id off'."),
-	       bfd_get_filename (abfd), message);
-      do_cleanups (back_to);
-      return 0;
-    }
-  warning (_("Symbol file \"%s\" could not be validated (%s) "
-	     "but it is being loaded due to 'set validate-build-id off'."),
-	   bfd_get_filename (abfd), message);
+    warning ("%s", message);
+  else
+    warning (_("Symbol file \"%s\" could not be validated (%s) and "
+	       "will be ignored; or use 'set validate-build-id off'."),
+	     bfd_get_filename (abfd), message);
   do_cleanups (back_to);
-  return 1;
+  return 0;
 }
 
 /* Find and open a BFD given a build-id.  If no BFD can be found,
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index d6e8094..40f0f14 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18115,25 +18115,20 @@ discarded.
 @item set validate-build-id @var{mode}
 Setting to override @value{GDBN} build-id check.
 
-Inferior shared libraries and symbol files may contain unique build-id.
-@value{GDBN} expects the build-ids of each shared library and its corresponding
-symbol file to be identical.  If they are not identical, then by default
-@value{GDBN} will @value{GDBN} will ignore symbol files with non-matching
-build-id while printing:
+Inferior binaries (shared libraries or main executable) and symbol files
+(for all of those) may contain unique build-id.  @value{GDBN} expects
+the build-ids of each binary and its corresponding symbol file to be
+identical.  If they are not identical, then by default @value{GDBN} will
+@value{GDBN} will ignore symbol files with non-matching build-id while
+printing:
 
 @smallexample
-  warning: Shared object "libfoo.so.1" could not be validated (remote
-  build ID 2bc1745e does not match local build ID a08f8767) and will be
-  ignored; or use 'set validate-build-id off'.
+  warning: Symbol file "libfoo.so.1" could not be validated (inferior
+  build ID 66f87872 is not identical to symbol file "libfoo.so.1" build
+  ID df81e8db) and will be ignored; or use 'set validate-build-id off'.
 @end smallexample
 
-Turning off this setting would load such symbol file while still printing:
-
-@smallexample
-  warning: Shared object "libfoo.so.1" could not be validated (remote
-  build ID 2bc1745e does not match local build ID a08f8767) but it is
-  being loaded due to 'set validate-build-id off'.
-@end smallexample
+Turning off this setting would load such symbol file without any warning.
 
 If remote build-id is present but it does not match local build-id (or local
 build-id is not present) then this setting enables (@var{mode} is @code{off}) or
@@ -39802,8 +39797,8 @@ address the file was prelinked to during the library load.
 @end itemize
 
 Additionally the single @code{main-lm} attribute specifies address of
-@code{struct link_map} used for the main executable.  This parameter is
-used for TLS access and its presence is optional.  Similarly the single
+@code{struct link_map} used for the main executable.  This parameter is used
+for TLS access and its presence is optional.  Similarly the single
 @code{main-build-id} optional attribute specifies hex encoded
 @code{NT_GNU_BUILD_ID} note for the main executable.
 
diff --git a/gdb/exec.c b/gdb/exec.c
index 0ad34f6..dc39ed2 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -184,8 +184,7 @@ 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 */);
+      build_id_verify (exec_bfd, build_idsz, build_id, 0 /* advice */);
       reopen_exec_file ();
     }
   else if (full_exec_path != NULL)
@@ -202,9 +201,8 @@ exec_file_and_symbols_resync (struct inferior *inf, int from_tty)
 		 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 */);
+      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);


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


             reply	other threads:[~2015-08-21 20:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 20:56 jkratoch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-25 19:07 jkratoch
2015-08-22 19:25 jkratoch
2015-08-21 20:04 jkratoch
2015-08-20 21:17 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=20150821205653.64389.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).