public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Jon TURNEY <jon.turney@dronecode.org.uk>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Find debug symbols file by buildid for PE file format also
Date: Tue, 09 Jun 2015 19:36:00 -0000	[thread overview]
Message-ID: <20150609193638.GM2855@adacore.com> (raw)
In-Reply-To: <55251C45.4070006@dronecode.org.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

  parent reply	other threads:[~2015-06-09 19:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 15:37 [PATCH] Find debug symbols file by buildid for coff " Jon TURNEY
2015-03-16 16:30 ` Eli Zaretskii
2015-03-17 12:56   ` Jon TURNEY
2015-04-08 12:17     ` [PATCH] Find debug symbols file by buildid for PE " Jon TURNEY
2015-04-08 12:39       ` Eli Zaretskii
2015-04-22 13:41       ` Jon TURNEY
2015-06-02 13:33       ` Jon TURNEY
2015-06-09 19:36       ` Joel Brobecker [this message]
2015-06-10 14:26         ` [PATCH] Allow gdb to find debug symbols file by build-id " Jon Turney
2015-06-12 15:45           ` Nicholas Clifton
2015-06-15 16:34           ` Mike Frysinger
2015-06-15 18:13             ` Andreas Schwab
2015-06-15 18:25               ` Jon TURNEY
2015-06-16 11:35                 ` Nicholas Clifton
2015-06-17 16:09           ` Yao Qi
2015-06-18 11:05             ` Jon TURNEY

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=20150609193638.GM2855@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jon.turney@dronecode.org.uk \
    /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).