GDB/MI Thread Commands (Debugging with ROCGDB)

Next: GDB/MI Ada Tasking Commands, Previous: GDB/MI Program Context, Up: GDB/MI [Contents][Index]

### 28.11 GDB/MI Thread Commands

#### The `-thread-info` Command

#### Synopsis

     -thread-info [ thread-id ]

Reports information about either a specific thread, if the thread-id parameter is present, or about all threads. thread-id is the thread’s global thread ID. When printing information about all threads, also reports the global ID of the current thread.

#### ROCGDB Command

The ‘`info thread`’ command prints the same information about all threads.

#### Result

The result contains the following attributes:

‘`threads`’

  A list of threads. The format of the elements of the list is described in GDB/MI Thread Information.

‘`current-thread-id`’

  The global id of the currently selected thread. This field is omitted if there is no selected thread (for example, when the selected inferior is not running, and therefore has no threads) or if a thread-id argument was passed to the command.

#### Example

    -thread-info
    ^done,threads=[
    {id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
       frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",
               args=[]},state="running"},
    {id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
       frame={level="0",addr="0x0804891f",func="foo",
               args=[{name="i",value="10"}],
               file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"},
               state="running"}],
    current-thread-id="1"
    (gdb)

#### The `-lane-info` Command

#### Synopsis

     -lane-info [ lane-id ]

Reports information about either a specific lane, if the lane-id parameter is present, or about all lanes of the current thread.

#### ROCGDB Command

The ‘`info lanes`’ command prints the same information about lanes.

#### Result

The result contains the following attributes:

‘`lanes`’

  A list of lanes. The format of each element of the list is a tuple with the following fields. The fields are always present unless stated otherwise.

  `id`

    The numeric id assigned to the lane by ROCGDB.

  `state`

    The state of the lane, either ‘`A`’, ‘`I`’, or ‘`U`’. See info lanes for a description of what these states mean.

  `target-id`

    The target-specific string identifying the lane.

  `frame`

    The stack frame currently executing in the lane. This field is only present if the lane’s thread is stopped. Its format is documented in GDB/MI Frame Information.

#### Example

    -lane-info
    ^done,lanes=[
    {id="0",state="A",target-id="AMDGPU Lane 1:2:1:1/0 (0,0,0)[0,0,0]",
       frame={level="0",addr="0x00007ffff580b8b4",func="kernel",
               args=[]}},
    {id="1",state="I",target-id="AMDGPU Lane 1:2:1:1/1 (0,0,0)[1,0,0]",
       frame={level="0",addr="0x00007ffff580b8b4",func="kernel",
               args=[]}},
    ...
    {id="31",state="A",target-id="AMDGPU Lane 1:2:1:1/31 (0,0,0)[1,0,0]",
       frame={level="0",addr="0x00007ffff580b8b4",func="kernel",
               args=[]}}]
    (gdb)

#### The `-thread-list-ids` Command

#### Synopsis

     -thread-list-ids

Produces a list of the currently known global ROCGDB thread ids. At the end of the list it also prints the total number of such threads.

This command is retained for historical reasons, the `-thread-info` command should be used instead.

#### ROCGDB Command

Part of ‘`info threads`’ supplies the same information.

#### Example

    (gdb)
    -thread-list-ids
    ^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
    current-thread-id="1",number-of-threads="3"
    (gdb)

#### The `-thread-select` Command

#### Synopsis

     -thread-select [ -l lane-id ] thread-id

Make thread with global thread number thread-id the current thread, and if present, the lane with number lane-id the current lane. It prints the number of the new current thread, and the topmost frame for that thread. If the new current thread supports lanes, the command prints the number of the new current lane as well.

This command is deprecated in favor of explicitly using the ‘`--thread`’ and ‘`--lane`’ options to each command.

#### ROCGDB Command

The corresponding ROCGDB commands are ‘`thread`’ and ‘`lane`’.

#### Example

    (gdb)
    -exec-next
    ^running
    (gdb)
    *stopped,reason="end-stepping-range",thread-id="2",line="187",
    file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
    (gdb)
    -thread-list-ids
    ^done,
    thread-ids={thread-id="3",thread-id="2",thread-id="1"},
    number-of-threads="3"
    (gdb)
    -thread-select 3
    ^done,new-thread-id="3",
    frame={level="0",func="vprintf",
    args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
    {name="arg",value="0x2"}],file="vprintf.c",line="31",arch="i386:x86_64"}
    (gdb)

    (gdb)
    -thread-select -l 2 3
    ^done,new-thread-id="3",lane-id="2",
    frame={level="0",func="kernel",
    args=[],file="kernel.cc",line="20",arch="amdgcn:gfx906"}
    (gdb)

Next: GDB/MI Ada Tasking Commands, Previous: GDB/MI Program Context, Up: GDB/MI [Contents][Index]