This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Crash sourcing Python script on Windows


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]