From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8772 invoked by alias); 29 Sep 2011 01:01:42 -0000 Received: (qmail 8762 invoked by uid 22791); 29 Sep 2011 01:01:39 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausc60pc101.us.dell.com (HELO ausc60pc101.us.dell.com) (143.166.85.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Sep 2011 01:01:22 +0000 X-Loopcount0: from 10.175.216.249 From: To: , Date: Thu, 29 Sep 2011 02:00:00 -0000 Subject: RE: [RFC] Crash sourcing Python script on Windows Message-ID: <09787EF419216C41A903FD14EE5506DD03098D555B@AUSX7MCPC103.AMER.DELL.COM> References: <1317251996-12146-1-git-send-email-brobecker@adacore.com> In-Reply-To: <1317251996-12146-1-git-send-email-brobecker@adacore.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes 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-09/txt/msg00486.txt.bz2 >At long last, I forced myself to look into this. I had noticed that "sourc= e script.py" did not work on Windows, and resulted in the debugger crashing= . It turns out that the problem came from the fact that I was using a bina= ries from python.org where the definition of type FILE difers from the defi= nition our compiler uses. The crash occurs when trying to call PyRun_Simpl= eFile with a FILE created by GDB. > >The approach we took is to create a new FILE descriptor using Python routi= nes, thus making sure that the FILE is compatible with PyRun_SimpleFile. T= here were two such calls, so we wrote a wrapper to that function that only = takes a filename, and creates the FILE on the fly. This avoids code duplic= ation. That sounds like a good solution. I'm puzzled though -- how did FILE end u= p being different? One would expect the right header files to be used, pro= ducing correct/consistent results. If that didn't happen in this case, cou= ld it happen for other aspects of the GDB to Python API? paul