From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13998 invoked by alias); 16 Mar 2012 20:11:15 -0000 Received: (qmail 13982 invoked by uid 22791); 16 Mar 2012 20:11:13 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,MISSING_HEADERS,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Mar 2012 20:10:57 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2GKAvpb022127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Mar 2012 16:10:57 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2GKAt4x021218; Fri, 16 Mar 2012 16:10:56 -0400 Message-ID: <4F639E4F.1060803@redhat.com> Date: Fri, 16 Mar 2012 20:11:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 CC: gdb-patches@sourceware.org, Jan Kratochvil Subject: Re: [patch 2/2] Fix watchpoints for multi-inferior #2 References: <20120102164652.GB10231@host2.jankratochvil.net> <4F02020F.5090906@gmail.com> <20120120213110.GB424@host2.jankratochvil.net> <4F1EAFE6.30202@redhat.com> <20120125152240.GA26914@host2.jankratochvil.net> <4F203B6A.7090605@redhat.com> <4F204408.4090607@redhat.com> <4F205F3C.7090406@redhat.com> In-Reply-To: <4F205F3C.7090406@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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-03/txt/msg00634.txt.bz2 Here's what I'm applying. I've added comments inspired on your follow-up patch. This makes watchpoint-multi.exp pass cleanly with the extended-remote board, on x86_64 Fedora 16. gdb/gdbserver/ 2012-03-16 Pedro Alves Jan Kratochvil * server.c (cont_thread, general_thread): Add describing comments. (start_inferior): Clear `cont_thread'. (handle_v_cont): Don't set `cont_thread' if resuming all threads of a process. --- gdb/gdbserver/server.c | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 3c97dbd..a4e9e57 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -30,7 +30,19 @@ #include #endif +/* The thread set with an `Hc' packet. `Hc' is deprecated in favor of + `vCont'. Note the multi-process extensions made `vCont' a + requirement, so `Hc pPID.TID' is pretty much undefined. So + CONT_THREAD can be null_ptid for no `Hc' thread, minus_one_ptid for + resuming all threads of the process (again, `Hc' isn't used for + multi-process), or a specific thread ptid_t. + + We also set this when handling a single-thread `vCont' resume, as + some places in the backends check it to know when (and for which + thread) single-thread scheduler-locking is in effect. */ ptid_t cont_thread; + +/* The thread set with an `Hg' packet. */ ptid_t general_thread; int server_waiting; @@ -262,6 +274,10 @@ start_inferior (char **argv) signal (SIGTTIN, SIG_DFL); #endif + /* Clear this so the backend doesn't get confused, thinking + CONT_THREAD died, and it needs to resume all threads. */ + cont_thread = null_ptid; + signal_pid = create_inferior (new_argv[0], new_argv); /* FIXME: we don't actually know at this point that the create @@ -1962,9 +1978,13 @@ handle_v_cont (char *own_buf) if (i < n) resume_info[i] = default_action; - /* Still used in occasional places in the backend. */ + /* `cont_thread' is still used in occasional places in the backend, + to implement single-thread scheduler-locking. Doesn't make sense + to set it if we see a stop request, or any form of wildcard + vCont. */ if (n == 1 - && !ptid_equal (resume_info[0].thread, minus_one_ptid) + && !(ptid_equal (resume_info[0].thread, minus_one_ptid) + || ptid_get_lwp (resume_info[0].thread) == -1) && resume_info[0].kind != resume_stop) cont_thread = resume_info[0].thread; else