From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115778 invoked by alias); 7 Dec 2015 14:32:32 -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 115769 invoked by uid 89); 7 Dec 2015 14:32:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pf0-f176.google.com Received: from mail-pf0-f176.google.com (HELO mail-pf0-f176.google.com) (209.85.192.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 07 Dec 2015 14:32:30 +0000 Received: by pfnn128 with SMTP id n128so65791199pfn.0 for ; Mon, 07 Dec 2015 06:32:28 -0800 (PST) X-Received: by 10.98.2.210 with SMTP id 201mr43361825pfc.129.1449498748553; Mon, 07 Dec 2015 06:32:28 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id p26sm35101067pfi.94.2015.12.07.06.32.25 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 07 Dec 2015 06:32:28 -0800 (PST) From: Yao Qi To: Antoine Tremblay Cc: Subject: Re: [PATCH v6 3/7] Refactor arm_software_single_step to use regcache. References: <1449254773-19019-1-git-send-email-antoine.tremblay@ericsson.com> <1449254773-19019-4-git-send-email-antoine.tremblay@ericsson.com> Date: Mon, 07 Dec 2015 14:32:00 -0000 In-Reply-To: <1449254773-19019-4-git-send-email-antoine.tremblay@ericsson.com> (Antoine Tremblay's message of "Fri, 4 Dec 2015 13:46:09 -0500") Message-ID: <86fuzes51n.fsf@gmail.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: 2015-12/txt/msg00130.txt.bz2 Antoine Tremblay writes: > +/* Calculate the offset from stack pointer of the pc register on the sta= ck > + in the case of a sigreturn or sigreturn_rt syscall. */ > +static int > +arm_linux_sigreturn_next_pc_offset (unsigned long sp, > + unsigned long sp_data, > + unsigned long svc_number) > +{ > + /* Offset of R0 register. */ > + int r0_offset =3D 0; > + /* Offset of PC register. */ > + int pc_offset =3D 0; > + > + gdb_assert (svc_number =3D=3D 119 || svc_number =3D=3D 173); > + > + /* sigreturn. */ > + if (svc_number =3D=3D 119) Can we get rid of these magic numbers? > + { > + if (sp_data =3D=3D ARM_NEW_SIGFRAME_MAGIC) > + r0_offset =3D ARM_UCONTEXT_SIGCONTEXT + ARM_SIGCONTEXT_R0; > + else > + r0_offset =3D ARM_SIGCONTEXT_R0; > + } > + /* rt_sigreturn. */ > + else if (svc_number =3D=3D 173) > + { > + if (sp_data =3D=3D sp + ARM_OLD_RT_SIGFRAME_SIGINFO) > + r0_offset =3D ARM_OLD_RT_SIGFRAME_UCONTEXT + ARM_UCONTEXT_SIGCONTEXT > + + ARM_SIGCONTEXT_R0; > + else > + r0_offset =3D ARM_NEW_RT_SIGFRAME_UCONTEXT + ARM_UCONTEXT_SIGCONTEXT > + + ARM_SIGCONTEXT_R0; > + } > + > + pc_offset =3D r0_offset + 4 * 15; > + > + return pc_offset; > +} > + > + > /* At a ptrace syscall-stop, return the syscall number. This either > comes from the SWI instruction (OABI) or from r7 (EABI). >=20=20 > @@ -862,21 +924,21 @@ arm_linux_get_syscall_number (struct gdbarch *gdbar= ch, > instruction to be executed. */ >=20=20 > static CORE_ADDR > -arm_linux_syscall_next_pc (struct frame_info *frame) > +arm_linux_syscall_next_pc (struct regcache *regcache) > { > - CORE_ADDR pc =3D get_frame_pc (frame); > - CORE_ADDR return_addr =3D 0; > - int is_thumb =3D arm_frame_is_thumb (frame); > + CORE_ADDR pc =3D regcache_read_pc (regcache); > + CORE_ADDR next_pc =3D 0; > + int is_thumb =3D arm_is_thumb (regcache); Nit: looks you rename return_addr to next_pc. If you don't that, the patch can be shorter. On the other hand, return_addr sounds a good variable name to me, which means the address after syscall returns. --=20 Yao (=E9=BD=90=E5=B0=A7)