From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5856 invoked by alias); 5 Nov 2014 12:26:44 -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 5841 invoked by uid 89); 5 Nov 2014 12:26:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Nov 2014 12:26:42 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1Xlzfa-0007NA-Lg from Yao_Qi@mentor.com ; Wed, 05 Nov 2014 04:26:38 -0800 Received: from GreenOnly (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.181.6; Wed, 5 Nov 2014 04:26:38 -0800 From: Yao Qi To: Pedro Alves CC: Subject: Re: [PATCH 3/3] fix skipping permanent breakpoints References: <1415127790-15091-1-git-send-email-palves@redhat.com> <1415127790-15091-4-git-send-email-palves@redhat.com> Date: Wed, 05 Nov 2014 12:26:00 -0000 In-Reply-To: <1415127790-15091-4-git-send-email-palves@redhat.com> (Pedro Alves's message of "Tue, 4 Nov 2014 19:03:10 +0000") Message-ID: <87y4rp7s02.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg00100.txt.bz2 Pedro Alves writes: > The patch also adds a new gdb.base/bp-permanent.exp test that > exercises many different code paths related to stepping permanent > breakpoints, including the stepping with signals cases. The test uses > "hack/trick" to make it work on all (or most) platforms -- it doesn't > really hard code a breakpoint instruction. It is great to test permanent breakpoint in an arch-independent way. It exposes an existing issue on permanent breakpoint which is found when I test your patch series on arm. breakpoint.c:bp_location_has_shadow should return false for permanent breakpoint because permanent breakpoint doesn't have shadow, otherwise, breakpoint_xfer_memory destroys contents read from memory_xfer_partial_1 and the internal error is triggered as below, (gdb) PASS: gdb.base/bp-permanent.exp: always_inserted=3Doff, sw_watchpoint= =3D0: stepi signal with handler: queue-signal SIGUSR1 stepi^M ../../../git/gdb/infrun.c:2112: internal-error: resume: Assertion `tp->cont= rol.step_resume_breakpoint->loc->permanent' failed.^M A problem internal to GDB has been detected, > + else > + { > + /* There's no signal to pass. Skip the permanent > + breakpoint, and arrange for any breakpoint at the new PC > + to be reported back to handle_inferior_event. */ > + > + if (debug_infrun) > + fprintf_unfiltered (gdb_stdlog, > + "infrun: resume: skipping permanent breakpoint\n"); > + gdbarch_skip_permanent_breakpoint (gdbarch, regcache); > + /* Update pc to reflect the new address from which we will > + execute instructions. */ > + pc =3D regcache_read_pc (get_thread_regcache (inferior_ptid)); Is get_thread_regcache (inferior_ptid) equivalent to regcache? If it is, we can use regcache which is shorter. > + tp->prev_pc =3D pc; > + > + clear_step_over_info (); > + tp->control.trap_expected =3D 0; > + > + /* There may or not be a breakpoint at the new address. If > + we're stepping then we're done. Otherwise, make sure > + there's a breakpoint at the current address, and let it > + trigger. */ Sorry, I can't map the comments to the code. Is "Otherwise" in the comments about the else branch which doesn't exist? Can you elaborate? > + if (step) > + { > + /* If we already have a step-resume breakpoint set, then > + we can just continue until that one is hit. */ When I read the comments, the code in my mind is like: if (tp->control.step_resume_breakpoint !=3D NULL) step =3D 0; which is different from your code below. > + if (tp->control.step_resume_breakpoint =3D=3D NULL) > + insert_step_resume_breakpoint_at_frame (get_current_frame ()); > + step =3D 0; > + } > + > + insert_breakpoints (); > + } > } >=20=20 > + > + with_test_prefix "next trips on permanent bp" { > + delete_breakpoints > + > + gdb_breakpoint "test_next" > + gdb_continue_to_breakpoint "test_next" > + > + gdb_breakpoint "$line_bp" > + gdb_test "condition \$bpnum 0" > + > + gdb_test "next" "after next .*" > + } > + > + if ![target_info exists gdb,nosignals] { > + We need also check can_single_step_to_signal_handler. --=20 Yao (=E9=BD=90=E5=B0=A7)