Re: New mi commands for threads

Nick Roberts
2007-03-15T21:12:09Z

> I'd like to propose an implementation of
> -thread-info
> -thread-list-all-threads
>
> Before posting patches, I'd like to discuss a little bit.
> First should I post 2 patches or can I post only one for both ?

I think it's best to keep the patches separate unless the code changes
overlap.

> About -thread-list-all-threads:
> -------------------------------
> It will display the same for all threads, plus the number of thread and
> the current thread id.
> Example:
> -thread-list-all-threads
> ^done,thread-list={thread-id="6",frame={level="0",addr="0x007b9939",func="__lll_mutex_lock_wait",args=[],from="/lib/tls/libpthread.so.0"},thread-extra-info="bla
> bla",thread-id="5",frame={level="0",addr="0x007b9939",func="__lll_mutex_lock_wait",args=[],from="/lib/tls/libpthread.so.0"},thread-extra-info="bla
> bla",thread-id="4",frame={level="0",addr="0x007b9939",func="__lll_mutex_lock_wait",args=[],from="/lib/tls/libpthread.so.0"},thread-extra-info="bla
> bla",thread-id="3",frame={level="0",addr="0x007b9939",func="__lll_mutex_lock_wait",args=[],from="/lib/tls/libpthread.so.0"},thread-extra-info="bla
> bla",thread-id="2",frame={level="0",addr="0x00e80aec",func="nanosleep",args=[],from="/lib/tls/libc.so.6"},thread-extra-info="bla
> bla",thread-id="1",frame={level="0",func="main",args=[],file="/project/flexdbug/user/pd10/gdb/sts-gdb-repository/vendor/cvs/head/src/gdb/testsuite/gdb.mi/pthreads.c",fullname="/project/flexdbug/user/pd10/gdb/sts-gdb-repository/vendor/cvs/head/src/gdb/testsuite/gdb.mi/pthreads.c",line="87"},line="87",file="/project/flexdbug/user/pd10/gdb/sts-gdb-repository/vendor/cvs/head/src/gdb/testsuite/gdb.mi/pthreads.c",thread-extra-info="bla
> bla"},number-of-threads="6",current-thread-id="1"

I would put number-of-threads="6",current-thread-id="1" at the start so that
they don't get lost behind the thread list (I know the output is only intended
for the front end but it might make debugging of GDB easier and costs nothing).

Lists use square brackets, information on each thread should be enclosed in
curly brackets:

threads=[{thread-id="6",frame={...},thread-extra-info="bla"},{thread-id="5",frame={...},thread-extra-info="bla"},...]

I guess your output has been manually generated as thread-id="1" seems to
duplicate some information.

I thought that the frame information was expensive to get and that it was
agreed you could get it, if needed, using other MI commands anyway.

--
Nick http://www.inet.net.nz/~nickrob