From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59006 invoked by alias); 18 Sep 2018 15:52:15 -0000 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 Received: (qmail 58171 invoked by uid 89); 18 Sep 2018 15:52:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.189) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Sep 2018 15:52:12 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 95B9030E626 for ; Tue, 18 Sep 2018 10:52:11 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 2II9guYroaSey2IIHgKoAZ; Tue, 18 Sep 2018 10:52:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wUoE2m7VMGW+FCO7BPPzDdJmudLxr3h7s7iFy6/E4iQ=; b=mXATvhPCoIvvRK7+EopMwUz/69 B6R5UFMOAUOvgsF7e5Rlwsl8jINAafLqPaoUkGWrjrfEedmqNMJWvp4U1KCo6sehLrDq8uaFYVcJb CogluvH2Vvf2JYAmAuRccDa0C; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:52242 helo=pokyo) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1g2II9-002BlF-1y; Tue, 18 Sep 2018 10:51:57 -0500 From: Tom Tromey To: Philippe Waroquiers Cc: gdb-patches@sourceware.org Subject: Re: [RFAv2 3/6] Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args to info [args|functions|locals|variables] References: <20180826165359.1600-1-philippe.waroquiers@skynet.be> <20180826165359.1600-4-philippe.waroquiers@skynet.be> Date: Tue, 18 Sep 2018 15:52:00 -0000 In-Reply-To: <20180826165359.1600-4-philippe.waroquiers@skynet.be> (Philippe Waroquiers's message of "Sun, 26 Aug 2018 18:53:56 +0200") Message-ID: <874lemu7kz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-09/txt/msg00636.txt.bz2 >>>>> "Philippe" == Philippe Waroquiers writes: Philippe> As stack.h now uses a type defined in gdb_regex.h, all files including stack.h Philippe> need to include gdb_regex.h. It's better to just include gdb_regex.h from stack.h in this situation. Philippe> + if (preg I think preg.has_value (). gdb is trending away from these bool conversions, I think. At least that's been the style for pointers. Philippe> + if (treg Here too. Philippe> +/* Prepares the regular expression REG from REGEXP. Philippe> + If REGEXP is NULL, it results in an empty regular expression. */ Philippe> +static void Philippe> +prepare_reg (const char *regexp, gdb::optional ®) Out parameters should be pointers in the gdb style. Philippe> - iterate_over_block_local_vars (block, Philippe> + iterate_over_block_local_vars (block, preg, treg, Philippe> do_print_variable_and_value, Philippe> &cb_data); iterate_over_block_local_vars already takes some opaque data that it just passes through to the callback. So, I think there should not be a need to add the regexp parameters directly to it. Instead they can be put into the cb_data here. Philippe> void Philippe> iterate_over_block_arg_vars (const struct block *b, Philippe> + const gdb::optional &preg, Philippe> + const gdb::optional &treg, Philippe> iterate_over_block_arg_local_vars_cb cb, Philippe> void *cb_data) Same here. Philippe> +/* Returns true if the type_name of symbol_type of SYM matches TREG. Philippe> + If SYM has no symbol_type or symbol_name, returns false. */ Philippe> + Philippe> +bool Philippe> +treg_matches_sym_type_name (const compiled_regex &treg, Philippe> + const struct symbol *sym) Philippe> +{ Philippe> + if (language_mode == language_mode_auto) Philippe> + language_def (SYMBOL_LANGUAGE (sym))->la_print_type Philippe> + (sym_type, "", &printed_sym_type_name, Philippe> + -1, 0, &default_ptype_flags); I think this won't actually work, because the type printing code is free to use current_language. This is not good, but it is how it is. So instead I think what this should do is save and restore the current language. IIRC there's a helper RAII class for that already. Then you can just call type_print and drop patch #2. Philippe> +extern bool Philippe> +treg_matches_sym_type_name (const compiled_regex &treg, Philippe> + const struct symbol *sym); No newline after the "bool" for a declaration. Tom