[patch] info threads sort by name and name regex matching
Abid, Hafiz
Hafiz_Abid@mentor.com
Wed Aug 22 10:06:00 GMT 2012
>+set NR_THREADS 4
>+
>+standard_testfile
>+
>+# Start with a fresh gdb.
>+gdb_exit
>+gdb_start
I think you don't need gdb_exit and gdb_start when you are doing clean_restart below.
>+
>+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
>+ return -1
>+}
>+
>+clean_restart ${binfile}
>+
>+if { ![runto_main] } {
>+ fail "Can't run to main"
>+ return 0
>+}
>+
Regards,
Abid
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Aaron Gamble
> Sent: Tuesday, August 21, 2012 10:19 PM
> To: gdb-patches@sourceware.org
> Subject: [patch] info threads sort by name and name regex matching
>
> Hello all,
>
> Here is a patch for adding sorting by name in 'info threads' and regex
> pattern matching of thread names for filtering threads.
>
> With this patch sorting by name will happen always. (Perhaps a switch
> to enable sorting would be better?)
>
> Regex matching is specified by doing 'info threads r<regex>'. This is
> not ambiguous with previous behavior where parameters to info threads
> were only numbers. (spaces between 'r' and <regex> are ignored)
>
> e.g. info threads r ^name_prefix
>
> Regards,
>
> gdb/ChangeLog:
> * gdbthread.h: Add char *cached_name to struct thread_info for use
> when sorting.
> * thread.c: #include <stdlib.h>.
> (thread_list_size): New global.
> (init_Thread_list): Initialize it.
> (free_thread): Decrement it.
> (new_thread): Increment it.
> (print_thread_filter_check): New function.
> (print_thread_sort_cmp): New function.
> (print_thread_info_single): New function.
> (print_thread_info): Sort threads by name and filter by regex
> match.
>
> testsuite/
> * gdb.threads/Makefile.in (EXECUTABLES): Add info-thread-sort-
> regex.
> * gdb.threads/info-thread-sort-regex.c: New file.
> * gdb.threads/info-thread-sort-regex.exp: New file.
>
> doc/
> * gdb.texinfo (Threads): Add information about sorting and regex
> parameters.
More information about the Gdb-patches
mailing list