This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 5/9] Rearrange symfile_bfd_open
- From: Pedro Alves <palves at redhat dot com>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 01 Apr 2015 17:03:27 +0100
- Subject: Re: [PATCH 5/9] Rearrange symfile_bfd_open
- Authentication-results: sourceware.org; auth=none
- References: <1426870087-32654-1-git-send-email-gbenson at redhat dot com> <1426870087-32654-6-git-send-email-gbenson at redhat dot com> <551BE0D9 dot 9000902 at redhat dot com> <20150401155037 dot GA22176 at blade dot nx>
On 04/01/2015 04:50 PM, Gary Benson wrote:
> Pedro Alves wrote:
>> On 03/20/2015 04:48 PM, Gary Benson wrote:
>>> symfile_bfd_open handles what were remote files as a special case.
>>> Now that remote files are replaced with target the reverse is true
>>> and the BFD opening, format checking and error printing code is
>>> essentially duplicated. This commit rearranges symfile_bfd_open
>>> to treat local files as a special case, removing the duplication.
>>
>> Where were they already done? Can you add a comment?
>
> They were done twice in the same function:
>
> if remote:
> open bfd, check format, etc
> return
> local-specific stuff
> open bfd, check format, etc
> return
>
> I rearranged it to be like this:
>
> if local:
> local-specific stuff
> open bfd, check format, etc
> return
>
> How about I change the commit message to this:
>
> symfile_bfd_open handled what were remote files as a special case.
> Converting from "remote:" files to "target:" means the two cases
> are now very similar and may be merged. This commit rearranges
> symfile_bfd_open to remove the duplicated code.
Ah, I see now. The pseudo code above helped me a lot too. I'd
suggest putting in the commit log too.
Patch is OK.
Thanks,
Pedro Alves