From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32505 invoked by alias); 6 Oct 2010 22:52:00 -0000 Received: (qmail 32497 invoked by uid 22791); 6 Oct 2010 22:51:59 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_YM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Oct 2010 22:51:54 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o96MpeWn015883 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 6 Oct 2010 18:51:40 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o96Mpd3t001406; Wed, 6 Oct 2010 18:51:40 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o96Mpd6t016404; Wed, 6 Oct 2010 18:51:39 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id A4E43378893; Wed, 6 Oct 2010 16:51:38 -0600 (MDT) From: Tom Tromey To: Hilfinger@adacore.com Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Rework symbol searches to move Ada-specific stuff to ada-lang.c. References: <201010050842.o958gDNO002818@syracuse.mckusick.com> Date: Wed, 06 Oct 2010 22:52:00 -0000 In-Reply-To: <201010050842.o958gDNO002818@syracuse.mckusick.com> (Paul Hilfinger's message of "Tue, 5 Oct 2010 01:42:13 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-10/txt/msg00095.txt.bz2 >>>>> "Paul" == Paul Hilfinger writes: Paul> Having added this general routine to psymtab.c, we use it in ada-lang.c Paul> to rework add_non_local_symbols (now renamed add_nonlocal_symbols). I don't think I should approve the ada-specific changes -- and I was wrong to do so in my last review, I'll send a follow-up. The psymtab / symfile / dwarf2read changes seem fine though. I have a few little nits. Paul> +dw2_map_matching_symbols (const char* name, domain_enum namespace, "const char *name" Paul> /* Lookup a partial symbol. */ Paul> +static struct partial_symbol *match_partial_symbol (struct partial_symtab *, Paul> + int, Paul> + const char *, domain_enum, Paul> + int (*) (const char *, Paul> + const char *), Paul> + int (*) (const char *, Paul> + const char *)); Paul> + Paul> + Paul> static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *, This insertion separates a comment from the declaration it comments. I think it is fine to just remove that comment, though. It doesn't really add anything. Paul> +/* Look in PST for a symbol in DOMAIN whose name matches NAME. Search Paul> + the global block of PST if GLOBAL, and otherwise the static block. Paul> + MATCH is the comparison operation that returns true iff MATCH (s, Paul> + NAME), where s is a SYMBOL_SEARCH_NAME. If ORDERED_COMPARE is Paul> + non-null, the symbols in the block are assumed to be ordered Paul> + according to it (allowing binary search). It must be compatible Paul> + with MATCH. Returns the symbol, if found, and otherwise NULL. */ Paul> +static struct partial_symbol * Paul> +match_partial_symbol (struct partial_symtab *pst, int global, We've recently started trying to enforce the rule about having a blank line between a function comment and the start of the function definition. Paul> + return (*top); A few places have parens here, but they aren't needed. Just write "return *top;". Paul> + /* Find global or static symbols in all tables that are in NAMESPACE Paul> + and for which MATCH (symbol name, NAME) == 0, passing each to Paul> + CALLBACK, reading in partial symbol symbol tables as needed. Look Paul> + through global symbols if GLOBAL and otherwise static symbols. Paul> + Passes NAME, NAMESPACE, and DATA to CALLBACK with each symbol Paul> + found. After each block is processed, passes NULL to CALLBACK. Paul> + MATCH must be weaker than strcmp_iw in the sense that Paul> + strcmp_iw(x,y) == 0 --> MATCH(x,y) == 0. ORDERED_COMPARE, if Paul> + non-null, must be an ordering relation compatible with strcmp_iw Paul> + in the sense that Paul> + strcmp(x,y) == 0 --> ORDERED_COMPARE(x,y) == 0 Paul> + and Paul> + strcmp(x,y) <= 0 --> ORDERED_COMPARE(x,y) <= 0 Paul> + (allowing strcmp(x,y) < 0 while ORDERED_COMPARE(x, y) == 0). Paul> + CALLBACK returns 0 to indicate that the scan should continue, or Paul> + non-zero to indicate that the scan should be terminated. */ Thanks for being so thorough in this comment. Tom