From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22655 invoked by alias); 3 Oct 2011 20:02:05 -0000 Received: (qmail 22646 invoked by uid 22791); 3 Oct 2011 20:02:04 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 Oct 2011 20:01:47 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p93K1PZI003153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Oct 2011 16:01:25 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p93K1Pxo026575; Mon, 3 Oct 2011 16:01:25 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p93K1OCM023878; Mon, 3 Oct 2011 16:01:24 -0400 From: Tom Tromey To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Crash sourcing Python script on Windows References: <1317251996-12146-1-git-send-email-brobecker@adacore.com> Date: Mon, 03 Oct 2011 20:02:00 -0000 In-Reply-To: <1317251996-12146-1-git-send-email-brobecker@adacore.com> (Joel Brobecker's message of "Wed, 28 Sep 2011 16:19:56 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00045.txt.bz2 >>>>> "Joel" == Joel Brobecker 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