From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5111 invoked by alias); 24 Mar 2014 04:57:36 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 5085 invoked by uid 9674); 24 Mar 2014 04:57:35 -0000 Date: Mon, 24 Mar 2014 04:57:00 -0000 Message-ID: <20140324045735.5051.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] jankratochvil/gdbserverbuildid: Locate solib files via build-id X-Git-Refname: refs/heads/jankratochvil/gdbserverbuildid X-Git-Reftype: branch X-Git-Oldrev: aa7388d4a41ace67fbb765aefb0be6d2ea696287 X-Git-Newrev: 9a55d97b9ecf35edf74fe8a098055e7022b2c783 X-SW-Source: 2014-q1/txt/msg00023.txt.bz2 List-Id: The branch, jankratochvil/gdbserverbuildid has been updated discards aa7388d4a41ace67fbb765aefb0be6d2ea696287 (commit) discards 3f5760079eaa9b26e4cdd857f225c635cb0391b4 (commit) discards 67643e85f38259159dfe46de205c506de5342ed1 (commit) discards eb7f9e4bfa5d3b382a42a938090f2a001b9ed81b (commit) via 9a55d97b9ecf35edf74fe8a098055e7022b2c783 (commit) via 44d174c7e81b033ec87ce55e82f731e2d1da3182 (commit) via 626cc0e72e235a1a87e07c1d7bae34d2aa3a77be (commit) via 041741fef5261c22c998f501f4abc95600e7e4a6 (commit) from aa7388d4a41ace67fbb765aefb0be6d2ea696287 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 9a55d97b9ecf35edf74fe8a098055e7022b2c783 Author: Jan Kratochvil Date: Mon Mar 24 04:30:57 2014 +0100 Locate solib files via build-id Hi, this is a new functionality that the file itself (*) it found via build-id, if the regular name-located file does not match inferior build-id or if the named-located file even does not exist. I am not completely sure with the SO->SO_NAME initialization. It cannot be a regression but not sure how it should behave for the build-id-located files. Currently the original target filename is kept but the comment there says is may confuse MI frontends. OTOH putting there the build-id located file will show its build-id name in SO_NAME which is also wrong. (*) /usr/lib/libxxx.so, not /usr/lib/debug/usr/lib/libxxx.so.debug. Although GDB uses only symbols from that file so in fact the *.debug file would be sufficient. But for example .symtab is sometimes only in the .so file and not the .so.debug file so GDB looks up .so as the associated .so.debug file gets loaded automatically on top of .so anyway. Thanks, Jan gdb/ 2014-03-24 Jan Kratochvil Locate solib files via build-id. * build-id.c (build_id_so_validate): Remove const from the parameter, return void. Handle also NULL SO->ABFD. Call also build_id_to_bfd. * build-id.h (build_id_so_validate): Update declaration. * solib.c (solib_map_sections): Move SO->SO_NAME earlier. Call VALIDATE even for NULL SO->ABFD. No longer free SO->ABFD on failed VALIDATE. (default_solib_validate): Update its const and return value. * solib.h (default_solib_validate): Update declaration. * solist.h (struct target_so_ops): Update definition of field validate. gdb/testsuite/ 2014-03-24 Jan Kratochvil Locate solib files via build-id. * gdb.base/solib-mismatch.exp (nocrlf, expected_header): Make solib_matching_test variables global. (solib_locate_test): New proc. (locate non-matching shared library) (locate non-existing shared library): New tests. commit 44d174c7e81b033ec87ce55e82f731e2d1da3182 Author: Jan Kratochvil Date: Mon Mar 24 04:30:57 2014 +0100 Code cleanup: solib_map_sections abfd var Hi, just remove a local variable holding so->abfd copy as so->abfd may change in the next patch. Jan gdb/ 2014-03-24 Jan Kratochvil * solib.c (solib_map_sections): Remove variable abfd. commit 626cc0e72e235a1a87e07c1d7bae34d2aa3a77be Author: Jan Kratochvil Date: Mon Mar 24 04:30:57 2014 +0100 Tests for validate symbol file using build-id Hi, new testcase. Jan gdb/testsuite/ 2014-02-26 Aleksandar Ristovski Date: Mon Mar 24 04:30:57 2014 +0100 Validate symbol file using build-id Hi, consumer part of the "build-id" attribute. Jan gdb/ 2014-02-26 Aleksandar Ristovski Validate symbol file using build-id. * NEWS (Changes since GDB 7.7): Add 'set build-id-force' and 'show build-id-force'. Add build-id attribute. * build-id.c: Include solist.h, rsp-low.h and gdbcmd.h. (build_id_force, show_build_id_force): New. (build_id_verify): Use BUILD_ID_FORCE. (build_id_to_debug_bfd): Rename to ... (build_id_to_bfd): ... here. Add parameter suffix. (build_id_to_debug_bfd): New wrapper of build_id_to_bfd. (build_id_so_validate, _initialize_build_id): New. * build-id.h (build_id_so_validate): New declaration. * solib-darwin.c (_initialize_darwin_solib): Assign validate value. * solib-dsbt.c (_initialize_dsbt_solib): Ditto. * solib-frv.c (_initialize_frv_solib): Ditto. * solib-ia64-hpux.c (ia64_hpux_target_so_ops): Ditto. * solib-irix.c (_initialize_irix_solib): Ditto. * solib-osf.c (_initialize_osf_solib): Ditto. * solib-pa64.c (_initialize_pa64_solib): Ditto. * solib-som.c (_initialize_som_solib): Ditto. * solib-spu.c (set_spu_solib_ops): Ditto. * solib-svr4.c: Include build-id.h and rsp-low.h. (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 (solib_map_sections): Use ops->validate. (free_so): Free build_id. (default_solib_validate): New function. * 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/ 2014-03-02 Jan Kratochvil * gdb.texinfo (Files): Add 'set build-id-force' and 'show build-id-force'. ----------------------------------------------------------------------- Summary of changes: gdb/NEWS | 9 +++++---- gdb/build-id.c | 6 +++++- gdb/doc/gdb.texinfo | 10 +++++----- 3 files changed, 15 insertions(+), 10 deletions(-) First 500 lines of diff: diff --git a/gdb/NEWS b/gdb/NEWS index 629cc13..aeb4f9d 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -43,11 +43,12 @@ maint ada show ignore-descriptive-types the user manual for more details on descriptive types and the intended usage of this option. -set solib-build-id-force (on|off) -show solib-build-id-force +set build-id-force (on|off) +show build-id-force Inferior shared library and symbol file may contain unique build-id. - If both build-ids are present but they do not match then this setting - enables (on) or disables (off) loading of such symbol file. + If inferior build-ids is present but it is not identical to symbol file + build-id then this setting enables (on) or disables (off) loading + of such symbol file. * New features in the GDB remote stub, GDBserver diff --git a/gdb/build-id.c b/gdb/build-id.c index 54f9cb7..928c23c 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -97,13 +97,17 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) xfree (message); return 0; } - warning (_("Shared object \"%s\" could not be validated (%s) " + warning (_("Symbol file \"%s\" could not be validated (%s) " "but it is being loaded due to 'set build-id-force'."), bfd_get_filename (abfd), message); xfree (message); return 1; } +/* Find and open a BFD given a build-id. If no BFD can be found, + return NULL. Use "" or ".debug" for SUFFIX. The returned reference to the + BFD must be released by the caller. */ + static bfd * build_id_to_bfd (size_t build_id_len, const bfd_byte *build_id, const char *suffix) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 756c2c2..6901027 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -17127,20 +17127,20 @@ symbol file to be identical. If they are not identical, then by default build-id while printing: @smallexample - warning: Shared object "libfoo.so.1" could not be validated (inferior + warning: Symbol file "libfoo.so.1" could not be validated (inferior build ID 2bc1745e does not match symbol file build ID a08f8767) and - will be ignored; or use 'set solib-build-id-force'. + will be ignored; or use 'set build-id-force'. @end smallexample Turning on this setting would load such symbol file while still printing: @smallexample - warning: Shared object "libfoo.so.1" could not be validated (inferior + warning: Symbol file "libfoo.so.1" could not be validated (inferior build ID 2bc1745e is not identical to symbol file build ID a08f8767) - but it is being loaded due to 'set solib-build-id-force'. + but it is being loaded due to 'set build-id-force'. @end smallexample -If inferior build-id is present but it does not match symbol file build-id +If inferior build-id is present but it is not identical to symbol file build-id (or the symbol file build-id is not present) then this setting enables (@var{mode} is @code{on}) or disables (@var{mode} is @code{off}) loading of such symbol file. On systems where build-id is not present in the inferior hooks/post-receive -- Repository for Project Archer.