Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* RE: info thread
@ 2006-09-25 16:25 Alain Magloire
  0 siblings, 0 replies; 17+ messages in thread
From: Alain Magloire @ 2006-09-25 16:25 UTC (permalink / raw)
  To: gdb



> 
> (gdb) interpreter-exec mi -thread-list-all-threads
> ^error,msg="Undefined mi command: thread-list-all-threads (missing
> implementation)"
> 
> I think you're thinking of -thread-list-ids.  Ah, this is mi/674.
> It's also mi/1040.  Both of which suggest *stopped :-)
> 

Mea culpa.


^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: info thread
@ 2006-09-28 14:35 Alain Magloire
  0 siblings, 0 replies; 17+ messages in thread
From: Alain Magloire @ 2006-09-28 14:35 UTC (permalink / raw)
  To: Denis PILAT; +Cc: Daniel Jacobowitz, nickrob, gdb



> From: Denis PILAT [mailto:denis.pilat@st.com]
> Sent: Wednesday, September 27, 2006 10:18 AM
> To: Alain Magloire
> Cc: Daniel Jacobowitz; nickrob@snap.net.nz; gdb@sourceware.org
> Subject: Re: info thread
> 
> 
> 
> Alain Magloire wrote:
> 
> >
> >>I think you're thinking of -thread-list-ids.  Ah, this is mi/674.
> >>It's also mi/1040.  Both of which suggest *stopped :-)
> >>
> >>We could add the thread to -thread-list-ids, too.
> >>
> >>Something to keep in mind: the thread "extra info" is expensive to
> >>collect on some platforms, e.g. requires asking the remote stub for
> >>details on each individual thread.
> >>
> >>
> >
> >Noted, but some platforms put some extra stuff in the output of "info
> >threads" like thread names, states, mutexes etc ... this information is
> then
> >retrieve by the IDE and shownn to the user.
> >
> Yes but to display this "extra stuffs" they have to customize their
> Eclipse (or any UI) to implement a parser for that.
> 
> I think it will be more generic and cost less (in term of execution
> time) if "extra information" could be accessible thru an other mi
> command than -thread-list-ids.
> Generic part of the UI then calls -thread-list-ids
> Targets that want to display more information then just call a more
> complete command like -thread-list-all-threads
> or -thread-info on each thread.
> 
> 

Agreed, if we the UI views are smart enough to tell which threads are
visible to the users then the implementation can be lazy in getting the
info.

> What I propose is the following:
> 
> -thread-list-ids :
> INPUT: none
> OUTPUT:
>     o list of IDs
>     o Current thread could be the first (or last) item of the list, or
>     warned by an asterisk
> 
> -thread-list-all-threads
> INPUT: none
> OUTPUT:
>    o like  -thread-list-ids
>    o plus the list of "extra information" per thread
> 
> 
> -thread-info
> INPUT: thread ID as an optional parameter, if not given the following
>     concerns current thread
> OUTPUT:
>     o thread ID (could be used to determine which is the current
>     thread if not given in parameter)
>     o extra information
>     o stack frame
> 
> 

OK.  And in term of format, are we talking tuple/list?  There was some
inconsistencies in the old MI versions.  Also for extra information you are
probably mean "optional extra information" will that be an opaque string or
name=value pairs.

> 
> Apart from the debate let me give you some measurements I did on a
> 100 threads program that runs on a board, debugged thru jtag.
> Figures for the "info thread" CLI command only:
> 70 % of the time is spent in getting the stack frame for all threads
> 1% on the "extra info"
> 29% on other stuff out of the loop that collect thread above information.
> 
> Stack frame is the one that takes the most since it requires to switch
> the current thread and print the stack. Switching takes 60% of that
> time. Moreover extra information are reduced for our target.
> 
> Please note that the total time is 7.2 seconds for this example !

On some architecture "info threads" can make things extremely slow, since
the IDE will have to poll at every step to discover created/destroyed
threads.  For the long run we should probably look at notifications.


^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: info thread
@ 2006-09-25 17:27 Alain Magloire
  2006-09-25 17:36 ` Daniel Jacobowitz
  2006-09-27 14:18 ` Denis PILAT
  0 siblings, 2 replies; 17+ messages in thread
From: Alain Magloire @ 2006-09-25 17:27 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Denis PILAT, nickrob, gdb



> 
> I think you're thinking of -thread-list-ids.  Ah, this is mi/674.
> It's also mi/1040.  Both of which suggest *stopped :-)
> 
> We could add the thread to -thread-list-ids, too.
> 
> Something to keep in mind: the thread "extra info" is expensive to
> collect on some platforms, e.g. requires asking the remote stub for
> details on each individual thread.
>

Noted, but some platforms put some extra stuff in the output of "info
threads" like thread names, states, mutexes etc ... this information is then
retrieve by the IDE and shownn to the user.

It is my understanding, that the output is platform dependent. Are you
suggesting a new command to retrieve this info? I was hopping we could stuff
this in the output of -thread-list-ids.

Basically, we would like to retrieve more information on a thread what is
the best way for MI?
 


