From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27052 invoked by alias); 12 Dec 2012 15:30:18 -0000 Received: (qmail 26828 invoked by uid 22791); 12 Dec 2012 15:30:11 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Dec 2012 15:30:02 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TioG1-0002I9-BU from Yao_Qi@mentor.com ; Wed, 12 Dec 2012 07:30:01 -0800 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); Wed, 12 Dec 2012 07:30:01 -0800 Received: from qiyao.dyndns.org (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; Wed, 12 Dec 2012 07:30:00 -0800 Message-ID: <50C8A2FA.5000105@codesourcery.com> Date: Wed, 12 Dec 2012 15:30:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Aleksandar Ristovski CC: "gdb-patches@sourceware.org" Subject: Re: [patch] gdbarch_syscall_pc_increment References: <50C8937A.1090905@qnx.com> In-Reply-To: <50C8937A.1090905@qnx.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit 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: 2012-12/txt/msg00391.txt.bz2 On 12/12/2012 10:23 PM, Aleksandar Ristovski wrote: > This patch fixes stepping over system call instruction on architectures > that use software single stepping and also may increment PC upon return > from the system call to communicate error. (e.g. this is what we do on > Neutrino). > > Note: I could only test this on Neutrino. > Hi, I don't understand why do you add a gdbarch hook, but use it only in a target-specific part? The goal of gdbarch hooks is about hiding the difference of ports and giving a common interface to the common part of GDB. If your issue is arm specific, we don't need this new gdbarch hook at all. If I understand your problem correctly, you have to define your own function 'arm_neutrino_syscall_next_pc' in your file arm-neutrino-tdep.c, and install it on function pointer 'syscall_next_pc' (in 'struct gdbarch_tdep' in arm-tdep.h) in 'arm_neutrino_init_abi'. Please have a look on how 'syscall_next_pc' is set in arm-linux-tdep.c. Then you can compute the pc for your own os in 'arm_neutrino_syscall_next_pc'. Hope it helps. > > ChangeLog: > > * gdbarch.sh (syscall_pc_increment): New function. > * gdbarch.h, gdbarch.c: Regenerated. > * arm-tdep.c (arm_software_single_step): Use > gdbarch_syscall_pc_increment and if provided, insert second > single step breakpoint at the incremented address. I guess the reason you need the 2nd single step breakpoint is that GDB computes the 'next pc' by mistake, so you need the 2nd single step breakpoint setting on the 'right' address of 'next pc'. In other words, do we really need the 2nd single step breakpoint if the address of 'next pc' is computed correctly? -- Yao (齐尧)