Debugging with GDB

Node:GDB/MI Thread Commands, Next:GDB/MI Tracepoint Commands, Previous:GDB/MI Target Manipulation, Up:GDB/MI

### GDB/MI Thread Commands

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

##### Synopsis

          -thread-info

##### GDB command

No equivalent.

##### Example

N.A.

#### The `-thread-list-all-threads` Command

##### Synopsis

          -thread-list-all-threads

##### GDB Command

The equivalent GDB command is `info threads`.

##### Example

N.A.

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

##### Synopsis

          -thread-list-ids

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

##### GDB Command

Part of `info threads` supplies the same information.

##### Example

No threads present, besides the main process:

         (gdb)
         -thread-list-ids
         ^done,thread-ids={},number-of-threads="0"
         (gdb)

Several threads:

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

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

##### Synopsis

          -thread-select threadnum

Make threadnum the current thread. It prints the number of the new current thread, and the topmost frame for that thread.

##### GDB Command

The corresponding GDB command is `thread`.

##### 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"}
         (gdb)