This is the mail archive of the
mailing list for the GDB project.
Re: how to get last created inferior, python api
- From: quentin sabah <quentin dot sabah at gmail dot com>
- To: gdb at sourceware dot org
- Date: Wed, 22 Apr 2015 13:39:02 +0200
- Subject: Re: how to get last created inferior, python api
- Authentication-results: sourceware.org; auth=none
- References: <CAJoex3O_3YdA+Uga3unraoPxBnJBQGjW0uki2eRW-88PP9vu2A at mail dot gmail dot com> <CADPb22T-y6RydUGrKXOgUQeDZc-k85_7cTbFTz-U23qzgWCT6w at mail dot gmail dot com>
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 <firstname.lastname@example.org>:
> On Sun, Apr 19, 2015 at 4:36 AM, quentin sabah <email@example.com> 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.
> I can't think of a different way.
06 07 967 367