From: Doug Evans <dje@google.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC] gdb_bfd_count_sections snafu
Date: Sat, 04 May 2013 06:21:00 -0000 [thread overview]
Message-ID: <CADPb22S1qoA0RUorV8qB2wqH7yvo=Dw059_ZyUba76K9kcNEiQ@mail.gmail.com> (raw)
In-Reply-To: <87bo9180ru.fsf@fleche.redhat.com>
On Fri, Apr 26, 2013 at 2:01 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> HOWEVER, objfile->num_sections is computed with bfd_count_sections
> Doug> not gdb_bfd_count_sections.
>
> Thanks for finding this.
>
> Doug> This patch does clean up one thing: AFAICT when syms_from_objfile_1
> Doug> is passed NULL for both addrs and offsets, there's no point in
> Doug> building local_addr to have more than one entry (zero would be fine
> Doug> too I think but space needs to be allocated for at least one entry).
>
> Doug> if (! addrs && ! offsets)
> Doug> {
> Doug> - local_addr
> Doug> - = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
> Doug> + local_addr = alloc_section_addr_info (1);
> Doug> make_cleanup (xfree, local_addr);
> Doug> addrs = local_addr;
> Doug> }
>
> Yeah, I believe we agreed in the original series that at least 1 was
> required. Otherwise it makes alloc_section_addr_info "weird"; and the
> downside of the current approach is just allocating a slightly larger
> object in some situations.
>
> Doug> Index: solib-target.c
> Doug> ===================================================================
> Doug> RCS file: /cvs/src/src/gdb/solib-target.c,v
> Doug> retrieving revision 1.28
> Doug> diff -u -p -r1.28 solib-target.c
> Doug> --- solib-target.c 8 Apr 2013 20:04:42 -0000 1.28
> Doug> +++ solib-target.c 17 Apr 2013 07:07:07 -0000
> Doug> @@ -339,7 +339,7 @@ solib_target_relocate_section_addresses
> Doug> it any earlier, since we need to open the file first. */
> Doug> if (so->lm_info->offsets == NULL)
> Doug> {
> Doug> - int num_sections = bfd_count_sections (so->abfd);
> Doug> + int num_sections = gdb_bfd_count_sections (so->abfd);
>
> I'm not certain that this one is needed.
> It seems harmless though.
>
> The rest looks good.
>
> I'm going to be off most of next week but I will try to remember to look
> into this again when I return.
>
> Tom
I committed the patch.
prev parent reply other threads:[~2013-05-04 6:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-17 14:55 Doug Evans
2013-04-17 15:10 ` Doug Evans
2013-04-27 18:55 ` Tom Tromey
2013-05-04 6:21 ` Doug Evans [this message]
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='CADPb22S1qoA0RUorV8qB2wqH7yvo=Dw059_ZyUba76K9kcNEiQ@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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