From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7799 invoked by alias); 1 Feb 2012 16:14:15 -0000 Received: (qmail 7788 invoked by uid 22791); 1 Feb 2012 16:14:12 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,SPF_FAIL,TW_BJ X-Spam-Check-By: sourceware.org Received: from gbenson.demon.co.uk (HELO gbenson.demon.co.uk) (80.177.220.214) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Feb 2012 16:13:57 +0000 Date: Wed, 01 Feb 2012 16:14:00 -0000 From: Gary Benson To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: [commit] Re: [RFA take 2] Linespec tweak (was: Re: [RFA take 3] Allow setting breakpoints on inline functions (PR 10738)) Message-ID: <20120201161354.GA4256@redhat.com> Mail-Followup-To: Jan Kratochvil , gdb-patches@sourceware.org References: <20120127151034.GA22606@redhat.com> <20120128001638.GA4448@host2.jankratochvil.net> <20120128090724.GA30170@host2.jankratochvil.net> <20120130140339.GB5210@redhat.com> <20120130141612.GA25851@host2.jankratochvil.net> <20120130145834.GD5210@redhat.com> <20120130150502.GA28076@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline In-Reply-To: <20120130150502.GA28076@host2.jankratochvil.net> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00018.txt.bz2 --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 773 Jan Kratochvil wrote: > On Mon, 30 Jan 2012 15:58:34 +0100, Gary Benson wrote: > > Updated patch attached. > > It is (up to few exceptions as I see) standard in GDB rather than: > typedef int (*symbol_found_callback_ftype) (struct symbol *sym, void *data); > to do: > typedef int (symbol_found_callback_ftype) (struct symbol *sym, void *data); > > and then everywhere change: > symbol_found_callback_ftype callback, > -> > symbol_found_callback_ftype *callback, > > It is not covered by the coding rules, though. > > > Is this ok to commit? > > With that change yes. I have committed this, with one extra modification in that I moved the new symbol_found_callback_ftype typedef from language.h to symtab.h. Cheers, Gary -- http://gbenson.net/ --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch Content-length: 5846 Index: gdb/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.13795 diff -u -r1.13795 ChangeLog --- gdb/ChangeLog 1 Feb 2012 15:49:30 -0000 1.13795 +++ gdb/ChangeLog 1 Feb 2012 16:08:51 -0000 @@ -1,3 +1,16 @@ +2012-02-01 Gary Benson + + * symtab.h (symbol_name_match_p_ftype): New typedef. + (iterate_over_symbols): Use the above. + * symtab.c (iterate_over_symbols): Likewise. + * language.h (language_defn->la_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-02-01 Tom Tromey * ada-lang.c (resolve_subexp): Update. Index: gdb/ada-lang.c =================================================================== RCS file: /cvs/src/src/gdb/ada-lang.c,v retrieving revision 1.334 diff -u -r1.334 ada-lang.c --- gdb/ada-lang.c 1 Feb 2012 15:49:33 -0000 1.334 +++ gdb/ada-lang.c 1 Feb 2012 16:08:54 -0000 @@ -5102,7 +5102,7 @@ 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; Index: gdb/language.h =================================================================== RCS file: /cvs/src/src/gdb/language.h,v retrieving revision 1.77 diff -u -r1.77 language.h --- gdb/language.h 31 Jan 2012 18:26:47 -0000 1.77 +++ gdb/language.h 1 Feb 2012 16:08:54 -0000 @@ -354,7 +354,7 @@ 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. */ Index: gdb/linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.146 diff -u -r1.146 linespec.c --- gdb/linespec.c 27 Jan 2012 20:31:13 -0000 1.146 +++ gdb/linespec.c 1 Feb 2012 16:08:54 -0000 @@ -341,8 +341,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 Index: gdb/symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.294 diff -u -r1.294 symtab.c --- gdb/symtab.c 28 Jan 2012 18:08:20 -0000 1.294 +++ gdb/symtab.c 1 Feb 2012 16:08:56 -0000 @@ -1900,7 +1900,7 @@ 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) Index: gdb/symtab.h =================================================================== RCS file: /cvs/src/src/gdb/symtab.h,v retrieving revision 1.200 diff -u -r1.200 symtab.h --- gdb/symtab.h 31 Jan 2012 18:19:49 -0000 1.200 +++ gdb/symtab.h 1 Feb 2012 16:08:56 -0000 @@ -1248,9 +1248,18 @@ VEC (CORE_ADDR) *find_pcs_for_symtab_line (struct symtab *symtab, int line, struct linetable_entry **best_entry); +/* 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); + 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, --3MwIy2ne0vdjdPXF--