public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Loop over threads in python
       [not found] <CA++fsGEES6rmeqWK9C5nyKH30+agT5ie+cY5tXMKpCx_0Cokhg@mail.gmail.com>
@ 2012-06-04  6:40 ` Dov Grobgeld
  2012-06-04 17:40   ` Tim Black
  0 siblings, 1 reply; 4+ messages in thread
From: Dov Grobgeld @ 2012-06-04  6:40 UTC (permalink / raw)
  To: gdb

Hello,

I would like to write a python command that lists all threads (of a
C++ program) that in its call path has a function matching a user
specified pattern.

To do that I have to iterate over all the threads. But I couldn't find
such a python API. Do I currently have to resort to using gdb commands
and parsing the output myself?

Thanks!
Dov

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

* Re: Loop over threads in python
  2012-06-04  6:40 ` Loop over threads in python Dov Grobgeld
@ 2012-06-04 17:40   ` Tim Black
  2012-06-05  5:28     ` Dov Grobgeld
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Black @ 2012-06-04 17:40 UTC (permalink / raw)
  To: gdb

This article gives a good overview of driving gdb with python and
answers your question: http://www.linuxjournal.com/article/11027

On Sun, Jun 3, 2012 at 11:40 PM, Dov Grobgeld <dov.grobgeld@gmail.com> wrote:
> Hello,
>
> I would like to write a python command that lists all threads (of a
> C++ program) that in its call path has a function matching a user
> specified pattern.
>
> To do that I have to iterate over all the threads. But I couldn't find
> such a python API. Do I currently have to resort to using gdb commands
> and parsing the output myself?
>
> Thanks!
> Dov

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

* Re: Loop over threads in python
  2012-06-04 17:40   ` Tim Black
@ 2012-06-05  5:28     ` Dov Grobgeld
  2012-06-06 18:11       ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Dov Grobgeld @ 2012-06-05  5:28 UTC (permalink / raw)
  To: Tim Black; +Cc: gdb

Great! This is exactly what I needed. The documentation is really lacking.

Meanwhile I put together a "threadgrep" command yesterday by using
gdb.execute() and string parsing.

If someone is interested it may be gotten from:

https://github.com/dov/dov-env/blob/master/gdb/pythreadgrep.py

Regards,
Dov

On Mon, Jun 4, 2012 at 8:40 PM, Tim Black <timblaktu@gmail.com> wrote:
>
> This article gives a good overview of driving gdb with python and
> answers your question: http://www.linuxjournal.com/article/11027
>
> On Sun, Jun 3, 2012 at 11:40 PM, Dov Grobgeld <dov.grobgeld@gmail.com> wrote:
> > Hello,
> >
> > I would like to write a python command that lists all threads (of a
> > C++ program) that in its call path has a function matching a user
> > specified pattern.
> >
> > To do that I have to iterate over all the threads. But I couldn't find
> > such a python API. Do I currently have to resort to using gdb commands
> > and parsing the output myself?
> >
> > Thanks!
> > Dov

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

* Re: Loop over threads in python
  2012-06-05  5:28     ` Dov Grobgeld
@ 2012-06-06 18:11       ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2012-06-06 18:11 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: Tim Black, gdb

>>>>> "Dov" == Dov Grobgeld <dov.grobgeld@gmail.com> writes:

Dov> Great! This is exactly what I needed. The documentation is really
Dov> lacking.

Please file bugs against the python component with any suggestions you
have.  We'd like to improve the documentation, but generally those of us
working on the Python support don't see the holes, as it were.
File bugs liberally -- it is better to over-file than under-file.

Tom

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

end of thread, other threads:[~2012-06-06 18:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CA++fsGEES6rmeqWK9C5nyKH30+agT5ie+cY5tXMKpCx_0Cokhg@mail.gmail.com>
2012-06-04  6:40 ` Loop over threads in python Dov Grobgeld
2012-06-04 17:40   ` Tim Black
2012-06-05  5:28     ` Dov Grobgeld
2012-06-06 18:11       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).