Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Taisuke Yamada <tai@rakugaki.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] sys.argv and ipython (interactive python) support in GDB/Python
Date: Fri, 01 Jul 2011 10:59:00 -0000	[thread overview]
Message-ID: <m3ei2a467u.fsf@redhat.com> (raw)
In-Reply-To: <BANLkTi=36=aFZPsBDJacOWvh-2Pk7OHKfQ@mail.gmail.com> (Taisuke	Yamada's message of "Fri, 1 Jul 2011 13:00:27 +0900")

Taisuke Yamada <tai@rakugaki.org> writes:

Thanks for the patch!

> diff --git a/gdb/python/python.c b/gdb/python/python.c
> index 90d5dc8..c9f2ce9 100644
> --- a/gdb/python/python.c
> +++ b/gdb/python/python.c
> @@ -1010,7 +1010,9 @@ Enables or disables printing of Python stack traces."),
>  			     SLASH_STRING, "python", NULL));
>  #endif
>  
> +  char *argv[] = { "gdb", NULL };

As Kevin noted, this needs to be placed in the declarations part of the
function.

>    Py_Initialize ();
> +  PySys_SetArgvEx (1, argv, 0);

This can throw an error.  Though, it seems unlikely it would.  I'm also
a little confused about the documentation about PySys_SetArgvEx.  

"These parameters are similar to those passed to the program's
main() function with the difference that the first entry should refer to
the script file to be executed rather than the executable hosting the
Python interpreter. If there isn't a script that will be run,
the first entry in argv can be an empty string. If this function fails
to initialize sys.argv, a fatal condition is signalled using
Py_FatalError()."

Isn't your first argument of argv the executable GDB?

I should know this, but the documentation notes "New in version
2.6.6".  I think we support 2.6.6, but one of the maintainers would have
to reply here.

Lastly, even though this patch is about two lines, I believe it is not a
trivial change, and probably needs a ChangeLog entry.

Cheers,

Phil


  parent reply	other threads:[~2011-07-01 10:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01  4:00 Taisuke Yamada
     [not found] ` <BANLkTimcWKLMOkd0R8bNT-z4yqr0FJ_uog@mail.gmail.com>
2011-07-01 10:31   ` Kevin Pouget
2011-07-01 10:59 ` Phil Muldoon [this message]
2011-07-01 14:10   ` Taisuke Yamada
2011-07-01 14:14     ` Phil Muldoon
2011-07-01 14:34   ` Tom Tromey
2011-07-01 14:27 ` Tom Tromey

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=m3ei2a467u.fsf@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tai@rakugaki.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