Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3] gdb tests: Allow for "LWP" in thread IDs from info threads.
Date: Fri, 12 May 2023 07:15:51 -0700	[thread overview]
Message-ID: <bf635367-be18-ca6d-0e51-8632b8a4c658@FreeBSD.org> (raw)
In-Reply-To: <f29bb557-8e51-2bda-022f-08087af92458@FreeBSD.org>

On 5/9/23 1:56 PM, John Baldwin wrote:
> On 5/9/23 12:01 PM, Simon Marchi wrote:
>> On 4/18/23 16:13, John Baldwin wrote:
>>> Several tests assume that the first word after a thread ID in 'info
>>> threads' output is "Thread".  However, several targets use "LWP"
>>> instead such as the FreeBSD and NetBSD native targets.  The Linux
>>> native target also uses "LWP" if libthread_db is not being used.
>>>
>>> Add a tdlabel_re global variable as a regular-expression for a thread
>>> label in `info threads' that matches either "thread" or "LWP".
>>>
>>> Some other tests in the tree don't require a specific word, and
>>> some targets may use other first words (e.g. OpenBSD uses "thread"
>>> and Ravenscar threads use "Ravenscar Thread").
>>
>> That LGTM, I don't really see another way:
>>
>> Approved-By: Simon Marchi <simon.marchi@efficios.com>
>>
>> One nit is that I prefer to use the ${::tdlabel_re} notation instead of
>> the global keyword, but it's not a dealbreaker.
>>
>> And just one question:
>>
>>> diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
>>> index 14db2511d40..a5b7ccf4ba5 100644
>>> --- a/gdb/testsuite/gdb.trace/report.exp
>>> +++ b/gdb/testsuite/gdb.trace/report.exp
>>> @@ -380,7 +380,7 @@ proc use_collected_data { data_source } {
>>>    
>>>    	# There is always a thread of an inferior, either a live one or
>>>    	# a faked one.
>>> -	gdb_test "info threads" "\\* ${decimal}    (process|Thread) \[0-9\.\]+\[ \t\].*"
>>> +	gdb_test "info threads" "\\* ${decimal}    ${tdlabel_re} \[0-9\.\]+\[ \t\].*"
>>
>> This one said "process" as well, I guess it's not important?
> 
> Hummm, it didn't regress on Linux, but on some other native target that
> doesn't support threads it might regress I guess.  normal_pid_to_str
> uses "process <PID>" and is the defalt for target::pid_to_str.
> 
> Probably tdlabel_re should permit "process" as a word as well:
> 
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 527c84599ca..6ded65e31c4 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -283,7 +283,7 @@ set inferior_exited_re "(?:\\\[Inferior \[0-9\]+ \\(\[^\n\r\]*\\) exited)"
>    
>    # A regular expression that matches the first word of a thread
>    # description after the thread number info 'info threads'
> -set tdlabel_re "(Thread|LWP)"
> +set tdlabel_re "(process|Thread|LWP)"
>    
>    # A regular expression that matches a value history number.
>    # E.g., $1, $2, etc.
> 
> (I'd also have to reword the commit log a bit to mention this case if so.)

Just to be sure, are you still ok with this patch with this tweak?

-- 
John Baldwin


  reply	other threads:[~2023-05-12 14:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 20:13 John Baldwin
2023-05-08 16:19 ` [PING] " John Baldwin
2023-05-09 19:01 ` Simon Marchi via Gdb-patches
2023-05-09 20:56   ` John Baldwin
2023-05-12 14:15     ` John Baldwin [this message]
2023-05-26 17:51       ` John Baldwin
2023-06-09 16:56         ` John Baldwin
2023-06-30 14:21           ` [PING] " John Baldwin
2023-07-14 15:35             ` John Baldwin
2024-03-22 20:58               ` John Baldwin
2024-03-26 12:19     ` Pedro Alves

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=bf635367-be18-ca6d-0e51-8632b8a4c658@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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