From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129095 invoked by alias); 13 May 2015 10:38:51 -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 129074 invoked by uid 89); 13 May 2015 10:38:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 13 May 2015 10:38:47 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4DAcgND001927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 13 May 2015 06:38:42 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4DAceOd003699; Wed, 13 May 2015 06:38:40 -0400 Message-ID: <555329AF.5090905@redhat.com> Date: Wed, 13 May 2015 10:38:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Gabriel Krisman Bertazi , sergiodj@redhat.com CC: gdb-patches@sourceware.org, dje@google.com Subject: Re: [PATCH v4 2/5] Add support to catch groups of syscalls. References: <87wq0gtfxu.fsf@redhat.com> <1431304069-19647-1-git-send-email-gabriel@krisman.be> <1431304069-19647-3-git-send-email-gabriel@krisman.be> In-Reply-To: <1431304069-19647-3-git-send-email-gabriel@krisman.be> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-05/txt/msg00302.txt.bz2 On 05/11/2015 01:27 AM, Gabriel Krisman Bertazi wrote: > catch_syscall_completer (struct cmd_list_element *cmd, > const char *text, const char *word) > { > - const char **list = get_syscall_names (get_current_arch ()); > - VEC (char_ptr) *retlist > - = (list == NULL) ? NULL : complete_on_enum (list, word, word); > + struct gdbarch *gdbarch = get_current_arch (); > + struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); > + VEC (char_ptr) *group_retlist = NULL; > + VEC (char_ptr) *syscall_retlist = NULL; > + VEC (char_ptr) *retlist = NULL; > + const char **group_list = NULL; > + const char **syscall_list = NULL; > + const char *prefix; > + int i; > + > + /* Complete with both, syscall names and groups. */ > + syscall_list = get_syscall_names (gdbarch); > + group_list = get_syscall_group_names (gdbarch); > + > + /* Append "group:" prefix to syscall groups. */ > + for (i = 0; group_list[i] != NULL; i++) > + { > + char *prefixed_group = xstrprintf ("group:%s", group_list[i]); > + > + group_list[i] = prefixed_group; > + make_cleanup (xfree, prefixed_group); > + } > + ... > + VEC_free (char_ptr, syscall_retlist); > + VEC_free (char_ptr, group_retlist); > + xfree (syscall_list); > + xfree (group_list); > + do_cleanups (cleanups); > Odd pattern of mixing VEC_free/xfree and cleanups. Any reason those don't go through cleanups too? Note: for VECs, there's VEC_cleanup. > - xfree (list); > return retlist; > } > Thanks, Pedro Alves