From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16833 invoked by alias); 24 Mar 2013 05:22:07 -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 16817 invoked by uid 89); 24 Mar 2013 05:21:59 -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; Sun, 24 Mar 2013 05:21:55 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UJdNR-0004Jt-Rn from Hui_Zhu@mentor.com for gdb-patches@sourceware.org; Sat, 23 Mar 2013 22:21:53 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sat, 23 Mar 2013 22:21:53 -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; Sat, 23 Mar 2013 22:21:52 -0700 Message-ID: <514E8D6C.2010606@mentor.com> Date: Sun, 24 Mar 2013 12:05: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 Subject: [PATCH] Fix create pending breakpoint handle extra_string issue if not parse_condition_and_thread Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-03/txt/msg00891.txt.bz2 Hi, I found that behavior is not right is create pending breakpoint handle extra_string issue if not parse_condition_and_thread. This issue cannot be reproduce with normal interpreter command "b" because it create breakpoint with parse_condition_and_thread. But mi command "-break-insert" have this issue, for example: gdb/testsuite$ gdb -i mi gdb.base/pending (gdb) -break-insert -f -c k>0 "pendfunc1 if k == 0" &"Function \"pendfunc1\" not defined.\n" ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="",pending="pendfunc1 if k == 0",cond="k>0",times="0",original-location="pendfunc1 if k == 0"} (gdb) info b &"info b\n" ~"Num Type Disp Enb Address What\n" ~"1 breakpoint keep y pendfunc1 if k == 0\n" ~"\tstop only if k>0\n" ^done (gdb) r &"r\n" ~"Starting program: /home/teawater/gdb/bgdbno/gdb/testsuite/gdb.base/pending \n" =thread-group-started,id="i1",pid="7861" =thread-created,id="1",group-id="i1" ^running *running,thread-id="all" =library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1" (gdb) =library-loaded,id="/home/teawater/gdb/bgdbno/gdb/testsuite/gdb.base/pendshr.sl",target-name="/home/teawater/gdb/bgdbno/gdb/testsuite/gdb.base/pendshr.sl",host-name="/home/teawater/gdb/bgdbno/gdb/testsuite/gdb.base/pendshr.sl",symbols-loaded="0",thread-group="i1" =library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="0",thread-group="i1" =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00007ffff7bd8607",func="pendfunc1",file="../../../src/gdb/testsuite/gdb.base/pendshr.c",fullname="/home/teawater/gdb/src/gdb/testsuite/gdb.base/pendshr.c",line="22",thread-groups=["i1"],cond="k == 0",times="0",original-location="pendfunc1 if k == 0"} =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00007ffff7bd8607",func="pendfunc1",file="../../../src/gdb/testsuite/gdb.base/pendshr.c",fullname="/home/teawater/gdb/src/gdb/testsuite/gdb.base/pendshr.c",line="22",thread-groups=["i1"],cond="k == 0",times="1",original-location="pendfunc1 if k == 0"} *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00007ffff7bd8607",func="pendfunc1",args=[{name="x",value="3"}],file="../../../src/gdb/testsuite/gdb.base/pendshr.c",fullname="/home/teawater/gdb/src/gdb/testsuite/gdb.base/pendshr.c",line="22"},thread-id="1",stopped-threads="all",core="6" info b &"info b\n" ~"Num Type Disp Enb Address What\n" ~"1 breakpoint keep y 0x00007ffff7bd8607 in pendfunc1 at ../../../src/gdb/testsuite/gdb.base/pendshr.c:22\n" ~"\tstop only if k == 0\n" ~"\tbreakpoint already hit 1 time\n" ^done (gdb) With 2 "info b", you can found that condition "k>0" is overwrite by "k==0". So I post a patch to fix this issue. Please help me review it. Best, Hui 2013-03-24 Hui Zhu * breakpoint.c (create_breakpoint): Handle extra_string if parse_condition_and_thread. (addr_string_to_sals): Add check for pending breakpoints. --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9687,7 +9687,11 @@ create_breakpoint (struct gdbarch *gdbar b->addr_string = copy_arg; if (parse_condition_and_thread) - b->cond_string = NULL; + { + b->cond_string = NULL; + b->extra_string = NULL; + b->condition_not_parsed = 1; + } else { /* Create a private copy of condition string. */ @@ -9697,11 +9701,17 @@ create_breakpoint (struct gdbarch *gdbar make_cleanup (xfree, cond_string); } b->cond_string = cond_string; + /* Create a private copy of extra string. */ + if (extra_string) + { + extra_string = xstrdup (extra_string); + make_cleanup (xfree, extra_string); + } + b->extra_string = extra_string; + b->condition_not_parsed = 0; } - b->extra_string = NULL; b->ignore_count = ignore_count; b->disposition = tempflag ? disp_del : disp_donttouch; - b->condition_not_parsed = 1; b->enable_state = enabled ? bp_enabled : bp_disabled; if ((type_wanted != bp_breakpoint && type_wanted != bp_hardware_breakpoint) || thread != -1) @@ -14166,7 +14176,8 @@ addr_string_to_sals (struct breakpoint * breakpoint being disabled, and don't want to see more errors. */ if (e.error == NOT_FOUND_ERROR - && (b->condition_not_parsed + && (b->condition_not_parsed + || (b->loc == NULL || b->loc->shlib_disabled) || (b->loc && b->loc->shlib_disabled) || (b->loc && b->loc->pspace->executing_startup) || b->enable_state == bp_disabled))