From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8173 invoked by alias); 5 Jun 2012 05:28:31 -0000 Received: (qmail 8161 invoked by uid 22791); 5 Jun 2012 05:28:29 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ob0-f169.google.com (HELO mail-ob0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Jun 2012 05:28:17 +0000 Received: by obbwd18 with SMTP id wd18so10247040obb.0 for ; Mon, 04 Jun 2012 22:28:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.14.9 with SMTP id l9mr14474219oec.17.1338874096401; Mon, 04 Jun 2012 22:28:16 -0700 (PDT) Received: by 10.182.33.42 with HTTP; Mon, 4 Jun 2012 22:28:16 -0700 (PDT) In-Reply-To: References: Date: Tue, 05 Jun 2012 05:28:00 -0000 Message-ID: Subject: Re: Loop over threads in python From: Dov Grobgeld To: Tim Black Cc: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00024.txt.bz2 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 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 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