From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86947 invoked by alias); 26 Feb 2016 15:02:02 -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 86707 invoked by uid 89); 26 Feb 2016 15:02:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Fri, 26 Feb 2016 15:01:59 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1aZJu0-0007O6-Ag from Luis_Gustavo@mentor.com ; Fri, 26 Feb 2016 07:01:56 -0800 Received: from [172.30.3.146] (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.224.2; Fri, 26 Feb 2016 07:01:55 -0800 Subject: Re: [PATCH 4/7] Step over fork/vfork syscall insn in gdbserver References: <1455892594-2294-1-git-send-email-yao.qi@linaro.org> <1456495426-7520-1-git-send-email-yao.qi@linaro.org> <1456495426-7520-5-git-send-email-yao.qi@linaro.org> To: Yao Qi , Reply-To: Luis Machado From: Luis Machado Message-ID: <56D068E2.3070209@codesourcery.com> Date: Fri, 26 Feb 2016 15:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1456495426-7520-5-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00865.txt.bz2 On 02/26/2016 11:03 AM, Yao Qi wrote: > We can also extend disp-step-syscall.exp to test GDBserver step over > breakpoint on syscall instruction. That is, we set a breakpoint > with a false condition on syscall instruction, so that GDBserver will > step over it. > > This test triggers a GDBserver internal error, which can be fixed by > this series. > > (gdb) PASS: gdb.base/disp-step-syscall.exp: fork: break cond on target: break on syscall insns > continue^M > Continuing.^M > Remote connection closed^M > (gdb) FAIL: gdb.base/disp-step-syscall.exp: fork: break cond on target: continue to fork again > > In GDBserver, there is an internal error, > > /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:1922: A problem internal to GDBserver has been detected. > unsuspend LWP 25554, suspended=-1 > > the simplified reproducer is like, > > $ ./gdb ./testsuite/outputs/gdb.base/disp-step-syscall/disp-step-fork > (gdb) b main > (gdb) c > (gdb) disassemble fork // in order to find the address of insn 'syscall' > .... > 0x00007ffff7ad6023 <+179>: syscall > (gdb) b *0x00007ffff7ad6023 if main == 0 > (gdb) c > > gdb/testsuite: > > 2016-02-26 Yao Qi > > * gdb.base/disp-step-syscall.exp (break_cond_on_syscall): New. > If target supports condition evaluation on target, invoke > break_cond_on_syscall for fork and vfork. > --- > gdb/testsuite/gdb.base/disp-step-syscall.exp | 57 ++++++++++++++++++++++++++++ > 1 file changed, 57 insertions(+) > > diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp > index 3cf436d..9ecf2a5 100644 > --- a/gdb/testsuite/gdb.base/disp-step-syscall.exp > +++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp > @@ -168,5 +168,62 @@ proc disp_step_cross_syscall { syscall } { > } > } > > +# Set a breakpoint with a condition that evals false on syscall > +# instruction. In fact, it tests GDBserver steps over syscall > +# instruction. > + > +proc break_cond_on_syscall { syscall } { > + with_test_prefix "break cond on target : $syscall" { > + set testfile "disp-step-$syscall" > + > + set ret [setup $syscall] > + > + set syscall_insn_addr [lindex $ret 0] > + set syscall_insn_next_addr [lindex $ret 1] > + if { $syscall_insn_addr == -1 } { > + return -1 > + } > + > + gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \ > + "continue to $syscall" > + # Delete breakpoint syscall insns to avoid interference to other syscalls. > + delete_breakpoints "... interference with ..."