Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Yao Qi <yao@codesourcery.com>
Subject: Re: combine bfd_lookup_symbol in solib-*.c
Date: Mon, 29 Aug 2011 11:41:00 -0000	[thread overview]
Message-ID: <201108291241.02099.pedro@codesourcery.com> (raw)
In-Reply-To: <4E4D318E.704@codesourcery.com>

Hi Yao, thanks for doing this.  Looks mostly good.
A couple cosmetic comments below.

On Thursday 18 August 2011 16:36:46, Yao Qi wrote:

> +
> +CORE_ADDR
> +bfd_lookup_symbol (bfd *abfd, const char *symname,
> +                  int (*is_right_sym) (asymbol *, const char *))

All the function does with the passed in SYMNAME is passing
it down to the callback.  If the interface has been generalized to
pass in a "match" callback, then make the symname parameter
generic too, like:

  CORE_ADDR
  bfd_lookup_symbol (bfd *abfd,
                  int (*is_right_sym) (asymbol *, void *),
                  void *data);

Please document the parameters.

I think it's best to reserve extern symbols that start with
"bfd_" to libbfd proper.  Maybe gdb_bfd_lookup_symbol would
be a good enough alternative.  (Or maybe propose the function
for bfd proper, though I'd suggest fixing its interface
to not assume 0 return is error then)

> +/* Lookup the value for a specific symbol.
> +
> +   An expensive way to lookup the value of a single symbol for
> +   bfd's that are only temporary anyway.  This is used by the
> +   shared library support to find the address of the debugger
> +   notification routine in the shared library.
> +
> +   The returned symbol may be in a code or data section; functions
> +   will normally be in a code section, but may be in a data section
> +   if this architecture uses function descriptors.

The way you've generalized the function, since it's the
callback's responsibility to pick the the symbol, this
comment no longer appears to be in the right place.

-- 
Pedro Alves


  parent reply	other threads:[~2011-08-29 11:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 15:37 Yao Qi
2011-08-28 14:41 ` [ping] " Yao Qi
2011-08-29 11:41 ` Pedro Alves [this message]
2011-08-29 16:23   ` Yao Qi
2011-08-29 16:33     ` Pedro Alves
2011-08-30  2:51       ` [committed]: " Yao Qi

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=201108291241.02099.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.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