Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Gary Benson <gbenson@redhat.com>
Subject: Re: [RFA take 3] Allow setting breakpoints on inline functions (PR 10738) [repost]
Date: Sat, 28 Jan 2012 18:16:00 -0000	[thread overview]
Message-ID: <20120128090724.GA30170@host2.jankratochvil.net> (raw)
In-Reply-To: <20120128001638.GA4448@host2.jankratochvil.net>

[ repost - the mail is missing at gdb-patches ]

Hi Gary,

On Fri, 27 Jan 2012 16:10:34 +0100, Gary Benson wrote:
> How does it look?  Hopefully there are not a load more places the
> symbols have leaked into now!

I guess Tom is fine with my review, except for some details I am fine with it,
thanks for the fix.

FYI this comment by me looks fixed with current FSF GDB HEAD and your patch:
	http://sourceware.org/bugzilla/show_bug.cgi?id=10738#c11


[...]
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -321,6 +321,33 @@ cplusplus_error (const char *name, const char *fmt, ...)
>    throw_error (NOT_FOUND_ERROR, "%s", message);
>  }
>  
> +/* A callback function and the data to pass to it.  */
> +
> +struct callback_and_data
> +{
> +  /* The callback to use.  */
> +  int (*callback) (struct symbol *, void *);
> +
> +  /* Data to be passed to the callback.  */
> +  void *data;
> +};

I would prefer renaming "callback_and_data" so that the name somehow contains
it is related to "symbol".


> +
> +/* A helper for iterate_over_all_matching_symtabs that is used
> +   to restrict calls to another callback to symbols representing
> +   the inlined instances of functions only.  */
> +
> +static int
> +iterate_inline_only (struct symbol *sym, void *d)
> +{
> +  if (SYMBOL_INLINED (sym))
> +    {
> +      struct callback_and_data *cad = (struct callback_and_data *) d;

Excessive cast.


> +
> +      return cad->callback (sym, cad->data);
> +    }
> +  return 0;

Could you make a comment why is here 0?  I would think here should be 1 but
I may be wrong.


> +}
> +
>  /* Some data for the expand_symtabs_matching callback.  */
>  
>  struct symbol_matcher_data
> @@ -348,14 +375,16 @@ iterate_name_matcher (const char *name, void *d)
>  /* A helper that walks over all matching symtabs in all objfiles and
>     calls CALLBACK for each symbol matching NAME.  If SEARCH_PSPACE is
>     not NULL, then the search is restricted to just that program
> -   space.  */
> +   space.  If INCLUDE_INLINE is nonzero then symbols representing
> +   inlined instances of functions will be included in the result.  */
>  
>  static void
>  iterate_over_all_matching_symtabs (const char *name,
>  				   const domain_enum domain,
>  				   int (*callback) (struct symbol *, void *),

Could you provide a pre-requisite patch turning this CALLBACK argument type
into symbol_found_callback_ftype typedef where its result would be described
(which is described in la_iterate_over_symbols but that is a bit far away).
And possibly commenting all the 0 and 1 return values in the implementations.
I would do it otherwise.


>  				   void *data,
> -				   struct program_space *search_pspace)
> +				   struct program_space *search_pspace,
> +				   int include_inline)
>  {
>    struct objfile *objfile;
>    struct program_space *pspace;
[...]
> @@ -2245,7 +2288,8 @@ find_function_symbols (char **argptr, char *p, int is_quote_enclosed,
>      copy[p - *argptr] = 0;
>  
>    iterate_over_all_matching_symtabs (copy, VAR_DOMAIN,
> -				     collect_function_symbols, &result, NULL);
> +				     collect_function_symbols, &result, NULL,
> +				     0);

I see 1 here to support `break inlinedfunc:labelname' does not work, just such
a statement, fine with me, it can be an incremental improvement one day in the
future.


>  
>    if (VEC_empty (symbolp, result))
>      VEC_free (symbolp, result);
[...]
> --- /dev/null
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-break.S
> @@ -0,0 +1,1663 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> +   Copyright 2011 Free Software Foundation, Inc.

2011++.  Four times.


> --- /dev/null
> +++ b/gdb/testsuite/gdb.opt/inline-break.c
[...]
> +/* The file ../gdb.dwarf2/inline-break.S was generated manually from
> +   this file, and should be regenerated if this file is modified.  */
> +
> +#ifdef __GNUC__
> +#define ATTR __attribute__((always_inline))
> +#else
> +#define ATTR
> +#endif

Indentation (sure a nitpick):

#ifdef __GNUC__
# define ATTR __attribute__((always_inline))
#else
# define ATTR
#endif



Thanks,
Jan


  parent reply	other threads:[~2012-01-28  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 15:16 [RFA take 3] Allow setting breakpoints on inline functions (PR 10738) Gary Benson
     [not found] ` <20120128001638.GA4448@host2.jankratochvil.net>
2012-01-28 18:16   ` Jan Kratochvil [this message]
2012-01-30 14:16     ` [RFA] Linespec tweak (was: Re: [RFA take 3] Allow setting breakpoints on inline functions (PR 10738)) Gary Benson
2012-01-30 14:31       ` Jan Kratochvil
2012-01-30 14:57         ` Gary Benson
2012-01-30 14:58           ` Jan Kratochvil
2012-01-30 15:05         ` [RFA take 2] " Gary Benson
2012-01-30 16:22           ` Jan Kratochvil
2012-02-01 16:14             ` [commit] " Gary Benson
2012-02-02 16:51     ` [RFA take 3] Allow setting breakpoints on inline functions (PR 10738) [repost] Gary Benson
2012-01-30 14:04 ` [RFA take 3] Allow setting breakpoints on inline functions (PR 10738) Jan Kratochvil

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=20120128090724.GA30170@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gbenson@redhat.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