From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2461 invoked by alias); 15 Sep 2017 11:02:46 -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 123820 invoked by uid 89); 15 Sep 2017 11:02:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 11:02:42 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 074527E430; Fri, 15 Sep 2017 11:02:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 074527E430 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 638A56293D; Fri, 15 Sep 2017 11:02:40 +0000 (UTC) Subject: Re: [PATCH 3/3] gdbserver: Remove thread_to_gdb_id To: Simon Marchi , gdb-patches@sourceware.org References: <1505074275-1662-1-git-send-email-simon.marchi@ericsson.com> <1505074275-1662-4-git-send-email-simon.marchi@ericsson.com> From: Pedro Alves Message-ID: <8e662d76-08d2-1351-840a-18b01eae136b@redhat.com> Date: Fri, 15 Sep 2017 11:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1505074275-1662-4-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00399.txt.bz2 On 09/10/2017 09:11 PM, Simon Marchi wrote: > As explained in the previous patch, the gdb_id concept is no longer > relevant. The function thread_to_gdb_id is trivial, it returns the > thread's ptid. Remove it and replace its usage with ptid_of. > > The changes in nto-low.c and lynx-low.c are fairly straightforward, but > I was not able to build test them. Seems fine to me. Nits below. > @@ -869,7 +869,7 @@ nto_stopped_by_watchpoint (void) > { > ptid_t ptid; > > - ptid = thread_to_gdb_id (current_thread); > + ptid = ptid_of (current_thread); > if (nto_set_thread (ptid)) > { > const int watchmask = _DEBUG_FLAG_TRACE_RD | _DEBUG_FLAG_TRACE_WR > @@ -901,7 +901,7 @@ nto_stopped_data_address (void) > { > ptid_t ptid; > > - ptid = thread_to_gdb_id (current_thread); > + ptid = ptid_of (current_thread); > Above two hunks could merge decl + init. > @@ -2070,21 +2070,21 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) > /* Reply the current thread id. */ > if (strcmp ("qC", own_buf) == 0 && !disable_packet_qC) > { > - ptid_t gdb_id; > + ptid_t ptid; > require_running (own_buf); > > if (!ptid_equal (general_thread, null_ptid) > && !ptid_equal (general_thread, minus_one_ptid)) In the other patch you converted equivalent checks to use op!= , I don't mind doing it here as well while at it: if (general_thread != null_ptid && general_thread != minus_one_ptid) > - gdb_id = general_thread; > + ptid = general_thread; > else > { > thread_ptr = get_first_inferior (&all_threads); > - gdb_id = thread_to_gdb_id ((struct thread_info *)thread_ptr); > + ptid = thread_ptr->id; > } > > sprintf (own_buf, "QC"); > own_buf += 2; > - write_ptid (own_buf, gdb_id); > + write_ptid (own_buf, ptid); > return; > } > > @@ -2140,28 +2140,24 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) > { > if (strcmp ("qfThreadInfo", own_buf) == 0) > { > - ptid_t gdb_id; > - > require_running (own_buf); > thread_ptr = get_first_inferior (&all_threads); > > *own_buf++ = 'm'; > - gdb_id = thread_to_gdb_id ((struct thread_info *)thread_ptr); > - write_ptid (own_buf, gdb_id); > + ptid_t ptid = thread_ptr->id; > + write_ptid (own_buf, ptid); Could even get rid of the ptid_t variable? write_ptid (own_buf, thread_ptr->id); > thread_ptr = thread_ptr->next; > return; > } > > if (strcmp ("qsThreadInfo", own_buf) == 0) > { > - ptid_t gdb_id; > - > require_running (own_buf); > if (thread_ptr != NULL) > { > *own_buf++ = 'm'; > - gdb_id = thread_to_gdb_id ((struct thread_info *)thread_ptr); > - write_ptid (own_buf, gdb_id); > + ptid_t ptid = thread_ptr->id; > + write_ptid (own_buf, ptid); Ditto. > thread_ptr = thread_ptr->next; > return; > } > Thanks, Pedro Alves