This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Crash sourcing Python script on Windows
- From: Tom Tromey <tromey at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 03 Oct 2011 14:01:24 -0600
- Subject: Re: [RFC] Crash sourcing Python script on Windows
- References: <1317251996-12146-1-git-send-email-brobecker@adacore.com>
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
Joel> * python/python.c (python_run_simple_file): New function.
Joel> (source_python_script, source_python_script_for_objfile):
Joel> Replace call to PyRun_SimpleFile by call to
Joel> python_run_simple_file.
It seems good to me. Some trivial nits follow.
Joel> +/* A wrapper around PyRun_SimpleFile. FILENAME is the name of
Joel> + the Python script to run.
Joel> +
Joel> + One of the parameters of PyRun_SimpleFile is a FILE *.
Joel> + The problem is that type FILE is extremely system and compiler
Joel> + dependent. So, unless the Python library has been compiled using
Joel> + the same build environment as GDB, we run the risk of getting
Joel> + a crash due to inconsistencies between the definition used by GDB,
Joel> + and the definition used by Python. A mismatch can very likely
Joel> + lead to a crash. This is particularly visible on Windows, where
Joel> + few users would build Python themselves (this is no trivial task
Joel> + on this platform), and thus use binaries built by someone else
Joel> + instead.
It would be good if this mentioned the specific case of linking against
different versions of the C runtime.
Joel> + PyObject* python_file;
Wrong "*" positioning.
Joel> + python_file = PyFile_FromString(filename_copy, "r");
Missing space before "(".
thanks,
Tom