From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31408 invoked by alias); 12 Jan 2012 00:54:33 -0000 Received: (qmail 31365 invoked by uid 22791); 12 Jan 2012 00:54:32 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from router-304.cs.umd.edu (HELO bacon.cs.umd.edu) (128.8.127.145) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jan 2012 00:54:19 +0000 Received: from [192.168.32.3] (pool-71-163-241-15.washdc.fios.verizon.net [71.163.241.15]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 548FCB4015D; Wed, 11 Jan 2012 19:54:17 -0500 (EST) Subject: Re: Make the "python" command resemble the standard Python interpreter Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Khoo Yit Phang In-Reply-To: Date: Thu, 12 Jan 2012 03:07:00 -0000 Cc: Khoo Yit Phang , gdb-patches@sourceware.org Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Tom Tromey X-CSD-MailScanner-ID: 548FCB4015D.AF415 X-CSD-MailScanner: Found to be clean X-CSD-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-50, required 5, autolearn=not spam, ALL_TRUSTED -50.00) X-CSD-MailScanner-From: khooyp@cs.umd.edu X-CSD-MailScanner-Watermark: 1326934457.49642@d6g+q2ueb72k1W/Y+r/7rw 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: 2012-01/txt/msg00390.txt.bz2 Hi, On Jan 11, 2012, at 3:51 PM, Tom Tromey wrote: > Yit> + m =3D PyImport_AddModule ("__main__"); > Yit> + if (m =3D=3D NULL) > Yit> + error (_("Error while executing Python code.")); >=20 > You have to do something with the Python exception here. > Usually we use gdbpy_print_stack, but sometimes other things are > appropriate. >=20 > Yit> + v =3D PyRun_StringFlags (command, > Yit> + from_tty ? Py_single_input : Py_file_input, > Yit> + d, d, NULL); > Yit> + if (v =3D=3D NULL) > Yit> + { > Yit> + int interrupt =3D PyErr_ExceptionMatches (PyExc_KeyboardInter= rupt); > Yit> + PyErr_Print (); >=20 > gdbpy_print_stack. I've ran the testsuite, and of course, there were many test failures, proba= bly spurious and I'll update. However, a number of errors turn out to be du= e to adding gdbpy_print_stack, because the original lines of code that I re= placed (python:249 and python.c:273) simply called error like: if (PyRun_SimpleString (arg)) error (_("Error while executing Python code.")); Should I defer your suggested change to a separate patch? Yit January 11, 2012