From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71283 invoked by alias); 28 Dec 2016 08:07:14 -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 71268 invoked by uid 89); 28 Dec 2016 08:07:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS,UNPARSEABLE_RELAY autolearn=no version=3.3.2 spammy=hung, hangs, Johns, johns X-HELO: mail-wm0-f65.google.com Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Dec 2016 08:07:12 +0000 Received: by mail-wm0-f65.google.com with SMTP id l2so35315892wml.2 for ; Wed, 28 Dec 2016 00:07:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-disposition:in-reply-to :user-agent; bh=Lc8yXXo42A9mnzm5fMf/d4hYre4oesgcZ6To5w/cDpM=; b=rxkOjFT2ecZ/RuRcVU5A2JpWwVLUBdvPVqucdv6EAhUEykPwusSiCZ96HNuZBSwrS5 tAXJUbHmo92FewCYbDMwSu9yjNc+TlDdCdfJJomq5JaAs7ySvERf8xhtCHgqk/1xlFOZ fofAPo1JY/N0oRD0f2kxN4DUdDHnAdHO0XDxrRxM6ZUgm7IyIF6AmUVt+PWzvTkniyBL zItpVWe/H/sYbpWprYhiffj/Xuw4xFN7fzy0ImqlZZOT2xfmo7xJru+4hf7Oxu66ju2t A1kxpAxFJr/rSbdchdG5Mf6Yq4x/W0x0YSenZimvkzOli0vKgYXKFhJuM3JGRUzaadQ7 v8aQ== X-Gm-Message-State: AIkVDXKT17W9aYzwHB4SQL/4P3OtMFDdLgG0/R9nWz8gqSnZ1TjYocR1MHhUdFRf+8oBmQ== X-Received: by 10.28.163.5 with SMTP id m5mr33047293wme.98.1482912429802; Wed, 28 Dec 2016 00:07:09 -0800 (PST) Received: from localhost (BSN-143-156-237.dynamic.siol.net. [89.143.156.237]) by smtp.gmail.com with ESMTPSA id f10sm62869263wjl.28.2016.12.28.00.07.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Dec 2016 00:07:08 -0800 (PST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id d736e58d; Wed, 28 Dec 2016 09:07:07 +0100 (CET) Date: Wed, 28 Dec 2016 08:07:00 -0000 From: Vasil Dimov To: John Baldwin Cc: Luis Machado , gdb-patches@sourceware.org Subject: Re: [PATCH] PR threads/20743: Don't attempt to suspend or resume exited threads. Message-ID: <20161228080707.GA4007@nitro> Reply-To: vd@FreeBSD.org References: <20161223212842.42715-1-jhb@FreeBSD.org> <74b6668b-e98e-6034-99bd-fee9834fe9d4@codesourcery.com> <20161227164329.GA43600@nitro> <2893581.89CAWbS1EM@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <2893581.89CAWbS1EM@ralph.baldwin.cx> User-Agent: Mutt X-SW-Source: 2016-12/txt/msg00432.txt.bz2 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 3952 On Tue, Dec 27, 2016 at 13:03:27 -0800, John Baldwin wrote: [...] > I have tried changing fbsd_wait() to return a TARGET_WAITKIND_SPURIOUS > instead of explicitly continuing the process, but that doesn't help, and = it > means that the ptid being returned is still T1 in that case. >=20 > I'm not sure if I should explicitly be calling delete_exited_threads() in > fbsd_resume() before calling iterate_threads()? Alternatively, fbsd_resu= me() > could use ALL_NONEXITED_THREADS() instead of iterate_threads() (it isn't > clear to me which of these is preferred since both are in use). >=20 > I added the assertion for my own sanity. I suspect gdb should never try = to > invoke target_resume() with a ptid of an exited thread, but if for some > reason it did the effect on FreeBSD would be a hang since we would suspend > all the other threads and when the process was continued via PT_CONTINUE = it > would have nothing to do and would never return from wait(). I'd rather = have > gdb fail an assertion in that case rather than hang. [...] Hi, I am not sure if this is related, but since I get a hang I would rather mention it: with the John's patch (including the assert) gdb does not emit the "ptrace: No such process" error, but when I attempt to quit, it hangs: --- cut --- ^C Thread 1 received signal SIGINT, Interrupt. [Switching to LWP 100746 of process 3453] 0x0000000804e59c7a in _poll () from /lib/libc.so.7 (gdb) q A debugging session is active. Inferior 1 [process 3453] will be killed. Quit anyway? (y or n) y (hangs here) --- cut --- It has hung here: --- cut --- (top-gdb) bt #0 0x0000000803526df8 in _wait4 () from /lib/libc.so.7 During symbol reading, cannot get low and high bounds for subprogram DIE = at 76931. During symbol reading, incomplete CFI data; unspecified registers (e.g., = rax) at 0x803a53a8e. #1 0x0000000803a53abc in __thr_wait4 (pid=3D3453, pid@entry=3D,=20 status=3D0x7fffffffe304, status@entry=3D, options=3D0,= =20 options@entry=3D, rusage=3D0x0, rusage@entry=3D) at /usr/src/lib/libthr/thread/thr_syscalls.c:563 #2 0x0000000000540d85 in inf_ptrace_mourn_inferior(target_ops*) () #3 0x000000000067c28f in target_mourn_inferior() () #4 0x0000000000540c6d in inf_ptrace_kill(target_ops*) () #5 0x000000000072769a in kill_or_detach(inferior*, void*) () #6 0x000000000074bdc9 in iterate_over_inferiors(int (*)(inferior*, void*= ), void*) () #7 0x00000000007272b2 in quit_force(char*, int) () #8 0x0000000000576f74 in cmd_func(cmd_list_element*, char*, int) () #9 0x000000000072698d in execute_command(char*, int) () #10 0x000000000065b2d0 in command_line_handler(char*) () #11 0x000000000065aaf2 in gdb_rl_callback_handler(char*) () #12 0x0000000801c41d7a in rl_callback_read_char () from /usr/local/lib/li= breadline.so.6 #13 0x000000000065a880 in gdb_rl_callback_read_char_wrapper(void*) () #14 0x000000000065ae80 in stdin_event_handler(int, void*) () #15 0x0000000000659cf3 in gdb_wait_for_event(int) () #16 0x00000000006598a3 in gdb_do_one_event() () #17 0x0000000000659df0 in start_event_loop() () #18 0x0000000000654c5c in captured_command_loop(void*) () #19 0x0000000000650037 in catch_errors(int (*)(void*), void*, char*, retu= rn_mask) () #20 0x0000000000654696 in gdb_main(captured_main_args*) () #21 0x0000000000408643 in main () (top-gdb) --- cut --- Calling delete_exited_threads before iterate_over_threads in fbsd_resume does not fix the hang. inf_ptrace_mourn_inferior calls waitpid and it hangs on the pid of the program being debugged, which is in TX state: T Marks a stopped process. X The process is being traced or debugged. --=20 Vasil Dimov gro.DSBeerF@dv % People can be divided into three groups: Those who make things happen, Those who watch things happen and Those who wonder what happened. --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature; name="signature.asc" Content-length: 195 -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSx1QTGJswNIJUlFLgXDpI/9sGkIAUCWGNynQAKCRAXDpI/9sGk IArqAJ0T10j9d/AcMGggk3rEHpHokx5f6ACdHUq1qcaPHP325V6WWpZlA5sV4V4= =DxvI -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND--