RE: [RFC] New command "thread filter" in GDB
"Ijaz, Abdul B via Gdb" <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <SA1PR11MB68464B7CA31B6BB28DDF2CCBCB4A2@SA1PR11MB6846.namprd11.prod.outlook.com> |
Thanks Martin for the feedback. >> * info threads 1 2 3 4 >> * “info thread” command print thread info for thread ids “1 2 3 4 5” Martin > Are you also proposing an extension to "info threads" and "threads apply"? Otherwise, I don't see how a script can use the result of "thread filter" in those commands. Maybe some extension to allow a string type list from a variable like in the following (currently, you get an error "History value must have integer type.")? Abdul > The output of this command can still be used by only copying the value inside the quotes and discarding the double quotes for "info threads" or "thread apply" commands in current gdb. But, yes eventually, "info threads" and "thread apply" command will be extended to use the output of this command from history value. This is the reason that the output of this command is proposed a space separated list of ids a string value and added to history to make it more useable. E.g. " thread filter all $_thread<5 Filtered threads: $1 = “1 2 3 4” $ info threads 1 2 3 4 " Thanks & Best Regards Abdul Basit -----Original Message----- From: Martin Simmons <[email protected]> Sent: Monday, October 28, 2024 10:12 PM To: Ijaz, Abdul B <[email protected]> Cc: [email protected]; Aktemur, Tankut Baris <[email protected]>; Schimpe, Christina <[email protected]>; Metzger, Markus T <[email protected]> Subject: Re: [RFC] New command "thread filter" in GDB >>>>> On Wed, 2 Oct 2024 07:24:21 +0000, Ijaz, Abdul B via Gdb said: > > Hi All, > > I am writing to collect your feedback for the new command “thread filter”, we would like to introduce. This new command will process the input list of threads and then try to filter them if there is any expression in the input. So it print only filtered thread ids from the input list where the input expression evaluates to true. Here are some examples for the usage of this command: > > > * thread filter 1-9 > * Outputs the ids of threads with single digit > * thread filter all x > 10 > * Outputs the ids of threads in whose context the variable “x” is greater than 10. > * thread filter 10-99 $_thread % 2 == 0 > * Outputs the ids of threads whose id is a two-digit even number. > * thread filter all predicate() > * Outputs the ids of thread for which the function “predicate” evaluates to true. > * thread filter all workitem == 1234 > * Find the thread(s) for which the “workitem” variable has a specific value. > > Output of all these commands will be string type list of thread ids > which may be used later for other commands like thread apply, info > thread or further filtering. For example > > * thread filter all $_thread<5 > > Filtered threads: > > $1 = “1 2 3 4” > > > Examples of output usage in other command like “info thread” or “thread apply”: > > * info threads 1 2 3 4 > * “info thread” command print thread info for thread ids “1 2 3 4 5” Are you also proposing an extension to "info threads" and "threads apply"? Otherwise, I don't see how a script can use the result of "thread filter" in those commands. Maybe some extension to allow a string type list from a variable like in the following (currently, you get an error "History value must have integer type.")? info threads $1 thread apply $1 p workitem __Martin Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928