From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26286 invoked by alias); 8 Apr 2011 20:42:12 -0000 Received: (qmail 26271 invoked by uid 22791); 8 Apr 2011 20:42:11 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e5.ny.us.ibm.com (HELO e5.ny.us.ibm.com) (32.97.182.145) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Apr 2011 20:42:06 +0000 Received: from d01dlp02.pok.ibm.com (d01dlp02.pok.ibm.com [9.56.224.85]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p38KGIoT009038 for ; Fri, 8 Apr 2011 16:16:18 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 7B4BB6E8036 for ; Fri, 8 Apr 2011 16:42:05 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p38Kg4cm2740236 for ; Fri, 8 Apr 2011 16:42:04 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p38Kg3dv031531 for ; Fri, 8 Apr 2011 17:42:04 -0300 Received: from [9.12.224.19] ([9.12.224.19]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p38Kg27S031408 for ; Fri, 8 Apr 2011 17:42:02 -0300 Subject: [patch][branch] Fix "save breakpoints" for watchpoints From: Thiago Jung Bauermann To: gdb-patches ml Content-Type: text/plain; charset="UTF-8" Date: Fri, 08 Apr 2011 20:42:00 -0000 Message-ID: <1302295317.2074.9.camel@hactar> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Content-Scanned: Fidelis XPS MAILER 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: 2011-04/txt/msg00129.txt.bz2 Hi, When I converted watchpoints to use the breakpoint_ops struct, I inadvertently broke saving watchpoints to a file, because save_breakpoints doesn't check whether tp->ops->print_recreate is NULL before calling it (as is customary before calling breakpoint_ops methods). This results in a segfault since I didn't provide an implementation for that method for watchpoints (save_breakpoints is capable of dealing with watchpoints). This simple patch fixes the bug. No regressions on i386-linux. Ok for HEAD and the branch? [0] - http://sourceware.org/ml/gdb-patches/2011-01/msg00228.html -- []'s Thiago Jung Bauermann IBM Linux Technology Center 2011-04-08 Thiago Jung Bauermann * breakpoint.c (save_breakpoints): Verify whether breakpoint_ops.print_recreate is defined before calling it. Index: gdb.git/gdb/breakpoint.c =================================================================== --- gdb.git.orig/gdb/breakpoint.c 2011-04-08 16:09:31.000000000 -0300 +++ gdb.git/gdb/breakpoint.c 2011-04-08 16:23:24.000000000 -0300 @@ -12337,7 +12337,7 @@ save_breakpoints (char *filename, int fr if (filter && !filter (tp)) continue; - if (tp->ops != NULL) + if (tp->ops != NULL && tp->ops->print_recreate != NULL) (tp->ops->print_recreate) (tp, fp); else {