Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] gdb_bfd_count_sections snafu
Date: Sat, 27 Apr 2013 18:55:00 -0000	[thread overview]
Message-ID: <87bo9180ru.fsf@fleche.redhat.com> (raw)
In-Reply-To: <yjt2ehe9r31a.fsf@ruffy2.mtv.corp.google.com> (Doug Evans's	message of "Wed, 17 Apr 2013 01:10:09 -0700")

>>>>> "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


  parent reply	other threads:[~2013-04-26 21:01 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 [this message]
2013-05-04  6:21   ` Doug Evans

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=87bo9180ru.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /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