From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113414 invoked by alias); 15 Sep 2017 13:54:53 -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 113059 invoked by uid 89); 15 Sep 2017 13:54:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 13:54:51 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v8FDsiju013585 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Sep 2017 09:54:49 -0400 Received: by simark.ca (Postfix, from userid 112) id A870C1ECF0; Fri, 15 Sep 2017 09:54:44 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id C4DAE1EA9D; Fri, 15 Sep 2017 09:54:43 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 15 Sep 2017 13:54:00 -0000 From: Simon Marchi To: Pedro Alves Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH 3/3] gdbserver: Remove thread_to_gdb_id In-Reply-To: <8e662d76-08d2-1351-840a-18b01eae136b@redhat.com> References: <1505074275-1662-1-git-send-email-simon.marchi@ericsson.com> <1505074275-1662-4-git-send-email-simon.marchi@ericsson.com> <8e662d76-08d2-1351-840a-18b01eae136b@redhat.com> Message-ID: <0d400a5e8fad02af15cfa1f3dfe6c4d4@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 15 Sep 2017 13:54:44 +0000 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00411.txt.bz2 On 2017-09-15 13:02, Pedro Alves wrote: > 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. In the files I can't build, I usually try to be as unintrusive as possible, but I'm fine with doing this, it's obvious (tm). >> @@ -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; >> } >> Ack everything. The changes are small enough that I don't think it warrants a v2. I'll push directly once the handle_detach refactor is in (and post the final versions here). Thanks! Simon