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.