From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29502 invoked by alias); 22 Mar 2013 06:17:20 -0000 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 Received: (qmail 29424 invoked by uid 89); 22 Mar 2013 06:16:33 -0000 X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 22 Mar 2013 06:16:30 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UIvHA-0003e6-F5 from Hui_Zhu@mentor.com ; Thu, 21 Mar 2013 23:16:28 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 21 Mar 2013 23:16:28 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Thu, 21 Mar 2013 23:16:27 -0700 Message-ID: <514BF736.3070706@mentor.com> Date: Fri, 22 Mar 2013 07:39:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: gdb-patches ml CC: Marc Khouzam Subject: [PATCH] Fix dprintf work not right if it is pending Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-03/txt/msg00829.txt.bz2 Hi. I found that dprintf work not right if it is pending, for example: testsuite$ gdb gdb.base/pending (gdb) dprintf pendfunc1, "got\n" Function "pendfunc1" not defined. Make dprintf pending on future shared library load? (y or [n]) y Dprintf 1 (pendfunc1, "got\n") pending. (gdb) r Starting program: /home/teawater/gdb/bgdbno/gdb/testsuite/gdb.base/pending (gdb) c Continuing. in pendfunc1, x is 3 (gdb) c Continuing. in pendfunc1, x is 4 (gdb) c Continuing. in pendfunc1, x is 3 [Inferior 1 (process 2370) exited normally] The dprintf's commands is setup in function init_breakpoint_sal: /* Dynamic printf requires and uses additional arguments on the command line, otherwise it's an error. */ if (type == bp_dprintf) { if (b->extra_string) update_dprintf_command_list (b); else error (_("Format string required")); } else if (b->extra_string) error (_("Garbage '%s' at end of command"), b->extra_string); But if the dprintf is pending. When it reset by function bkpt_re_set, there is not code to code to update extra_string to commands. So I add this code to function update_breakpoint_locations. The issue is fixed. Please help me review it. Best. Hui 2013-03-22 Hui Zhu * breakpoint.c (update_breakpoint_locations): Add handler for dprintf. --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -14075,6 +14075,18 @@ update_breakpoint_locations (struct brea new_loc->length = end - sals.sals[0].pc + 1; } + + /* Dynamic printf requires and uses additional arguments on the + command line, otherwise it's an error. */ + if (b->type == bp_dprintf) + { + if (b->extra_string) + update_dprintf_command_list (b); + else + error (_("Format string required")); + } + else if (b->extra_string) + error (_("Garbage '%s' at end of command"), b->extra_string); } /* Update locations of permanent breakpoints. */