From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89571 invoked by alias); 3 Dec 2017 00:51:58 -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 89562 invoked by uid 89); 3 Dec 2017 00:51:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*r:8.14.7, cosmetics, 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; Sun, 03 Dec 2017 00:51:56 +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 vB30plWj027940 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 2 Dec 2017 19:51:52 -0500 Received: from [10.0.0.11] (192-222-251-162.qc.cable.ebox.net [192.222.251.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 5C8B11E4F2; Sat, 2 Dec 2017 19:51:47 -0500 (EST) Subject: Re: [PATCH 1/2] Make make-target-delegates grok namespace scope op and template params From: Simon Marchi To: Pedro Alves Cc: gdb-patches@sourceware.org References: <1509377531-21044-1-git-send-email-palves@redhat.com> <1509377531-21044-2-git-send-email-palves@redhat.com> <6d65bbfce86476451463c8d880c38a54@polymtl.ca> Message-ID: <7cbbbfaf-67c9-9a08-79aa-92d87efb69e9@polymtl.ca> Date: Sun, 03 Dec 2017 00:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <6d65bbfce86476451463c8d880c38a54@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 3 Dec 2017 00:51:47 +0000 X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00049.txt.bz2 On 2017-10-30 12:02 PM, Simon Marchi wrote: > 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 Hi Pedro, Do you mind if I rebase and push this patch? Additional cleanups I have in line would benefit from it. Thanks, Simon