From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55575 invoked by alias); 15 Sep 2017 17:29:28 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 54389 invoked by uid 89); 15 Sep 2017 17:29:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=talk, research X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (158.69.185.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 17:29:26 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] gdbserver: Remove gdb_id_to_thread_id From: sergiodj+buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <96cde54f0adf2315404f3eba35dc3dfbc57f98c8@gdb-build> Date: Fri, 15 Sep 2017 17:56:00 -0000 X-SW-Source: 2017-q3/txt/msg04145.txt.bz2 *** TEST RESULTS FOR COMMIT 96cde54f0adf2315404f3eba35dc3dfbc57f98c8 *** Author: Simon Marchi Branch: master Commit: 96cde54f0adf2315404f3eba35dc3dfbc57f98c8 gdbserver: Remove gdb_id_to_thread_id >>From what I understand, this function is not doing anything useful as of today. Here's the result of my archeological research: - The field thread_info::gdb_id was added in a06660f7 Use LWP IDs for thread IDs in gdbserver There was problem when using a 32-bits gdb with a 64-bits gdbserver. For some reason that I don't fully understand, the thread ids exchanged between gdb and gdbserver could overflow a 32 bits data type. My guess is that they were the thread address (e.g. the 0x7ffff7f20b40 in "Thread 0x7ffff7f20b40 (LWP 1058)" today). This patch changed that so gdb/gdbserver would talk in terms of the OS assigned numerical id (as shown in ps). It therefore added a way to convert between this gdb_id (the numerical id) and the thread id (the address). - 95954743cb Implement the multiprocess extensions, and add linux multiprocess supportNon-stop mode support. This patch made gdbserver deal with threads using their numerical ids and not the address-like id. Starting from there, the gdb_id <-> thread id conversion was not needed anymore, since the remote protocol and gdbserver were using the same kind of ids again. The gdb_id field in the thread_info structure was also unused starting there. - d50171e4 Teach linux gdbserver to step-over-breakpoints. This patch moved the thread_info structure around, and got rid of the gdb_id field (which was unused). Looking at the implementation of gdb_id_to_thread_id, it is not doing anything useful. It is looking up a thread by ptid using find_thread_ptid, which basically loops over all threads looking at their entry.id field. If a thread with that ptid is found, it returns its entry.id field. So it will always return the same thing as it input (with the exception of if no thread exist with that ptid, then it will return null_ptid). gdb/gdbserver/ChangeLog: * inferiors.h (gdb_id_to_thread_id): Remove. * inferiors.c (gdb_id_to_thread_id): Remove. * server.c (process_serial_event): Adjust to gdb_id_to_thread_id removal. Move pid declaration closer to where it's used.