From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11894 invoked by alias); 8 Oct 2008 20:14:54 -0000 Received: (qmail 11884 invoked by uid 22791); 8 Oct 2008 20:14:53 -0000 X-Spam-Check-By: sourceware.org Received: from igw1.br.ibm.com (HELO igw1.br.ibm.com) (32.104.18.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 08 Oct 2008 20:14:10 +0000 Received: from d24relay01.br.ibm.com (unknown [9.8.31.16]) by igw1.br.ibm.com (Postfix) with ESMTP id 15B8032C1C4 for ; Wed, 8 Oct 2008 16:42:11 -0300 (BRT) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m98KDmRj2093134 for ; Wed, 8 Oct 2008 17:13:48 -0300 Received: from d24av02.br.ibm.com (loopback [127.0.0.1]) by d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m98KDvfb016573 for ; Wed, 8 Oct 2008 17:13:57 -0300 Received: from [9.8.10.102] ([9.8.10.102]) by d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m98KDvpn016561; Wed, 8 Oct 2008 17:13:57 -0300 Subject: Re: [RFA] Resubmit reverse debugging [5/5] From: Thiago Jung Bauermann To: Michael Snyder Cc: "gdb-patches@sourceware.org" In-Reply-To: <1223489663.19088.43.camel@localhost.localdomain> References: <48EC18F9.8040105@vmware.com> <1223489663.19088.43.camel@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Date: Wed, 08 Oct 2008 20:14:00 -0000 Message-Id: <1223496839.19088.51.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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-10/txt/msg00254.txt.bz2 El mié, 08-10-2008 a las 15:14 -0300, Thiago Jung Bauermann escribió: > El mar, 07-10-2008 a las 19:20 -0700, Michael Snyder escribió: > > +static void > > +exec_reverse_once (char *cmd, char *args, int from_tty) > > +{ > > + /* String buffer for command consing. */ > > + char reverse_command[512]; > > > + sprintf (reverse_command, "%s %s", cmd, args ? args : ""); > > + > > + execution_direction = EXEC_REVERSE; > > + execute_command (reverse_command, from_tty); > > + do_cleanups (old_chain); > > That fixed-length buffer being written with sprintf doesn't look good... > What do you think about using xstrprintf instead? That will remove the > possibility of buffer overflow, and also remove an arbitrary limit. By the way, the string manipulation can be avoided if you pass a function pointer to exec_reverse_once. Then you can call it passing next_command, continue_command and all others. It seems cleaner to me, what do you think? Also, will there be anything added to reverse.c in the future? If not, IMHO it's easier just to put these command definitions and setup in infcmd.c, next to their forward counterparts. -- []'s Thiago Jung Bauermann IBM Linux Technology Center