]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix "thread apply $conv_var" and misc other related problems
authorPedro Alves <palves@redhat.com>
Fri, 15 Jan 2016 21:46:22 +0000 (21:46 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 15 Jan 2016 21:46:22 +0000 (21:46 +0000)
commit3f5b7598805c8253c43c989a540a2408c8b685ad
tree74f71dc4893338da7d523e24e80a635aa48ce2cc
parent9c03a84f6cc54af01d4fe655f6e0a0aa13d8ef74
Fix "thread apply $conv_var" and misc other related problems

This fixes a few bugs in "thread apply".

While this works:

 (gdb) thread apply 1 p 1234

 Thread 1 (Thread 0x7ffff7fc1740 (LWP 14048)):
 $1 = 1234

This doesn't:

 (gdb) thread apply $thr p 1234

 Thread 1 (Thread 0x7ffff7fc1740 (LWP 12039)):
 Invalid thread ID: p 1234
 (gdb)

~~~~

Also, while this works:
 (gdb) thread apply 1
 Please specify a command following the thread ID list

This doesn't:
 (gdb) thread apply $thr
 Thread 1 (Thread 0x7ffff7fc1740 (LWP 12039)):
 [Current thread is 1 (Thread 0x7ffff7fc1740 (LWP 12039))]
 (gdb)

~~~~

And, while this works:
 (gdb) thread apply
 Please specify a thread ID list

This obviously bogus invocation is just silent:
 (gdb) thread apply bt
 (gdb)

gdb/ChangeLog:
2016-01-15  Pedro Alves  <palves@redhat.com>

* thread.c (thread_apply_command): Use the tid range parser to
advance past the thread ID list.
* tid-parse.c (get_positive_number_trailer): New function.
(parse_thread_id): Use it.
(get_tid_or_range): Use it.  Return 0 instead of throwing invalid
thread ID error.
(get_tid_or_range): Detect negative values.  Return 0 instead of
throwing invalid thread ID error.

gdb/testsuite/ChangeLog:
2016-01-15  Pedro Alves  <palves@redhat.com>

* gdb.multi/tids.exp (thr_apply_info_thr_error): Remove "p 1234"
command from "thread apply" invocation.
(thr_apply_info_thr_invalid): Default the expected output to the
input tid list.
(top level): Add tests that use convenience variables.  Add tests
for "thread apply" with a valid TID list, but missing the command.
gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.multi/tids.exp
gdb/thread.c
gdb/tid-parse.c