From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25595 invoked by alias); 23 May 2008 19:53:21 -0000 Received: (qmail 25582 invoked by uid 22791); 23 May 2008 19:53:20 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 23 May 2008 19:53:03 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m4NJn0uX010273; Fri, 23 May 2008 15:49:00 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m4NJmxgG003791; Fri, 23 May 2008 15:48:59 -0400 Received: from opsy.redhat.com (vpn-10-101.bos.redhat.com [10.16.10.101]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m4NJmm8j010366; Fri, 23 May 2008 15:48:56 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 5D5DF37815D; Fri, 23 May 2008 13:48:35 -0600 (MDT) To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: RFA: Patch: implement missing macro functions References: <200805232030.20677.pedro@codesourcery.com> From: Tom Tromey Reply-To: Tom Tromey X-Attribution: Tom Date: Sat, 24 May 2008 16:34:00 -0000 In-Reply-To: <200805232030.20677.pedro@codesourcery.com> (Pedro Alves's message of "Fri\, 23 May 2008 20\:30\:20 +0100") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: 2008-05/txt/msg00691.txt.bz2 >>>>> "Pedro" =3D=3D Pedro Alves writes: Pedro> You'll need someone else to comment on the big picture -- I'll Pedro> comment on a few strokes, below, Thanks for taking the time to do this. >> + =C2=A0cleanup_chain =3D make_my_cleanup (&cleanup_chain, free_current_= contents, >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 &name); Pedro> That is a big nop to write + with 2 leaks attached. The new cleanup= is Pedro> being discarded and leaked, so NAME isn't being free'd at all. Pedro> Don't call make_my_cleanup directly. Instead, call Pedro> make_cleanup and discard its result: Ok, thanks. I forgot to mention in my note that I wanted someone to look at this. I don't actually understand the cleanup mechanism... I looked a bit but didn't see any documentation on how to use it. >> + =C2=A0gdb_flush (gdb_stdout); Pedro> Did you really need a gdb_flush here? Probably not. I'll remove it and see. >> =C2=A0 >> +/* Helper function for macro_for_each. =C2=A0*/ >> +static int >> +foreach_macro (splay_tree_node node, void *fnp) >> +{ >> + =C2=A0macro_callback_fn fn =3D (macro_callback_fn) fnp; Pedro> (Hmmm, can we assume casting void* <-> func pointers is safe on all Pedro> supported hosts/compilers? Posix and Windows do require it to Pedro> be safe. I actually have no idea how much GDB common code relies Pedro> on it today.) I'll just fix it. Pedro> Would it make sense to have a test with macro arguments, and Pedro> a test where a user macro overrides a source macro? Yeah. Lazy me! I will add those. Tom