From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6346 invoked by alias); 31 Jan 2012 02:04:51 -0000 Received: (qmail 6229 invoked by uid 22791); 31 Jan 2012 02:04:49 -0000 X-SWARE-Spam-Status: No, hits=1.2 required=5.0 tests=AWL,BAYES_00 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; Tue, 31 Jan 2012 02:04:36 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Rs35I-00073S-0u from Hui_Zhu@mentor.com for gdb-patches@sourceware.org; Mon, 30 Jan 2012 18:04:36 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 30 Jan 2012 18:04:35 -0800 Received: from [127.0.0.1] (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; Mon, 30 Jan 2012 18:04:34 -0800 Message-ID: <4F274C2C.7090107@mentor.com> Date: Tue, 31 Jan 2012 02:05:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0 MIME-Version: 1.0 To: Subject: [PATCH] Fix error when gdb connect to a stub that tracepoint is running[0/2] Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit 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-01/txt/msg01007.txt.bz2 Hi, I found some error when I try to let GDB connect to a stub that have a tracepoint and it support insert tracepoint when trace is running, for example: (gdb) info tracepoints Num Type Disp Enb Address What 1 tracepoint keep y 0x0000000000400557 in main at 1.c:15 collect $reg (gdb) set disconnected-tracing on (gdb) tstart (gdb) disconnect Trace is running and will continue after detach; detach anyway? (y or n) y Ending remote debugging. (gdb) target remote localhost:1234 Remote debugging using localhost:1234 Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Error in re-setting breakpoint 1: Target returns error code '01'. Target returns error code '01'. (gdb) disconnect You can't do that when your target is `exec' (gdb) quit gdb ./a.out (gdb) target remote localhost:1234 Remote debugging using localhost:1234 Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 0x00007ffff7ddcaf0 in ?? () from /lib64/ld-linux-x86-64.so.2 Trace is already running on the target. Tracepoint 1 at 0x400557: file 1.c, line 15. Target returns error code '01'. This is because GDB try to insert this tracepoint to gdb stub part because this stub support inserted tracepoint when it running. but this behaveior have 2 trouble: 1. stub already have a treacepoint same with gdb part, if GDB try to re-inserted it, we will got a error. 2. Even if gdb part doesn't have this tracepoint, when it got this tracepoint from gdbstub part, it will try to insert this tracepoint to gdbstub when create_breakpoint. So I fix this issue with 2 patches. Thanks, Hui