summaryrefslogtreecommitdiff
path: root/gdb/cli/cli-utils.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2011-02-21 23:40:45 +0000
committerMichael Snyder <msnyder@specifix.com>2011-02-21 23:40:45 +0000
commitf49c3f2f3973e0f6b0c639efff4120799ef4f647 (patch)
tree214515be07842b00d8933b9623eed0b3db3e8686 /gdb/cli/cli-utils.c
parent745bf96b0bd2b2dc7dc6526e938de3713d4ae093 (diff)
downloadgdb-f49c3f2f3973e0f6b0c639efff4120799ef4f647.tar.gz
2011-02-21 Michael Snyder <msnyder@vmware.com>
* gdbthread.h (print_thread_info): Change prototype. * thread.c (print_thread_info): Accept char* instead of int for requested_threads argument. Use new function number_is_in_list to determine which threads to list. (info_threads_command): Pass char* to print_thread_info. * cli/cli-utils.c (number_is_in_list): New function. * cli/cli-utils.h (number_is_in_list): Export. * mi/mi-main.c (mi_cmd_thread_info): Pass char* to print_thread_info. (print_one_inferior): Ditto. (mi_cmd_list_thread_groups): Ditto. 2011-02-21 Michael Snyder <msnyder@vmware.com> * gdb.threads/thread-find.exp: Update patterns for changes in output of "info threads" command.
Diffstat (limited to 'gdb/cli/cli-utils.c')
-rw-r--r--gdb/cli/cli-utils.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 0c98ca9eb0f..8a7e5d40d31 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -161,6 +161,27 @@ get_number_or_range (char **pp)
return last_retval;
}
+/* Accept a number and a string-form list of numbers such as is
+ accepted by get_number_or_range. Return TRUE if the number is
+ in the list.
+
+ By definition, an empty list includes all numbers. This is to
+ be interpreted as typing a command such as "delete break" with
+ no arguments. */
+
+int
+number_is_in_list (char *list, int number)
+{
+ if (list == NULL || *list == '\0')
+ return 1;
+
+ while (list != NULL && *list != '\0')
+ if (get_number_or_range (&list) == number)
+ return 1;
+
+ return 0;
+}
+
/* See documentation in cli-utils.h. */
char *