Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org
Subject: Re: [PING] [PATCH v3] gdb tests: Allow for "LWP" in thread IDs from info threads.
Date: Fri, 22 Mar 2024 13:58:56 -0700	[thread overview]
Message-ID: <eeee5741-887c-4edb-ad5d-bf97069deeb9@FreeBSD.org> (raw)
In-Reply-To: <872caa1c-920a-adf4-0738-cdad5251cc83@FreeBSD.org>

On 7/14/23 8:35 AM, John Baldwin wrote:
> On 6/30/23 7:21 AM, John Baldwin wrote:
>> On 6/9/23 9:56 AM, John Baldwin wrote:
>>> On 5/26/23 10:51 AM, John Baldwin wrote:
>>>> On 5/12/23 7:15 AM, John Baldwin wrote:
>>>>> 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?
>>>>
>>>> Ping, here's the updated log message to match:
>>>>
>>>>          gdb tests: Allow for "LWP" in thread IDs from info threads.
>>>>          
>>>>          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.
>>>>          Targets that do not support threads use "process" as the first word
>>>>          via normal_pid_to_str.
>>>>          
>>>>          Add a tdlabel_re global variable as a regular-expression for a thread
>>>>          label in `info threads' that matches either "process", "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").
>>>
>>> Ping, this is mostly a small change to a previously approved patch, just not
>>> sure what the threshold is for if a fixup change is small enough to still
>>> count as approved, etc.

I retested this again this week and it fixed about 100 tests on FreeBSD/amd64 and
had no regressions on Linux x86-64.  Given the version without "process" was
approved by Simon previously, I'm going to go ahead and push the version with
the "process" change.

-- 
John Baldwin


  reply	other threads:[~2024-03-22 20:59 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
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 [this message]
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=eeee5741-887c-4edb-ad5d-bf97069deeb9@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    /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