From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7584 invoked by alias); 8 Sep 2007 13:17:04 -0000 Received: (qmail 7575 invoked by uid 22791); 8 Sep 2007 13:17:03 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 08 Sep 2007 13:16:56 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.1/8.14.0) with ESMTP id l88DEGEA026035; Sat, 8 Sep 2007 15:14:17 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.1/8.14.1/Submit) id l88DEFQp019917; Sat, 8 Sep 2007 15:14:16 +0200 (CEST) Date: Sat, 08 Sep 2007 13:17:00 -0000 Message-Id: <200709081314.l88DEFQp019917@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: vladimir@codesourcery.com CC: gdb-patches@sources.redhat.com In-reply-to: <200709080248.52539.vladimir@codesourcery.com> (message from Vladimir Prus on Sat, 8 Sep 2007 02:48:52 +0400) Subject: Re: [8/9] multiple locations References: <200709080248.52539.vladimir@codesourcery.com> 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: 2007-09/txt/msg00120.txt.bz2 > From: Vladimir Prus > Date: Sat, 8 Sep 2007 02:48:52 +0400 > > This patch allows a breakpoint to have several breakpoint locations. > There's lot of mechanical changes -- from iteration over breakpoints > to iteration over locations. Also, this splits breakpoint enable/disable > state, changeable by user, from 'shlib_disabled' state, maintained by > gdb and stored inside location. The breakpoint printing code is modified > to print locations of breakpoint. OK? > > - Volodya > > /* 1 */ > annotate_field (0); > - ui_out_field_int (uiout, "number", b->number); > + if (part_of_multiple) > + { > + char buf[30]; > + sprintf (buf, "%d.%d", b->number, loc_number); Please don't use sprintf(); it's an evil function since it doesn't check for buffer overflows. And even when you can prove that the buffer is large enough, it's better not to use it, to make auditing the code easier. So please use xsnprintf() (or snprintf() outside of GDB). Or if you want to address Eli's concerns, you could use xasprintf, but make sure you xfree() the memory allocated by it. Mark