^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: info thread
@ 2006-09-25 15:25 Alain Magloire
  2006-09-25 15:31 ` Daniel Jacobowitz
  0 siblings, 1 reply; 17+ messages in thread
From: Alain Magloire @ 2006-09-25 15:25 UTC (permalink / raw)
  To: Daniel Jacobowitz, Denis PILAT; +Cc: nickrob, gdb



> -----Original Message-----
> From: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] On Behalf
> Of Daniel Jacobowitz
> Sent: Monday, September 25, 2006 10:52 AM
> To: Denis PILAT
> Cc: Mark Kettenis; nickrob@snap.net.nz; gdb@sourceware.org
> Subject: Re: info thread
> 
> On Mon, Sep 25, 2006 at 04:49:07PM +0200, Denis PILAT wrote:
> > About current thread, it is displayed by an asterisk with "info thread"
> > command, and gathered by Eclipse today from that output,
> > , whereas it could be from the  MI stop reply message.
> >
> > Do we need to have the current thread ID in one of the -thread-blabla
> > command ?
> > That would avoid storing it somewhere in the GUI.
> 
> I think this would be a good idea, since it would be so easy.  It will
> be simpler for consumers.  They should be able to keep track of it
> by watching stop replies and their own -thread-select commands, and
> some future notifier support for e.g. typing "thread 2" at a console,
> but there's no reason to make this hard.
> 

Yes, fortunately when the async "*stopped," appears it contains the
thread-id.  But the active tread is not necessary the one we are we stopped.
For example, we allow the user to issue commands to gdb so the user may
change the active thread, so having a notification would be great.

  I have a gnat/pr on this way back, the reasons that CDT/Debug/MI was using
"info threads" instead of -thread-list-ids were:
- -thread-list-all-threads was crashing (probably fixed by now)
- -thread-list-all-threads was not showing the newly created thread, i.e.
the MI command was not doing the same job as "info threads"

Note also some folks support thread names and add other information in the
"info threads" output.  To accommodate, it would be nice to change the
output of this command to list of name=values pairs, something like:
[{name="id",value="1"}{name="name",value="Driver thread"}...] 


^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: info thread
@ 2006-09-18 21:49 Nick Roberts
  2006-09-19 13:16 ` Denis PILAT
  0 siblings, 1 reply; 17+ messages in thread
From: Nick Roberts @ 2006-09-18 21:49 UTC (permalink / raw)
  To: Denis, PILAT <denis.pilat; +Cc: Daniel Jacobowitz, gdb


> Daniel,

> I'd like your opinion about a feature that we need to implement in gdb. We'd
> like to choose the solution that has the best chance to be accepted and
> integrated in GDB.

This isn't a patch so isn't the gdb mailing list more appropriate?

> As you may know, Eclipse is using "info threads" command to get thread
> Ids. The problem is that some part of this command is not used by Eclipse and
> can take a lot of time to execute when the debugger is remotely connected to
> a board. In our case we have a 100 threads application and the info threads
> takes a lot of time to execute, and in Eclipse this command is run each time
> the user push the "next" button, which leads to a non usable graphical
> interface.  

Some form of event notification would be desirable where GDB tells the
front end that the relevant information has changed (pie in the sky thought,
I have no idea how to implement it).

>            The stack frame information is not used at all by Eclipse and
> removing this part saves 70% of the execution time in our case.  Eclipse used
> the thread list IDs and the extra information which are target specific
> (usually we get thread names in these information but it can be whatever the
> targets puts)

> The solutions we thought are the following:

> Sol 1 - developping a new MI command that gives the above target extra
> information only (ie -thread-list-extra-info) of implementing a
> non-implemented one with a parameter.  I see in the doc that
> -thread-list-all-threads is not specified for instance.

> Then we need to modify Eclipse so that it uses MI command "-thread-list-ids"
> plus this command to get all he needs.  This can be an Eclipse contribution
> as well, I need to ask to Eclipse maintainer as well.

There is only a slot for -thread-list-all-threads and no implementation so I
see no harm in using a new name, especially if your command doesn't list _all_
the info.  I'm not very familiar with debugging threaded applications but I
think the command should be general and not just suited to your requirements.
Also if there is a common usage pattern then I think it would be good if that
information can be obtained with one MI command rather than two/many.  That is
the essence of many of the changes that I have made to MI.

> Sol 2 - a parameter to the "info thread" CLI command that ask gdb to not
> print stack frame information but only thread IDs lists and extra_info.
>  (ie info thread nostackframe)

I think this would be a bad idea because CLI output is for human consumption,
and someone could quite reasonably change the output later and break your
front end.  With MI the intention is to change the output in predictable and
manageable ways.

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-09-28 14:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-25 16:25 info thread Alain Magloire
  -- strict thread matches above, loose matches on Subject: below --
2006-09-28 14:35 Alain Magloire
2006-09-25 17:27 Alain Magloire
2006-09-25 17:36 ` Daniel Jacobowitz
2006-09-27 14:18 ` Denis PILAT
2006-09-25 15:25 Alain Magloire
2006-09-25 15:31 ` Daniel Jacobowitz
2006-09-18 21:49 Nick Roberts
2006-09-19 13:16 ` Denis PILAT
2006-09-19 14:23   ` Daniel Jacobowitz
2006-09-19 20:55   ` Nick Roberts
2006-09-19 21:03     ` Daniel Jacobowitz
2006-09-23 19:06       ` Mark Kettenis
2006-09-23 21:59         ` Daniel Jacobowitz
2006-09-25 14:49           ` Denis PILAT
2006-09-25 14:52             ` Daniel Jacobowitz
2006-09-25 18:39           ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox