From patchwork Sun Sep 10 20:11:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 22803 Received: (qmail 96642 invoked by alias); 10 Sep 2017 20:11:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 96490 invoked by uid 89); 10 Sep 2017 20:11:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=forcing, resumes X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 10 Sep 2017 20:11:37 +0000 Received: from ESESSHC002.ericsson.se (Unknown_Domain [153.88.183.24]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id 7C.C4.21299.57C95B95; Sun, 10 Sep 2017 22:11:33 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.24) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sun, 10 Sep 2017 22:11:33 +0200 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxacz23q12.localdomain (80.216.43.226) by DB4PR07MB316.eurprd07.prod.outlook.com (2a01:111:e400:982f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.4; Sun, 10 Sep 2017 20:11:31 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 2/3] gdbserver: Remove gdb_id_to_thread_id Date: Sun, 10 Sep 2017 22:11:14 +0200 Message-ID: <1505074275-1662-3-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1505074275-1662-1-git-send-email-simon.marchi@ericsson.com> References: <1505074275-1662-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-ClientProxiedBy: AM4PR0101CA0084.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::52) To DB4PR07MB316.eurprd07.prod.outlook.com (2a01:111:e400:982f::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e774101-c1f4-4fab-0c83-08d4f8882110 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB4PR07MB316; X-Microsoft-Exchange-Diagnostics: 1; DB4PR07MB316; 3:ZMVvNiDr6GrekZcatZr5stVEPKml8t6dl4nnpHAmXk4K/5I/tC99eHcsPf4iyuuJxcNIg8befCFJNyAWJZHJyHbD+T3vBFb0hT7LRM7pw2ZMsWVeR1b7UEGR3toy4F6V8Kxo+2nei8nNX6TCcgxxN8kLe1W6Xm/bKvKmFNvn0PhFOgQTW/U8RPG1nbk40OPgdRQ/FU646dLMgYjIhwA+XhMjgxStWyZc3fqMKRqhSQwTWp0Yk3UpxxU8tXEK0za9; 25:7mS9mtP5xYRAuIX/IErQXLBPDzsencyZX+8miMGuT/m/67S2g0IN1osa0HgR+cHyiJep0EIQN4RULbhrFA/bysCXOnVuQIkZKmgtYwYAYOsmxVz3zmeTu806NVaIMmEWIPvXmhvyEK7LqUwre07KyL6gYOTpIZeOylkkmAZmGGqh9mrUfq+rG4KH0Ve/GHDJ4kd9RAmQ1kggupsUzA4F64glY51x7Ed8+ffmwhlmv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Js2YSpCQi/GZXclJl/JKZN84n/QG+bpFEsmmY7k6bG8wND+R0AgtYyJA8+CsUlnXpiXUEMCDZa/qoLIJEN7VlQQ+ueQHePcRwxlZOyOE4FG6hB2L1gqgiAS X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB4PR07MB316; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB4PR07MB316; X-Forefront-PRVS: 04267075BD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(199003)(54534003)(189002)(7350300001)(25786009)(107886003)(6116002)(81156014)(81166006)(7736002)(8676002)(76176999)(50986999)(66066001)(47776003)(42186005)(50226002)(33646002)(3846002)(110136004)(97736004)(478600001)(5890100001)(5660300001)(106356001)(86362001)(5003940100001)(105586002)(6486002)(6506006)(2950100002)(6666003)(6916009)(68736007)(6512007)(189998001)(101416001)(305945005)(2906002)(36756003)(53936002)(2361001)(50466002)(4326008)(2351001)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR07MB316; H:elxacz23q12.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR07MB316; 23:Uy4ok6fU5HdiHb9yKJqqZK1GC0FCLhP/6g0iDN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EKhdLjN/nJUtwCJvs/G+FAYJoKnH/0Ric4pb0+GGUhjGMcgLb+vkhuyz2YSEejXjtZTkwxePtCR9TG3H0CUpmDQ5IcEkRNLpokVCr0bXZ00K3CsSOxHS/P+orZxzkkMzUTdCQPISNC4UZ4jSiLIhsNTW402ZLSodmybOAHfF2BR5t0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2017 20:11:31.7679 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR07MB316 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes 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. --- gdb/gdbserver/inferiors.c | 8 -- gdb/gdbserver/inferiors.h | 1 - gdb/gdbserver/server.c | 183 +++++++++++++++++++++++----------------------- 3 files changed, 90 insertions(+), 102 deletions(-) diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index 2212850..933dd76 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -173,14 +173,6 @@ find_any_thread_of_pid (int pid) return (struct thread_info *) entry; } -ptid_t -gdb_id_to_thread_id (ptid_t gdb_id) -{ - struct thread_info *thread = find_thread_ptid (gdb_id); - - return thread ? thread->entry.id : null_ptid; -} - static void free_one_thread (struct inferior_list_entry *inf) { diff --git a/gdb/gdbserver/inferiors.h b/gdb/gdbserver/inferiors.h index f229e67..6316fe5 100644 --- a/gdb/gdbserver/inferiors.h +++ b/gdb/gdbserver/inferiors.h @@ -144,7 +144,6 @@ int have_started_inferiors_p (void); int have_attached_inferiors_p (void); ptid_t thread_to_gdb_id (struct thread_info *); -ptid_t gdb_id_to_thread_id (ptid_t); void clear_inferiors (void); struct inferior_list_entry *find_inferior diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index bedb87b..3ea24ff 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -4011,7 +4011,6 @@ process_serial_event (void) unsigned int len; int res; CORE_ADDR mem_addr; - int pid; unsigned char sig; int packet_len; int new_packet_len = -1; @@ -4039,92 +4038,96 @@ process_serial_event (void) handle_general_set (own_buf); break; case 'D': - require_running (own_buf); + { + require_running (own_buf); - if (multi_process) - { - i++; /* skip ';' */ - pid = strtol (&own_buf[i], NULL, 16); - } - else - pid = ptid_get_pid (current_ptid); + int pid; - if ((tracing && disconnected_tracing) || any_persistent_commands ()) - { - struct process_info *process = find_process_pid (pid); + if (multi_process) + { + i++; /* skip ';' */ + pid = strtol (&own_buf[i], NULL, 16); + } + else + pid = ptid_get_pid (current_ptid); - if (process == NULL) - { - write_enn (own_buf); - break; - } + if ((tracing && disconnected_tracing) || any_persistent_commands ()) + { + struct process_info *process = find_process_pid (pid); - if (tracing && disconnected_tracing) - fprintf (stderr, - "Disconnected tracing in effect, " - "leaving gdbserver attached to the process\n"); - - if (any_persistent_commands ()) - fprintf (stderr, - "Persistent commands are present, " - "leaving gdbserver attached to the process\n"); - - /* Make sure we're in non-stop/async mode, so we we can both - wait for an async socket accept, and handle async target - events simultaneously. There's also no point either in - having the target stop all threads, when we're going to - pass signals down without informing GDB. */ - if (!non_stop) - { - if (debug_threads) - debug_printf ("Forcing non-stop mode\n"); + if (process == NULL) + { + write_enn (own_buf); + break; + } - non_stop = 1; - start_non_stop (1); - } + if (tracing && disconnected_tracing) + fprintf (stderr, + "Disconnected tracing in effect, " + "leaving gdbserver attached to the process\n"); + + if (any_persistent_commands ()) + fprintf (stderr, + "Persistent commands are present, " + "leaving gdbserver attached to the process\n"); + + /* Make sure we're in non-stop/async mode, so we we can both + wait for an async socket accept, and handle async target + events simultaneously. There's also no point either in + having the target stop all threads, when we're going to + pass signals down without informing GDB. */ + if (!non_stop) + { + if (debug_threads) + debug_printf ("Forcing non-stop mode\n"); - process->gdb_detached = 1; + non_stop = 1; + start_non_stop (1); + } - /* Detaching implicitly resumes all threads. */ - target_continue_no_signal (minus_one_ptid); + process->gdb_detached = 1; - write_ok (own_buf); - break; /* from switch/case */ - } + /* Detaching implicitly resumes all threads. */ + target_continue_no_signal (minus_one_ptid); - fprintf (stderr, "Detaching from process %d\n", pid); - stop_tracing (); - if (detach_inferior (pid) != 0) - write_enn (own_buf); - else - { - discard_queued_stop_replies (pid_to_ptid (pid)); - write_ok (own_buf); - - if (extended_protocol || target_running ()) - { - /* There is still at least one inferior remaining or - we are in extended mode, so don't terminate gdbserver, - and instead treat this like a normal program exit. */ - last_status.kind = TARGET_WAITKIND_EXITED; - last_status.value.integer = 0; - last_ptid = pid_to_ptid (pid); + write_ok (own_buf); + break; /* from switch/case */ + } - current_thread = NULL; - } - else - { - putpkt (own_buf); - remote_close (); + fprintf (stderr, "Detaching from process %d\n", pid); + stop_tracing (); + if (detach_inferior (pid) != 0) + write_enn (own_buf); + else + { + discard_queued_stop_replies (pid_to_ptid (pid)); + write_ok (own_buf); - /* If we are attached, then we can exit. Otherwise, we - need to hang around doing nothing, until the child is - gone. */ - join_inferior (pid); - exit (0); - } - } - break; + if (extended_protocol || target_running ()) + { + /* There is still at least one inferior remaining or + we are in extended mode, so don't terminate gdbserver, + and instead treat this like a normal program exit. */ + last_status.kind = TARGET_WAITKIND_EXITED; + last_status.value.integer = 0; + last_ptid = pid_to_ptid (pid); + + current_thread = NULL; + } + else + { + putpkt (own_buf); + remote_close (); + + /* If we are attached, then we can exit. Otherwise, we + need to hang around doing nothing, until the child is + gone. */ + join_inferior (pid); + exit (0); + } + } + break; + } case '!': extended_protocol = 1; write_ok (own_buf); @@ -4135,23 +4138,18 @@ process_serial_event (void) case 'H': if (own_buf[1] == 'c' || own_buf[1] == 'g' || own_buf[1] == 's') { - ptid_t gdb_id, thread_id; - int pid; + ptid_t thread_id; require_running (own_buf); - gdb_id = read_ptid (&own_buf[2], NULL); - - pid = ptid_get_pid (gdb_id); + thread_id = read_ptid (&own_buf[2], NULL); - if (ptid_equal (gdb_id, null_ptid) - || ptid_equal (gdb_id, minus_one_ptid)) + if (thread_id == null_ptid || thread_id == minus_one_ptid) thread_id = null_ptid; - else if (pid != 0 - && ptid_equal (pid_to_ptid (pid), - gdb_id)) + else if (thread_id.is_pid ()) { - thread_info *thread = find_any_thread_of_pid (pid); + /* The ptid represents a pid. */ + thread_info *thread = find_any_thread_of_pid (thread_id.pid ()); if (thread == NULL) { @@ -4163,8 +4161,8 @@ process_serial_event (void) } else { - thread_id = gdb_id_to_thread_id (gdb_id); - if (ptid_equal (thread_id, null_ptid)) + /* The ptid represents a lwp/tid. */ + if (find_thread_ptid (thread_id) == NULL) { write_enn (own_buf); break; @@ -4369,13 +4367,12 @@ process_serial_event (void) case 'T': { - ptid_t gdb_id, thread_id; + ptid_t thread_id; require_running (own_buf); - gdb_id = read_ptid (&own_buf[1], NULL); - thread_id = gdb_id_to_thread_id (gdb_id); - if (ptid_equal (thread_id, null_ptid)) + thread_id = read_ptid (&own_buf[1], NULL); + if (find_thread_ptid (thread_id) == NULL) { write_enn (own_buf); break;