gdb tests: Allow for "LWP" or "process" 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").
This commit is contained in:
John Baldwin
2024-03-22 17:29:47 -07:00
parent efd58a4379
commit 467a34bb9e
24 changed files with 62 additions and 53 deletions

View File

@@ -63,7 +63,7 @@ gdb_test "continue" \
# reported in the "Id" column.
gdb_test "info threads" \
{.*[\r\n]+\* +([0-9]+) +Thread[^\r\n]* do_something \(n=\1\) at.*}
[format {.*[\r\n]+\* +([0-9]+) +%s[^\r\n]* do_something \(n=\1\) at.*} $tdlabel_re]
# Check for expected results when passing a valid thread handle to
# thread_from_handle().