Skip to content

Confusing behavior of itset define (defset) with regards to width #3

@simark

Description

@simark

So, we have a few threads:

(gdb) i th
  Id   Target Id         Frame 
* 1.1  Thread 0x7ffff7fc5740 (LWP 9277) "test_pthread" break_here () at test_pthread.c:112
  1.2  Thread 0x7ffff77f6700 (LWP 9281) "test_pthread" 0x00007ffff7bcaf1c in __lll_lock_wait ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
  1.3  Thread 0x7ffff6ff5700 (LWP 9282) "test_pthread" 0x00007ffff7bcaf1c in __lll_lock_wait ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
  1.4  Thread 0x7ffff67f4700 (LWP 9283) "test_pthread" 0x00007ffff7bc923c in pthread_barrier_wait
    () from /lib/x86_64-linux-gnu/libpthread.so.0
  1.5  Thread 0x7ffff5ff3700 (LWP 9284) "test_pthread" 0x00007ffff7bc923c in pthread_barrier_wait
    () from /lib/x86_64-linux-gnu/libpthread.so.0
  1.6  Thread 0x7ffff57f2700 (LWP 9285) "test_pthread" 0x00007ffff7bc923c in pthread_barrier_wait
    () from /lib/x86_64-linux-gnu/libpthread.so.0
  1.7  Thread 0x7ffff4ff1700 (LWP 9286) "test_pthread" 0x00007ffff7bcaf1c in __lll_lock_wait ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
  1.8  Thread 0x7ffff47f0700 (LWP 9287) "test_pthread" 0x00007ffff7bcaf1c in __lll_lock_wait ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
  1.9  Thread 0x7ffff3fef700 (LWP 9288) "test_pthread" 0x00007ffff78460fb in ?? ()
   from /lib/x86_64-linux-gnu/libc.so.6

And the current width is default:

(gdb) itfocus 
Focus is `dt1.1'.
Current inferior is 1.
Current thread is 1.

I try to define a workers set that contains two threads:

(gdb) itset define workers (t1.2,t1.3)

It ends up containing all the threads of inferior one:

(gdb) itset view 
...
workers contains:
  inferiors: 1
  threads: 1, 2, 3, 4, 5, 6, 7, 8, 9
  cores: 3, 2, 3, 1, 1, 1, 1, 3, 1

That's probably because the default width for that operation is the inferior (or all, I haven't tried with more than one inferior), something like that. When I set the width to thread:

(gdb) itfocus t itset define workers2 (t1.2,t1.3)

The set only contains the specified threads:

(gdb) itset view
...
workers contains:
  inferiors: 1
  threads: 1, 2, 3, 4, 5, 6, 7, 8, 9
  cores: 3, 2, 3, 1, 1, 1, 1, 3, 1
workers2 contains:
  inferiors: 1
  threads: 2, 3
  cores: 2, 3

Shouldn't the default width for the defset command be thread? It seems counter intuitive if it automatically includes more threads than the user specified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions