From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14535 invoked by alias); 27 Dec 2011 04:17:18 -0000 Received: (qmail 14516 invoked by uid 22791); 27 Dec 2011 04:17:16 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_HP,TW_XS X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Dec 2011 04:17:02 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5CBA62BB0E6; Mon, 26 Dec 2011 23:17:01 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9TflQiJs+BQE; Mon, 26 Dec 2011 23:17:01 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id DCAA92BB04F; Mon, 26 Dec 2011 23:17:00 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 585F0145615; Mon, 26 Dec 2011 20:16:51 -0800 (PST) Date: Tue, 27 Dec 2011 04:18:00 -0000 From: Joel Brobecker To: Kevin Pouget Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFC] Python Finish Breakpoints Message-ID: <20111227041651.GB23376@adacore.com> References: <20111221065224.GA4120@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ZwgA9U+XZDXt4+m+" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2011-12/txt/msg00827.txt.bz2 --ZwgA9U+XZDXt4+m+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 272 > (i won't be able to fix the ARI until the mid of next week but i'll take a > look at that ASAP and for sure before the release) I've checked in a fix in HEAD. Tested on x86_64-linux without any regression. Not sure if we'll want it for the 7.4 branch or not. -- Joel --ZwgA9U+XZDXt4+m+ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="py-bp-sprintf.diff" Content-length: 998 commit b8c553d40b229b1b25c1e5bb309e0c8f5745ebc2 Author: Joel Brobecker Date: Mon Dec 26 15:08:34 2011 +0400 remove use of sprintf in py-finishbreakpoint.c... ... and replace it with call to xsnprintf, following GDB's coding rules. gdb/ChangeLog: * py-finishbreakpoint.c (bpfinishpy_init): Replace call to sprintf by call to xsnprintf. diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index a2d8165..c158d47 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -277,7 +277,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) { /* Set a breakpoint on the return address. */ finish_pc = get_frame_pc (prev_frame); - sprintf (small_buf, "*%s", hex_string (finish_pc)); + xsnprintf (small_buf, sizeof (small_buf), "*%s", hex_string (finish_pc)); addr_str = small_buf; create_breakpoint (python_gdbarch, --ZwgA9U+XZDXt4+m+--