public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: quentin sabah <quentin.sabah@gmail.com>
To: gdb@sourceware.org
Subject: Re: how to get last created inferior, python api
Date: Wed, 22 Apr 2015 11:39:00 -0000	[thread overview]
Message-ID: <CAJoex3PTd2a_uqYgrzLwtKafQ8p2KT-=Qff3qbmEYC6jKDJZiw@mail.gmail.com> (raw)
In-Reply-To: <CADPb22T-y6RydUGrKXOgUQeDZc-k85_7cTbFTz-U23qzgWCT6w@mail.gmail.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 <dje@google.com>:
> On Sun, Apr 19, 2015 at 4:36 AM, quentin sabah <quentin.sabah@gmail.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.
>
> Hi.
> I can't think of a different way.



-- 
Quentin Sabah
06 07 967 367

      parent reply	other threads:[~2015-04-22 11:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-19 11:36 quentin sabah
     [not found] ` <CADPb22T-y6RydUGrKXOgUQeDZc-k85_7cTbFTz-U23qzgWCT6w@mail.gmail.com>
2015-04-22 11:39   ` quentin sabah [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJoex3PTd2a_uqYgrzLwtKafQ8p2KT-=Qff3qbmEYC6jKDJZiw@mail.gmail.com' \
    --to=quentin.sabah@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).