[2/2] Add a test for "break thread thread 2".
Commit Message
This is a follow-on patch to prove that we really do need the linespec
parser `keyword_ok' state. This test is mentioned in the source code,
but it is never actually tested anywhere. This patch adds it.
gdb/testsuite/ChangeLog
* gdb.threads/bp_in_thread.c (noreturn): Rename to ...
(thread): ... this.
* gdb.threads/bp_in_thread.exp: Change all references of
`noreturn' to `thread'.
Add test for setting thread-specific breakpoint on the
function called `thread'.
---
gdb/testsuite/gdb.threads/bp_in_thread.c | 4 ++--
gdb/testsuite/gdb.threads/bp_in_thread.exp | 13 ++++++++-----
2 files changed, 10 insertions(+), 7 deletions(-)
Comments
> gdb/testsuite/ChangeLog
> * gdb.threads/bp_in_thread.c (noreturn): Rename to ...
> (thread): ... this.
> * gdb.threads/bp_in_thread.exp: Change all references of
> `noreturn' to `thread'.
> Add test for setting thread-specific breakpoint on the
> function called `thread'.
Looks good to me.
Depending on the answer to my question about whether or not to test
for the nul character as well, we might want to augment this patch
with an additional test (Eg: "break thread thread" ?)
@@ -30,7 +30,7 @@ cond_wait (pthread_cond_t *cond, pthread_mutex_t *mut)
}
void
-noreturn (void)
+thread (void)
{
pthread_mutex_t mut;
pthread_cond_t cond;
@@ -46,7 +46,7 @@ noreturn (void)
void *
forever_pthread (void *unused)
{
- noreturn ();
+ thread ();
}
void
@@ -28,14 +28,17 @@ clean_restart $binfile
runto_main
-gdb_test "break noreturn" \
+gdb_test "break thread" \
"Breakpoint 2 at .*: file .*${srcfile}, line .*" \
- "breakpoint on noreturn"
+ "breakpoint on thread"
# Run the program and make sure GDB reports that we stopped after
-# hitting breakpoint 1 in noreturn().
+# hitting breakpoint 1 in thread().
gdb_test "continue" \
- ".*Breakpoint 2, noreturn ().*" \
- "run to noreturn"
+ ".*Breakpoint 2, thread ().*" \
+ "run to thread()"
+# Make sure the linespec parser understands that "break thread thread 2"
+# is a valid thread-specific location.
+gdb_breakpoint "thread thread 2" message