Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@codesourcery.com>
To: Serge CHATROUX <serge.chatroux@st.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: GDB 7.2 - Patch proposal for the use of GDB/Python scripts on MinGW
Date: Sat, 11 Sep 2010 16:34:00 -0000	[thread overview]
Message-ID: <20100910203922.GC28036@caradoc.them.org> (raw)
In-Reply-To: <A42F0F6AD104734CAC7D6B1963F60DD80116E3AF4F8A@SAFEX1MAIL2.st.com>

On Fri, Sep 10, 2010 at 03:25:45PM +0200, Serge CHATROUX wrote:
> I compile gdb 7.2 using MINGW tools and I enable the Python
> scripting support by giving the path to a Python for Windows install
> directory.

FYI, we've been building GDB for MinGW with Python support for six
months, and haven't encountered any of these problems.

I'm not surprised by the naming problems since I think our build
system rearranges the files.  But I am surprised that you had to
modify the GDB sources.

> I also modify the gdb/python sources to solve the following issues:
> 
> - Add some tests to disable Python scripting if Python is not available on the host at runtime. 
>   I detect if the PYTHONHOME variable is set. This enhancement is
>   maybe not useful for everybody.

What are you really detecting missing here?  The Python DLL must be
present; we link directly to it so GDB would not start if it wasn't.

> - I have to modify some gdb python files because the files 'python-function.c', python-cmd.c (...) define some 'static PyTypeObject'.
>   The field 'tp_new' of these static variables is statically initialized with the python 'PyType_GenericNew' function. 
>   In Windows port of Python, this function is declared as a dllimport one and cannot be copied at compilation time in a static variable.
>   For these files, I modified the source code
>       - to initialize the 'tp_new' fields to '0' in the static variables and
>       - to affect the proper 'PyType_GenericNew' value in the 'gdbpy_initialize_commands', 'gdbpy_initialize_frames' (...). 

This is the one that particularly puzzles me, we didn't have this problem.

> - When sourcing a Python script using 'source file.py' command, we cannot use 'PyRun_SimpleFile' because Python may not be compiled using the same MSVCRT DLL than GDB, so the FILE* stream will not be known in this DLL.
>   This generates an error when the MSVCRT will try to lock the file handle.

We did encounter this one; we solved it by making sure that GDB used
the same MSVCRT DLL.  But that solution is definitely not for
everyone, and I'd be happy enough to see GDB avoid this problem.



-- 
Daniel Jacobowitz
CodeSourcery


      parent reply	other threads:[~2010-09-10 20:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-10 13:58 Serge CHATROUX
2010-09-10 15:47 ` Tom Tromey
2010-09-13 17:09   ` Christophe Lyon
2010-09-13 17:41     ` Serge CHATROUX
2010-09-13 19:15       ` Tom Tromey
2010-09-17 14:42         ` Serge CHATROUX
2010-09-21 22:50           ` Tom Tromey
2010-09-11 16:34 ` Daniel Jacobowitz [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=20100910203922.GC28036@caradoc.them.org \
    --to=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=serge.chatroux@st.com \
    /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