Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Amos Bird <amosbird@gmail.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <palves@redhat.com>, Simon Marchi <simark@simark.ca>,
	Eli Zaretskii <eliz@gnu.org>,
	gbenson@redhat.com, tom@tromey.com
Subject: Re: [PATCH] Add "thread-exited" annotation
Date: Thu, 06 Jun 2019 15:37:00 -0000	[thread overview]
Message-ID: <87v9xizpwd.fsf@gmail.com> (raw)
In-Reply-To: <87mujlc8bn.fsf@gmail.com>


Gentle ping.

Thanks!

Amos Bird <amosbird@gmail.com> writes:

> Hi Pedro,
>
> Thanks for the suggestion. Patch updated.
>
> Amos
>
> Pedro Alves <palves@redhat.com> 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


  reply	other threads:[~2019-06-06 15:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 15:19 Amos Bird
2019-04-30 15:45 ` Tom Tromey
2019-04-30 17:09   ` Amos Bird
2019-05-16 13:14     ` Gary Benson
2019-05-16 14:10       ` Amos Bird
2019-05-16 14:35         ` Eli Zaretskii
2019-05-16 14:45           ` Amos Bird
2019-05-17  9:59             ` Gary Benson
2019-05-17 10:55               ` Amos Bird
2019-05-17 13:08             ` Simon Marchi
     [not found]               ` <87r28xciz3.fsf@gmail.com>
2019-05-17 14:22                 ` Simon Marchi
     [not found]                   ` <87pnohcc5t.fsf@gmail.com>
2019-05-17 16:26                     ` Pedro Alves
2019-05-17 17:13                       ` Amos Bird
2019-06-06 15:37                         ` Amos Bird [this message]
2019-06-06 16:32                         ` Pedro Alves
2019-06-06 17:11                           ` Amos Bird

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9xizpwd.fsf@gmail.com \
    --to=amosbird@gmail.com \
    --cc=eliz@gnu.org \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox