From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45325 invoked by alias); 30 Oct 2017 16:02:17 -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 45315 invoked by uid 89); 30 Oct 2017 16:02:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=reserved X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Oct 2017 16:02:11 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v9UG24MZ011437 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 30 Oct 2017 12:02:09 -0400 Received: by simark.ca (Postfix, from userid 112) id 2931C1E534; Mon, 30 Oct 2017 12:02:04 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 84C271E51D; Mon, 30 Oct 2017 12:02:03 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 30 Oct 2017 16:02:00 -0000 From: Simon Marchi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] Make make-target-delegates grok namespace scope op and template params In-Reply-To: <1509377531-21044-2-git-send-email-palves@redhat.com> References: <1509377531-21044-1-git-send-email-palves@redhat.com> <1509377531-21044-2-git-send-email-palves@redhat.com> Message-ID: <6d65bbfce86476451463c8d880c38a54@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 30 Oct 2017 16:02:04 +0000 X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00902.txt.bz2 On 2017-10-30 11:32, Pedro Alves wrote: > The next patch will want to use gdb::array_view as parameter type > of a target_ops method. However, that runs into a > make-target-delegates limitation: target_debug_foo calls in > target-delegates.c for parameters/return types with namespace scope > operators ("::") or template parameters, end up looking like: > > @@ -1313,9 +1313,7 @@ debug_set_syscall_catchpoint (struct target_ops > *self, int arg1, int arg2, int a > fputs_unfiltered (", ", gdb_stdlog); > target_debug_print_int (arg3); > fputs_unfiltered (", ", gdb_stdlog); > - target_debug_print_int (arg4); > - fputs_unfiltered (", ", gdb_stdlog); > - target_debug_print_int_p (arg5); > + target_debug_print_gdb::array_view (arg4); > > which obviously isn't something that compiles. The problem is that > make-target-delegates wasn't ever taught that '::', '<', and '>' can > appear in parameter/return types. You could work around it by hidding > the unsupported characters behind a typedef in the target method > declaration, or by using an explicit TARGET_DEBUG_PRINTER, but it's > better to just remove the limitation. > > While at it, also fix an "abuse" of reserved identifiers. > > gdb/ChangeLog: > yyyy-mm-dd Pedro Alves > > * make-target-delegates (munge_type): Also munge '<', '>', and > ':'. Avoid double underscores in identifiers, and trailing > underscores. > * target-debug.h > (target_debug_print_VEC_static_tracepoint_marker_p__p): Rename to > ... > (target_debug_print_VEC_static_tracepoint_marker_p_p): ... this. > * target-delegates.c: Regenerate. > --- > gdb/make-target-delegates | 12 +++++++++++- > gdb/target-debug.h | 2 +- > gdb/target-delegates.c | 2 +- > 3 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/gdb/make-target-delegates b/gdb/make-target-delegates > index fd51c64..1773232 100755 > --- a/gdb/make-target-delegates > +++ b/gdb/make-target-delegates > @@ -232,8 +232,18 @@ sub munge_type($) { > $result = $1; > } else { > ($result = $typename) =~ s/\s+$//; > - $result =~ s/[ ()]/_/g; > + $result =~ s/[ ()<>:]/_/g; > $result =~ s/[*]/p/g; > + > + # Identifers with double underscores are reserved to the C++ > + # implementation. > + $result =~ s/_+/_/g; > + > + # Avoid ending the function name with underscore, for > + # cosmetics. Trailing underscores appear after munging types > + # with template parameters, like e.g. "foo". > + $result =~ s/_$//g; > + > $result = 'target_debug_print_' . $result; > } > > diff --git a/gdb/target-debug.h b/gdb/target-debug.h > index 14196b4..068495e 100644 > --- a/gdb/target-debug.h > +++ b/gdb/target-debug.h > @@ -116,7 +116,7 @@ > target_debug_do_print (host_address_to_string (X)) > #define target_debug_print_mem_region_vector(X) \ > target_debug_do_print (host_address_to_string (X.data ())) > -#define target_debug_print_VEC_static_tracepoint_marker_p__p(X) \ > +#define target_debug_print_VEC_static_tracepoint_marker_p_p(X) \ > target_debug_do_print (host_address_to_string (X)) > #define target_debug_print_const_struct_target_desc_p(X) \ > target_debug_do_print (host_address_to_string (X)) > diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c > index e0d7a9a..1cbe6f8 100644 > --- a/gdb/target-delegates.c > +++ b/gdb/target-delegates.c > @@ -3352,7 +3352,7 @@ debug_static_tracepoint_markers_by_strid (struct > target_ops *self, const char *a > fputs_unfiltered (", ", gdb_stdlog); > target_debug_print_const_char_p (arg1); > fputs_unfiltered (") = ", gdb_stdlog); > - target_debug_print_VEC_static_tracepoint_marker_p__p (result); > + target_debug_print_VEC_static_tracepoint_marker_p_p (result); > fputs_unfiltered ("\n", gdb_stdlog); > return result; > } LGTM, I'll make a patch to remove the mem_region_vector typedef. Simon