From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34623 invoked by alias); 22 Apr 2015 11:39:06 -0000 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 Received: (qmail 34602 invoked by uid 89); 22 Apr 2015 11:39:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f179.google.com Received: from mail-ig0-f179.google.com (HELO mail-ig0-f179.google.com) (209.85.213.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 22 Apr 2015 11:39:04 +0000 Received: by igblo3 with SMTP id lo3so110040970igb.1 for ; Wed, 22 Apr 2015 04:39:02 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.1.47 with SMTP id 15mr3784090igj.40.1429702742211; Wed, 22 Apr 2015 04:39:02 -0700 (PDT) Received: by 10.64.74.70 with HTTP; Wed, 22 Apr 2015 04:39:02 -0700 (PDT) In-Reply-To: References: Date: Wed, 22 Apr 2015 11:39:00 -0000 Message-ID: Subject: Re: how to get last created inferior, python api From: quentin sabah To: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00048.txt.bz2 Reading the source of GDB, I noticed that inferiors are given a number from a global counter in add_inferior_silent(). So I guess looking for the inferior with the highest number is equivalent to looking for the last created inferior. 2015-04-20 21:38 GMT+02:00 Doug Evans : > On Sun, Apr 19, 2015 at 4:36 AM, quentin sabah wrote: >> Hi, I have been using gdb for many years and I am just starting to use >> the python api. >> I am wondering if there is a simple way to retrieve the last created >> inferior using the python api. >> >> Currently (gdb 7.7) I can create a new inferior with >> gdb.execute("add-inferior"). There is no value returned, just a >> messages printed in the CLI ("Added inferior N"). >> >> The only way that I can think of, is to call gdb.inferiors() before >> and after creating a new one, and then compare the two lists to find >> the new inferior. > > Hi. > I can't think of a different way. -- Quentin Sabah 06 07 967 367