From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7518 invoked by alias); 27 Oct 2011 18:38:59 -0000 Received: (qmail 7338 invoked by uid 22791); 27 Oct 2011 18:38:57 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,TW_BP,TW_EG X-Spam-Check-By: sourceware.org Received: from elasmtp-galgo.atl.sa.earthlink.net (HELO elasmtp-galgo.atl.sa.earthlink.net) (209.86.89.61) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 18:38:40 +0000 Received: from [70.170.59.51] (helo=macbook2.local) by elasmtp-galgo.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1RJUqe-0004dG-2P for gdb-patches@sourceware.org; Thu, 27 Oct 2011 14:38:40 -0400 Message-ID: <4EA9A527.4030003@earthlink.net> Date: Thu, 27 Oct 2011 19:47:00 -0000 From: Stan Shebs User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [patch, gdbserver] Uninsert bpkt when regular and fast tracepoint are set at the same address References: <4EA8C851.2080703@codesourcery.com> In-Reply-To: <4EA8C851.2080703@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: ae6f8838ff913eba0cc1426638a40ef67e972de0d01da94051d6637ecee4bce6cc4ffa1829cdc441350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c 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: 2011-10/txt/msg00745.txt.bz2 On 10/26/11 7:56 PM, Yao Qi wrote: > Hi, > I find a program will receive segv fault when I set a regular tracepoint > and a fast tracepoint at the same address, start tracing and resume program. > > gdbserver has taken care of this situation in many places of the code, > when uninserting breakpoint or fast tracepoint, write_inferior_memory is > called to take care of layering breakpoints on top of fast tracepoints. > However, it is not right to me. Here is an example to illustrate this > problem. > > Supposing I set a regular tracepoint and a fast tracepoint on 0x080484fc, > > 0x080484fc<+3>: e8 f3 ff ff ff call 0x80484f4 > > During insertion, trap insn (for regular tracepoint) and jmp insn (for > fast tracepoint) are inserted, and gdbserver takes care of them to make > sure trap insn is *always* inserted on top of jmp insn. I'm looking at this and wondering, why are we inserting the fast tracepoint jump insn at all? Shouldn't be it sufficient to let the trap handler do the work of both slow and fast tracepoints at that location? Since hitting the trap has already put us on the slow path, there's not going to any noticeable additional penalty for not going to the IPA and interpreting conditional bytecodes instead of compiled ones, etc. We may not even need to sync trace buffers (I'm not sure about that, code is tricky). Stan stan@codesourcery.com