From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8856 invoked by alias); 30 Jan 2012 14:04:01 -0000 Received: (qmail 8840 invoked by uid 22791); 30 Jan 2012 14:03:58 -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; Mon, 30 Jan 2012 14:03:44 +0000 Date: Mon, 30 Jan 2012 14:16:00 -0000 From: Gary Benson To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: [RFA] Linespec tweak (was: Re: [RFA take 3] Allow setting breakpoints on inline functions (PR 10738)) Message-ID: <20120130140339.GB5210@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> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline In-Reply-To: <20120128090724.GA30170@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-01/txt/msg00987.txt.bz2 --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1264 Jan Kratochvil wrote: > On Fri, 27 Jan 2012 16:10:34 +0100, Gary Benson wrote: > > @@ -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. 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? Cheers, Gary -- http://gbenson.net/ --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="sdfkjkljs.patch" Content-length: 2806 diff --git a/gdb/linespec.c b/gdb/linespec.c index 50ebf6f..420ec15 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -341,10 +341,20 @@ 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. */ } +/* 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 + nonzero to indicate that iterate_over_all_matching_symtabs should + continue iterating, or zero to indicate that the iteration should + end. */ + +typedef int (symbol_found_callback_ftype) (struct symbol *sym, void *data); + /* 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 @@ -353,7 +363,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 +1818,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 +1834,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 +2225,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 +2732,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 --OXfL5xGRrasGEqWY--