From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18817 invoked by alias); 24 Dec 2009 17:38:29 -0000 Received: (qmail 18808 invoked by uid 22791); 24 Dec 2009 17:38:29 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Dec 2009 17:38:24 +0000 Received: (qmail 19507 invoked from network); 24 Dec 2009 17:38:22 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Dec 2009 17:38:22 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFC] Add support of software single step to process record Date: Thu, 24 Dec 2009 17:38:00 -0000 User-Agent: KMail/1.9.10 Cc: Hui Zhu , Joel Brobecker , Michael Snyder , shuchang zhou , paawan oza , Tom Tromey References: <20091223065141.GT2788@adacore.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200912241738.19780.pedro@codesourcery.com> 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: 2009-12/txt/msg00382.txt.bz2 On Wednesday 23 December 2009 09:23:21, Hui Zhu wrote: > + =C2=A0 =C2=A0 =C2=A0struct gdbarch *gdbarch =3D target_thread_architect= ure (ptid); > + > =C2=A0 =C2=A0 =C2=A0 =C2=A0record_message (get_current_regcache (), signa= l); > =C2=A0 =C2=A0 =C2=A0 =C2=A0record_beneath_to_resume (record_beneath_to_re= sume_ops, ptid, 1, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0signal); Why is this resume call still present? > + > + =C2=A0 =C2=A0 =C2=A0 if (gdbarch_software_single_step_p (gdbarch)) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!inserted_single_step_breakpoint= _p ()) Isn't this naming stale? I thought you had renamed this. > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gdbarch_software_single_step = (gdbarch, get_current_frame ()); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 record_beneath_to_resume (record_ben= eath_to_resume_ops, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ptid, step, signal); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 record_resume_step =3D 0; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > + =C2=A0 =C2=A0 =C2=A0 else > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 record_beneath_to_resume (record_beneath_to= _resume_ops, ptid, 1, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 signal); > =C2=A0 =C2=A0 =C2=A0} >=20 You've got the predicates a bit mixed up. - gdbarch_software_single_step_p purpose is only "is there or not a gdbarch_software_single_step callback registered in this gdbarch"? It returning true does not mean that software single-step should be used for that single-step. - gdbarch_software_single_step can return false, meaning, no software single-step needs to be used. This is how stepping over atomic sequences is handled currently (grep for deal_with_atomic_sequence): gdbarch_software_single_step_p returns true, but gdbarch_software_single_step returns false most of the times. See also infrun.c:maybe_software_singlestep. I think you want this: if (!step && gdbarch_software_single_step_p (gdbarch) && !single_step_breakpoints_inserted () && gdbarch_software_single_step (gdbarch, get_current_frame ())) record_resume_step =3D 0; else record_resume_step =3D 1; record_beneath_to_resume (record_beneath_to_resume_ops, ptid, record_resume_step, signal); If `step' is true when record_resume is called, and so is gdbarch_software_single_step_p, then it must be that infrun.c already determined that gdbarch_software_single_step returns false, otherwise, `step' would be false (maybe_software_singlestep). If `step' is false (the user is requesting a continue), and no single-step breakpoints are inserted yet, but, gdbarch_software_single_step returns false, we have ourselves an arch/target combo that only wants software single-stepping for atomic sequences, e.g., MIPS (non-linux), or PPC. If so, we should force hardware single-step in the target beneath (set record_resume_step to 1). --=20 Pedro Alves