This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Find debug symbols file by buildid for PE file format also
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 9 Jun 2015 15:36:38 -0400
- Subject: Re: [PATCH] Find debug symbols file by buildid for PE file format also
- Authentication-results: sourceware.org; auth=none
- References: <1426520230-18940-1-git-send-email-jon dot turney at dronecode dot org dot uk> <831tko29ct dot fsf at gnu dot org> <55082466 dot 3010702 at dronecode dot org dot uk> <55251C45 dot 4070006 at dronecode dot org dot uk>
> bfd/ChangeLog:
>
> 2015-04-07 Jon Turney <jon.turney@dronecode.org.uk>
>
> * elf-bfd.h : Remove struct elf_build_id.
> * bfd.c : Add struct bfd_build_id.
> * bfd-in2.h: Regenerate.
> * elf.c (elfobj_grok_gnu_build_id): Update to use bfd_build_id.
> * libpei.h: Add protoype and macros for
> bfd_XXi_slurp_codeview_record.
> * peXXigen.c (_bfd_XXi_slurp_codeview_record): Make public
> * peicode.h (pe_bfd_read_buildid): Add.
> (pe_bfd_object_p): Use pe_bfd_read_buildid().
The BFD part of the patch needs to be approved by the binutils
maintainers.
> gdb/ChangeLog:
>
> 2015-04-07 Jon Turney <jon.turney@dronecode.org.uk>
>
> * build-id.c (build_id_bfd_get): Use bfd_build_id.
> (build_id_verify): Ditto.
> * build-id.h: Ditto.
> (find_separate_debug_file_by_buildid): Ditto.
> * python/py-objfile.c (objfpy_get_build_id)
> (objfpy_build_id_matches, objfpy_lookup_objfile_by_build_id): Ditto.
> * coffread.c (coff_symfile_read): Try
> find_separate_debug_file_by_buildid.
Can you also mention in the ChangeLog the #include changes
(removing and adding)?
>
> gdb/doc/ChangeLog:
>
> 2015-04-07 Jon Turney <jon.turney@dronecode.org.uk>
>
> * gdb.texinfo (Separate Debug Files): Document that PE is also
> supported.
>
> gdb/testsuite/ChangeLog:
>
> 2015-04-07 Jon Turney <jon.turney@dronecode.org.uk>
>
> * gdb.base/sepdebug.exp: Add EXEEXT where needed.
> * lib/gdb.exp (get_build_id): Teach how to extract build-id from a
> PE file.
> * lib/future.exp (gdb_find_objdump): Add gdb_find_objdump.
All GDB changes look mostly OK to me. In fact, the only comments are
very minor in nature, so this part is pre-approved pending those tiny
issues being addressed.
> @@ -29,19 +28,19 @@
>
> /* See build-id.h. */
>
> -const struct elf_build_id *
> +const struct bfd_build_id *
> build_id_bfd_get (bfd *abfd)
> {
> - if (!bfd_check_format (abfd, bfd_object)
> - || bfd_get_flavour (abfd) != bfd_target_elf_flavour
> - /* Although this is ELF_specific, it is safe to do in generic
> - code because it does not rely on any ELF-specific symbols at
> - link time, and if the ELF code is not available in BFD, then
> - ABFD will not have the ELF flavour. */
> - || elf_tdata (abfd)->build_id == NULL)
> + if (!bfd_check_format (abfd, bfd_object))
> return NULL;
>
> - return elf_tdata (abfd)->build_id;
> + if (abfd->build_id != NULL)
> + {
> + return abfd->build_id;
> + }
Small GDB-specific coding style: For single-statement if blocks,
we decided that curly braces should not be used. Therefore:
if (abfd->build_id != NULL)
return abfd->build_id;
The only exception is when you have a comment in addition to the
statement. See:
https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards
> diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
> index 2fb635b..fd4c153 100644
> --- a/gdb/testsuite/lib/future.exp
> +++ b/gdb/testsuite/lib/future.exp
> @@ -104,6 +104,16 @@ proc gdb_find_objcopy {} {
> return $objcopy
> }
>
> +proc gdb_find_objdump {} {
We should document every new function, by adding an introductory
comment.
--
Joel