From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8738 invoked by alias); 31 Jan 2012 02:05:17 -0000 Received: (qmail 8702 invoked by uid 22791); 31 Jan 2012 02:05:08 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL,BAYES_00,SUBJ_OBFU_PUNCT_FEW,SUBJ_OBFU_PUNCT_MANY 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:56 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Rs35b-00074V-Gn from Hui_Zhu@mentor.com for gdb-patches@sourceware.org; Mon, 30 Jan 2012 18:04:55 -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:55 -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:54 -0800 Message-ID: <4F274C42.7010008@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[1/2] reset current_trace_status in the begin of remote_start_remote Content-Type: multipart/mixed; boundary="------------010005090506020106060808" 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/msg01008.txt.bz2 --------------010005090506020106060808 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2049 Hi, For the re-insert breakpoint, the stack dump is: #0 remote_download_tracepoint (loc=0x35040b0) at ../../src/gdb/remote.c:9982 #1 0x00000000006727c1 in download_tracepoint_locations () at ../../src/gdb/breakpoint.c:10670 #2 0x0000000000673111 in update_global_location_list (should_insert=1) at ../../src/gdb/breakpoint.c:11021 #3 0x0000000000663752 in create_overlay_event_breakpoint () at ../../src/gdb/breakpoint.c:2322 #4 0x0000000000675c9f in breakpoint_re_set () at ../../src/gdb/breakpoint.c:12621 #5 0x00000000007efe65 in solib_add (pattern=0x0, from_tty=1, target=0x1d1e860, readsyms=1) at ../../src/gdb/solib.c:928 #6 0x000000000057b452 in enable_break (info=0x3307890, from_tty=1) at ../../src/gdb/solib-svr4.c:1624 #7 0x000000000057c428 in svr4_solib_create_inferior_hook (from_tty=1) at ../../src/gdb/solib-svr4.c:2234 #8 0x00000000007f04a9 in solib_create_inferior_hook (from_tty=1) at ../../src/gdb/solib.c:1172 #9 0x00000000006cc8e5 in post_create_inferior (target=0x1d1e860, from_tty=1) at ../../src/gdb/infcmd.c:431 #10 0x00000000006d479d in start_remote (from_tty=1) at ../../src/gdb/infrun.c:2309 #11 0x00000000005d80c9 in remote_start_remote (from_tty=1, target=0x1cefce0, extended_p=0) at ../../src/gdb/remote.c:3367 About this patch, what I do is: 1. If we try to connect an new stub, reset current_trace_status to unknown. 2. Change remote_can_download_tracepoint to if the current_trace_status is unknown, return false. After this patch, the tracepoint insered after: /* Possibly the target has been engaged in a trace run started previously; find out where things are at. */ if (remote_get_trace_status (current_trace_status ()) != -1) { I think that will make us handle tracepoint issue more easy. 2012-01-31 Hui Zhu * remote.c (remote_start_remote): Set running_known of current_trace_status to 0 in the begin of this function. (remote_can_download_tracepoint): If running_known of current_trace_status is 0, return false. Thanks, Hui --------------010005090506020106060808 Content-Type: text/plain; name="reset-trace-status.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="reset-trace-status.txt" Content-length: 1301 --- remote.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/remote.c +++ b/remote.c @@ -3203,6 +3203,7 @@ remote_start_remote (int from_tty, struc struct remote_state *rs = get_remote_state (); struct packet_config *noack_config; char *wait_status = NULL; + struct trace_status *ts = current_trace_status (); immediate_quit++; /* Allow user to interrupt it. */ @@ -3212,6 +3213,9 @@ remote_start_remote (int from_tty, struc /* Ack any packet which the remote side has already sent. */ serial_write (remote_desc, "+", 1); + /* Clear current status of trace. */ + ts->running_known = 0; + /* The first packet we send to the target is the optional "supported packets" request. If the target can answer this, it will tell us which later probes to skip. */ @@ -10122,9 +10126,14 @@ static int remote_can_download_tracepoint (void) { struct trace_status *ts = current_trace_status (); - int status = remote_get_trace_status (ts); + int status; - if (status == -1 || !ts->running_known || !ts->running) + if (!ts->running_known) + return 0; + + status = remote_get_trace_status (ts); + + if (status == -1 || !ts->running) return 0; /* If we are in a tracing experiment, but remote stub doesn't support --------------010005090506020106060808--