From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127439 invoked by alias); 22 Aug 2015 19:25:36 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 127419 invoked by uid 9674); 22 Aug 2015 19:25:36 -0000 Date: Sat, 22 Aug 2015 19:25:00 -0000 Message-ID: <20150822192535.127338.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] jankratochvil/gdbserverbuildid: Support build-id for main executables X-Git-Refname: refs/heads/jankratochvil/gdbserverbuildid X-Git-Reftype: branch X-Git-Oldrev: 7bce29f38b898ec67253353fcaba5d28b586d5f8 X-Git-Newrev: 9d526416f035a6d567c0a75ad10f61d67b91debf X-SW-Source: 2015-q3/txt/msg00040.txt.bz2 List-Id: The branch, jankratochvil/gdbserverbuildid has been updated discards 7bce29f38b898ec67253353fcaba5d28b586d5f8 (commit) discards c9d5a399077df5045baee43ac6c49c33bc9e7ea2 (commit) discards 64bce16d58873a8e3f5c4e5cf65eceb287bc03ce (commit) discards 93abb77b088733ae4d6fce5dd68fdd01636d541e (commit) discards b5345e50374931b0eaf83eb294c7df63c09eb904 (commit) discards a27f039a9b910b5f6bbb6a010d540ebb2c79bc26 (commit) discards 9a40139b873ac7dda461d53f73354983bda3f301 (commit) discards 5cf75d5606fc6851c8b5a2830670cb0bc7a7950d (commit) discards 52b044071251b1bb45471dc892b0f0e1ff5c19c9 (commit) discards 90980b9e455cd5a0cbb59b681025ab623240e0d6 (commit) discards c983ce6cb7f311e103e3163f64bce842e2487114 (commit) discards 2b1b193832fc3a1183a9a95bd1af962d2ef0bbff (commit) discards 6af974ef5b85c275830f3a3d71813c4add8936d2 (commit) discards 54342970f11ed58b4839a0c7979d2bb73f5eae15 (commit) discards 82d67fa4a55a7b04e43e592e654a7faa973be5df (commit) discards c67f00356d3bbd718307151f3ee3b9b2eaa53701 (commit) discards 5e0c4cbdabe0893412a2308396892f02102c7616 (commit) discards cdc59a92f80bc6338783c0a28c72cf983ddbbd0b (commit) discards 0715940c746aa9c9ea9f71ef0e30a13580db5528 (commit) discards 2f22ecc85185c1109a23d101779813ac6e5abab4 (commit) discards 63acab658b6c55bbfa9771505017040bb3ef0a18 (commit) discards 779171c3b2bbc7023c1f32615ad6677c1f07c191 (commit) discards 51aed3fba80dca8e18424a855ac19c5f19582e12 (commit) discards 3d40c116d6b6f65070c2305759be4c76771fc5a2 (commit) discards f7fce11ee9f77c91b69bcf03d97b858e07d97ef4 (commit) discards fbd6de721a7bb03673dc4844b7f4494b285a4dee (commit) discards 868c0d04b42a19fd622d99c32465601a148b29c8 (commit) via 9d526416f035a6d567c0a75ad10f61d67b91debf (commit) via a6d283fe348dbafbccd88da6b7099b31fa4126d5 (commit) via efb71ced9ef12350e058619d3650c6ab7a1dfef0 (commit) via 7c3dd94e53ba20bc11e098769a141af3f14577df (commit) via 5cf3c5364b0f2cba7ad361249cfd6ff99aa8d53e (commit) via daae6fc4931db1b4db2594d8e887ad7f7984fe23 (commit) via 5c5d66bbc85470417f3d7ee0090054892ca4f0f0 (commit) via c35b25ff57933441e00c6addddcf0ef76ec4ae46 (commit) via a69b2e74ab27ba3afd7295f70a055077b348e43a (commit) via dd0075e027a00de63a3fcda35d82ebd78b8d7d19 (commit) via 1768eace6960d429a857a2001c7c03434cdb645f (commit) via c1319b6c65880a7b8e555591c363026e1963f9ab (commit) via be1f700d55efd36f999ce06c775ae45da58c657c (commit) via f3631298bda92030bd47a85f64ade40b3c058e80 (commit) via 4edc3608dd24ab35ee638dbf1a2fa60eb5f3d14b (commit) via df951efc0fcc567655b25f191d42b79fb0a4cd6b (commit) via 2cea39c30f7a8a6e244f4f6c80c8bbeb412a0527 (commit) via 2700a11a5c5abeb4a28e5e98bdf840dafa46262f (commit) via b84ef18752bbeb8aed01bd1738177c4927e9ffe9 (commit) via c13173c2eb639887985adbf0a6be994b7fd26781 (commit) via ec55f3085ced8407ec8a372dfed7f7cf3490a625 (commit) via 154d3aa120e9a2ed255e4ea0f9c0bd0d092c0e77 (commit) via 7e0bdfa3a966e5d1d2388a1ca064a1e9e0713220 (commit) via b5d2b733dfe3ebf72136400d76bd2c5c4ef72f56 (commit) via 885cf907c1222da14b31c8e36cbaaca4dadfd737 (commit) via d3de81222038fdc9744a62368cb7d822812f7a61 (commit) via 91ced4b77535b97c67a3eaa1ca52a1622d82a539 (commit) from 7bce29f38b898ec67253353fcaba5d28b586d5f8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 9d526416f035a6d567c0a75ad10f61d67b91debf Author: Jan Kratochvil 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 * 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 * linux-low.c (linux_qxfer_libraries_svr4): Print main-build-id. gdb/doc/ChangeLog 2015-08-20 Jan Kratochvil * gdb.texinfo (Files): Add 'set validate-build-id' and 'show validate-build-id'. gdb/testsuite/ChangeLog 2015-08-20 Jan Kratochvil * gdb.base/main-mismatch-mod.c: New file. * gdb.base/main-mismatch.c: New file. * gdb.base/main-mismatch.exp: New file. commit a6d283fe348dbafbccd88da6b7099b31fa4126d5 Author: Jan Kratochvil 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 efb71ced9ef12350e058619d3650c6ab7a1dfef0 Author: Jan Kratochvil 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 * solib-svr4.c (hex2bin_allocate): New function from ... (library_list_start_library): ... here, call it. commit 7c3dd94e53ba20bc11e098769a141af3f14577df Author: Jan Kratochvil 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 * gdb.base/solib-mismatch.exp (nocrlf, expected_header): Make them global. (solib_locate_test): New function. commit 5cf3c5364b0f2cba7ad361249cfd6ff99aa8d53e Author: Jan Kratochvil 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 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 * build-id.c: Include rsp-low.h. (build_id_verify): Print non-matching build-ids, update the messages. commit 5c5d66bbc85470417f3d7ee0090054892ca4f0f0 Author: Jan Kratochvil 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 * solib.c (solib_bfd_fopen): Replace solib_find and solib_bfd_fopen by solib_find_file. commit c35b25ff57933441e00c6addddcf0ef76ec4ae46 Author: Jan Kratochvil 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 * source.c: Include build-id.h. (file_location_from_filename): Call build_id_verify for the build-id parameters. commit a69b2e74ab27ba3afd7295f70a055077b348e43a Author: Jan Kratochvil 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 * solib.c: Include build-id.h. (solib_find_3): Call build_id_to_file. commit dd0075e027a00de63a3fcda35d82ebd78b8d7d19 Author: Jan Kratochvil 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 * 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 1768eace6960d429a857a2001c7c03434cdb645f Author: Jan Kratochvil 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 * 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 c1319b6c65880a7b8e555591c363026e1963f9ab Author: Jan Kratochvil 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 * 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 be1f700d55efd36f999ce06c775ae45da58c657c Author: Jan Kratochvil 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 * symfile.c (symfile_bfd_open): Use openp_bfd instead of openp and gdb_bfd_open. commit f3631298bda92030bd47a85f64ade40b3c058e80 Author: Jan Kratochvil 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 * 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 4edc3608dd24ab35ee638dbf1a2fa60eb5f3d14b Author: Jan Kratochvil 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 * 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 df951efc0fcc567655b25f191d42b79fb0a4cd6b Author: Jan Kratochvil 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 * 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 2cea39c30f7a8a6e244f4f6c80c8bbeb412a0527 Author: Jan Kratochvil 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 * 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 2700a11a5c5abeb4a28e5e98bdf840dafa46262f Author: Jan Kratochvil 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 * gdb_bfd.c (gdb_bfd_iovec_fileio_open_fd): New function. (gdb_bfd_open_from_target): Conditionally use it. commit b84ef18752bbeb8aed01bd1738177c4927e9ffe9 Author: Jan Kratochvil 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 * 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 c13173c2eb639887985adbf0a6be994b7fd26781 Author: Jan Kratochvil 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 * source.c (openp): Update function comment for filename_opened. Remove NULL check for filename_opened. commit ec55f3085ced8407ec8a372dfed7f7cf3490a625 Author: Jan Kratochvil 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 * 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 154d3aa120e9a2ed255e4ea0f9c0bd0d092c0e77 Author: Jan Kratochvil 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 * 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 7e0bdfa3a966e5d1d2388a1ca064a1e9e0713220 Author: Jan Kratochvil 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 * 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 b5d2b733dfe3ebf72136400d76bd2c5c4ef72f56 Author: Jan Kratochvil 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 * 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 885cf907c1222da14b31c8e36cbaaca4dadfd737 Author: Jan Kratochvil 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 * 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 * gdb.texinfo (Files): Permit set sysroot and show sysroot to have multiple components. commit d3de81222038fdc9744a62368cb7d822812f7a61 Author: Jan Kratochvil 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 * solib.c (solib_find_1): Make sysroot variable const. commit 91ced4b77535b97c67a3eaa1ca52a1622d82a539 Author: Jan Kratochvil 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 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 | 12 ++++++------ gdb/doc/gdb.texinfo | 13 ++++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) First 500 lines of diff: diff --git a/gdb/NEWS b/gdb/NEWS index 28c319e..b7f9798 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -35,8 +35,8 @@ show debug bfd-cache The "/m" option is now considered deprecated: its "source-centric" output hasn't proved useful in practice. -* The "set sysroot" (and "show sysroot") commands now permit multiple - directory paths. +* The "set sysroot" (and "show sysroot") commands now accept PATH-style + lists of directories. * Default sysroot has changed to ":target:", that is first host files and then target files are tried. diff --git a/gdb/build-id.c b/gdb/build-id.c index 289c356..c21b9be 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -39,8 +39,8 @@ static void show_validate_build_id (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, _("Validation a build-id matches to load a shared " - "library is %s.\n"), + fprintf_filtered (file, _("Validation of build-id match when loading " + "a binary is %s.\n"), value); } @@ -222,10 +222,10 @@ _initialize_build_id (void) { add_setshow_boolean_cmd ("validate-build-id", class_support, &validate_build_id, _("\ -Set validation a build-id matches to load a shared library."), _("\ -SHow validation a build-id matches to load a shared library."), _("\ -Inferior shared library and symbol file may contain unique build-id.\n\ -If both build-ids are present but they do not match then this setting\n\ +Set whether to validate build-id match when loading a binary."), _("\ +Show whether to validate build-id match when loading a binary."), _("\ +Inferior binary and symbol file may contain unique build-id.\n\ +If both build-ids are present, but they do not match, then this setting\n\ enables (off) or disables (on) loading of such symbol file.\n\ Loading non-matching symbol file may confuse debugging including breakage\n\ of backtrace output."), diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 40f0f14..db305f4 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -18189,8 +18189,8 @@ to specify the search directories for target libraries. @kindex set solib-absolute-prefix @kindex set sysroot @item set sysroot @var{path} -Use @var{path} as the system root (or list of system roots) for the -program being debugged. Any +Use @var{path} as the system root (or a list of system root directories) +for the program being debugged. Any absolute shared library paths will be prefixed with @var{path}; many runtime loaders store the absolute paths to the shared library in the target program's memory. When starting processes remotely, and when @@ -18202,10 +18202,12 @@ to be laid out in the same way that they are on the target, with e.g.@: a @file{/bin}, @file{/lib} and @file{/usr/lib} hierarchy under @var{path}. -Multiple entries may be delimited by the host platform path separator in use. +Multiple sysroot directories can be specified in @var{path}, +separated by the host platform's path separator character (colon +@samp{:} on Unix, semi-colon @samp{;} on MS-Windows, etc.). If @var{path} starts with the sequence @file{target:} (even if the host -platform path separator is character @file{:}) and the target +platform path separator is @samp{:}) and the target system is remote then @value{GDBN} will retrieve the target binaries from the remote system. This is only supported when using a remote target that supports the @code{remote get} command (@pxref{File @@ -18287,7 +18289,8 @@ location. @kindex show sysroot @item show sysroot -Display the current executable and shared library prefix(es). +Display the current value of sysroot, which is used to look for +executable and shared libraries. @kindex set solib-search-path @item set solib-search-path @var{path} hooks/post-receive -- Repository for Project Archer.