From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94415 invoked by alias); 6 Jun 2019 15:37:17 -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 94404 invoked by uid 89); 6 Jun 2019 15:37:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=Bird, HX-Gm-Message-State:APjAAAW, gentle, HX-Spam-Relays-External:209.85.214.193 X-HELO: mail-pl1-f193.google.com Received: from mail-pl1-f193.google.com (HELO mail-pl1-f193.google.com) (209.85.214.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Jun 2019 15:37:15 +0000 Received: by mail-pl1-f193.google.com with SMTP id a93so1074544pla.7 for ; Thu, 06 Jun 2019 08:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=wmysd2fS+aeNZlu2Ct58ddWBpPToz8W5WcKDheoK+UQ=; b=dwtd95+a9emdjZKU/l9lu2s2GKrUZbIdbY1CMb1BZPciJQ1Q56n1IPs+/J8eWWMEoe g/VyLUzsrw0VJ72Q8W6h7ZxwOeC9HQEcca0LjayPxZDlGprkvTLqwJJw3SifbU+wqEiv n44dI+rv64VHNNcM06TTvMLJo76gBhglNwkfPVBwb3bd8f/oKHuVp4OJpDsbBcmKyNcW mp6ZcClX+s4sdfuQnS2AK1bQXZ4oK8l05ptBnV2vJUvHRNQiK8qRH4VxecMAPXgt426J x3vHde94/ovdL2P7/Y3Yka4ZdZk5jJAfg+spcSGIpRqlH6lKQrXwsmG8PP7ld3YUd49L IfMg== Return-Path: Received: from localhost ([40.83.99.220]) by smtp.gmail.com with ESMTPSA id g7sm2238159pgu.31.2019.06.06.08.37.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 06 Jun 2019 08:37:12 -0700 (PDT) References: <87d0l8pzdz.fsf@gmail.com> <87ef5j33au.fsf@tromey.com> <87ftpzo1wa.fsf@gmail.com> <20190516131419.GA29999@blade.nx> <87ftpepk1l.fsf@gmail.com> <83d0kicvs6.fsf@gnu.org> <87ef4ypif5.fsf@gmail.com> <441e0b74-a391-2d68-e5d3-f43f1b8da188@simark.ca> <87r28xciz3.fsf@gmail.com> <87pnohcc5t.fsf@gmail.com> <070c42f3-78bd-e605-3f9d-e708f3f0a65c@redhat.com> <87mujlc8bn.fsf@gmail.com> User-agent: mu4e 1.3.2; emacs 27.0.50 From: Amos Bird To: gdb-patches@sourceware.org Cc: Pedro Alves , Simon Marchi , Eli Zaretskii , gbenson@redhat.com, tom@tromey.com Subject: Re: [PATCH] Add "thread-exited" annotation In-reply-to: <87mujlc8bn.fsf@gmail.com> Date: Thu, 06 Jun 2019 15:37:00 -0000 Message-ID: <87v9xizpwd.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-SW-Source: 2019-06/txt/msg00141.txt.bz2 Gentle ping. Thanks! Amos Bird writes: > Hi Pedro, > > Thanks for the suggestion. Patch updated. > > Amos > > Pedro Alves writes: > >> On 5/17/19 4:51 PM, Amos Bird wrote: >>> +proc thread_exit {} { >>> + global decimal >>> + gdb_test_multiple "call (void)pthread_exit()" "thread >>> exit" { >> >> Since this is calling a function, it would need to be gated >> with a gdb,cannot_call_functions check (grep for uses). >> >> Does that call return? If the thread exits, the "call" command >> will >> continue running without returning to the prompt, right? >> >> I guess that's why you don't expect the prompt here: >> >>> + gdb_test_multiple "call (void)pthread_exit()" "thread >>> exit" { >>> + -re >>> ".*\032\032thread-exited,id=\"${decimal}\",group-id=\"i${decimal}\"" >>> { >>> + pass "thread exit" >>> + } >>> + } >>> +} >> >> Note that this approach means that if someone were to add a >> test >> after this one, we'd need to either ctrl-c the program, or >> restart >> gdb. >> >> Please test this with >> >> make check RUNTESTFLAGS="--target_board=native-gdbserver" >> >> too. In that case, you're debugging with gdbserver, and >> gdb/gdbserver >> won't notice that the thread exited until the program next >> stops. >> >> Also, you probably don't have debug info for glibc/libpthread >> in >> your >> system. I say this because pthread_exit takes an argument and >> above >> you're not passing any, resulting in undefined behavior. >> >> I'd be much better if the .c file were tweaked to make the >> thread >> exit on its own, or a new .c file were added for that purpose, >> IMO. >> E.g., make the main thread join a child thread and hit a >> breakpoint >> once the thread exits and the join unlocks. >> >>> + -re >>> ".*\032\032thread-exited,id=\"${decimal}\",group-id=\"i${decimal}\"" >>> { >>> + pass "thread exit" >>> + } >>> + } >>> +} >>> + >>> thread_test >>> thread_switch >>> +thread_exit >>> >>> # restore the original prompt for the rest of the testsuite >> >> Thanks, >> Pedro Alves -- Amos Bird amosbird@gmail.com