Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: [RFA take 2] Linespec tweak (was: Re: [RFA take 3] Allow setting	breakpoints on inline functions (PR 10738))
Date: Mon, 30 Jan 2012 15:05:00 -0000	[thread overview]
Message-ID: <20120130145834.GD5210@redhat.com> (raw)
In-Reply-To: <20120130141612.GA25851@host2.jankratochvil.net>

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

Jan Kratochvil wrote:
> On Mon, 30 Jan 2012 15:03:39 +0100, Gary Benson wrote:
> > Attached.  I also commented the return values of another callback used
> > internally by iterate_over_all_matching_symtabs, at the very top of
> > the patch.
> > 
> > Ok to commit?
> 
> Sorry I wrongly replied on IRC, that symbol_found_callback_ftype
> should be used also for struct
> language_defn->la_iterate_over_symbols and ada_iterate_over_symbols,
> this was why I found it useful.
> 
> > +/* Callback for iterate_over_all_matching_symtabs.  The callback
> > +   will be called once per matching symbol SYM, with DATA being
> > +   the argument of the same name that was passed to
> > +   iterate_over_all_matching_symtabs.  The callback should return
> 
> No reference to iterate_over_all_matching_symtabs anymore here, it
> is used at more places now.
> 
> > +   nonzero to indicate that iterate_over_all_matching_symtabs should
> > +   continue iterating, or zero to indicate that the iteration should
> > +   end.  */
> [...]
> 
> >    if (SYMBOL_CLASS (sym) != LOC_TYPEDEF)
> > -    return 1;
> > +    return 1; /* Continue iterating. */
> Should be:
>        return 1; /* Continue iterating.  */
> 
> On multiple places.

Updated patch attached.

Is this ok to commit?

Thanks,
Gary

-- 
http://gbenson.net/

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 5533 bytes --]

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4bc591f..31bc1c5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2012-01-30  Gary Benson  <gbenson@redhat.com>
+
+	* language.h (symbol_name_match_p_ftype): New typedef.
+	(language_defn->la_iterate_over_symbols): Use the above.
+	* symtab.h (iterate_over_symbols): Likewise.
+	* symtab.c (iterate_over_symbols): Likewise.
+	* ada-lang.c (ada_iterate_over_symbols): Likewise.
+	* linespec.c (iterate_over_all_matching_symtabs): Likewise.
+	(iterate_name_matcher): Document return values.
+	(collect_one_symbol): Likewise.
+	(collect_function_symbols): Likewise.
+	(collect_symbols): Likewise.
+
 2012-01-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	Code cleanup: Make 1440 bytes of data segment read-only.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 55e318f..bb44427 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5100,7 +5100,7 @@ ada_name_for_lookup (const char *name)
 static void
 ada_iterate_over_symbols (const struct block *block,
 			  const char *name, domain_enum domain,
-			  int (*callback) (struct symbol *, void *),
+			  symbol_found_callback_ftype callback,
 			  void *data)
 {
   int ndefs, i;
diff --git a/gdb/language.h b/gdb/language.h
index 7a1bcb7..186d3fd 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -146,6 +146,15 @@ struct language_arch_info
 typedef int (*symbol_name_match_p_ftype) (const char *symbol_search_name,
 					  const char *lookup_name);
 
+/* Callback for LA_ITERATE_OVER_SYMBOLS.  The callback will be called
+   once per matching symbol SYM, with DATA being the argument of the
+   same name that was passed to LA_ITERATE_OVER_SYMBOLS.  The callback
+   should return nonzero to indicate that LA_ITERATE_OVER_SYMBOLS
+   should continue iterating, or zero to indicate that the iteration
+   should end.  */
+
+typedef int (*symbol_found_callback_ftype) (struct symbol *sym, void *data);
+
 /* Structure tying together assorted information about a language.  */
 
 struct language_defn
@@ -354,7 +363,7 @@ struct language_defn
     void (*la_iterate_over_symbols) (const struct block *block,
 				     const char *name,
 				     domain_enum domain,
-				     int (*callback) (struct symbol *, void *),
+				     symbol_found_callback_ftype callback,
 				     void *data);
 
     /* Add fields above this point, so the magic number is always last.  */
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 50ebf6f..474ee2c 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -341,8 +341,8 @@ iterate_name_matcher (const char *name, void *d)
   const struct symbol_matcher_data *data = d;
 
   if (data->symbol_name_match_p (name, data->lookup_name) == 0)
-    return 1;
-  return 0;
+    return 1; /* Expand this symbol's symbol table.  */
+  return 0; /* Skip this symbol.  */
 }
 
 /* A helper that walks over all matching symtabs in all objfiles and
@@ -353,7 +353,7 @@ iterate_name_matcher (const char *name, void *d)
 static void
 iterate_over_all_matching_symtabs (const char *name,
 				   const domain_enum domain,
-				   int (*callback) (struct symbol *, void *),
+				   symbol_found_callback_ftype callback,
 				   void *data,
 				   struct program_space *search_pspace)
 {
@@ -1808,14 +1808,14 @@ collect_one_symbol (struct symbol *sym, void *d)
   struct type *t;
 
   if (SYMBOL_CLASS (sym) != LOC_TYPEDEF)
-    return 1;
+    return 1; /* Continue iterating.  */
 
   t = SYMBOL_TYPE (sym);
   CHECK_TYPEDEF (t);
   if (TYPE_CODE (t) != TYPE_CODE_STRUCT
       && TYPE_CODE (t) != TYPE_CODE_UNION
       && TYPE_CODE (t) != TYPE_CODE_NAMESPACE)
-    return 1;
+    return 1; /* Continue iterating.  */
 
   slot = htab_find_slot (collector->unique_syms, sym, INSERT);
   if (!*slot)
@@ -1824,7 +1824,7 @@ collect_one_symbol (struct symbol *sym, void *d)
       VEC_safe_push (symbolp, collector->symbols, sym);
     }
 
-  return 1;
+  return 1; /* Continue iterating.  */
 }
 
 /* Return the symbol corresponding to the substring of *ARGPTR ending
@@ -2215,7 +2215,7 @@ collect_function_symbols (struct symbol *sym, void *arg)
   if (SYMBOL_CLASS (sym) == LOC_BLOCK)
     VEC_safe_push (symbolp, *syms, sym);
 
-  return 1;
+  return 1; /* Continue iterating.  */
 }
 
 /* Look up a function symbol in *ARGPTR.  If found, advance *ARGPTR
@@ -2722,7 +2722,7 @@ collect_symbols (struct symbol *sym, void *data)
     add_sal_to_sals (info->state, &info->result, &sal,
 		     SYMBOL_NATURAL_NAME (sym));
 
-  return 1;
+  return 1; /* Continue iterating.  */
 }
 
 /* We've found a minimal symbol MSYMBOL to associate with our
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 216d6fe..ee4f483 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1900,7 +1900,7 @@ lookup_block_symbol (const struct block *block, const char *name,
 void
 iterate_over_symbols (const struct block *block, const char *name,
 		      const domain_enum domain,
-		      int (*callback) (struct symbol *, void *),
+		      symbol_found_callback_ftype callback),
 		      void *data)
 {
   while (block)
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 4836dd6..777e1c8 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1264,7 +1264,7 @@ VEC (CORE_ADDR) *find_pcs_for_symtab_line (struct symtab *symtab, int line,
 
 void iterate_over_symbols (const struct block *block, const char *name,
 			   const domain_enum domain,
-			   int (*callback) (struct symbol *, void *),
+			   symbol_found_callback_ftype callback),
 			   void *data);
 
 struct cleanup *demangle_for_lookup (const char *name, enum language lang,

  parent reply	other threads:[~2012-01-30 14:58 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   ` [RFA take 3] Allow setting breakpoints on inline functions (PR 10738) [repost] Jan Kratochvil
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         ` Gary Benson [this message]
2012-01-30 16:22           ` [RFA take 2] " 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=20120130145834.GD5210@redhat.com \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@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