From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68702 invoked by alias); 24 Feb 2017 10:37:53 -0000 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 Received: (qmail 68671 invoked by uid 89); 24 Feb 2017 10:37:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=courses, wheel, sk:josema, josemarchesioraclecom X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Feb 2017 10:37:49 +0000 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2017 02:37:48 -0800 X-ExtLoop1: 1 Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by fmsmga006.fm.intel.com with ESMTP; 24 Feb 2017 02:37:47 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.38]) by IRSMSX152.ger.corp.intel.com ([169.254.6.191]) with mapi id 14.03.0248.002; Fri, 24 Feb 2017 10:37:47 +0000 From: "Wiederhake, Tim" To: Yao Qi , "Jose E. Marchesi" CC: "gdb-patches@sourceware.org" Subject: RE: MemoryView missing from Python 2.4 and 2.6 Date: Fri, 24 Feb 2017 10:37:00 -0000 Message-ID: <9676A094AF46E14E8265E7A3F4CCE9AF9417D1@irsmsx105.ger.corp.intel.com> References: <87o9xsx38r.fsf@oracle.com> <20170223225946.snir4ab6twc7vo7n@localhost> In-Reply-To: <20170223225946.snir4ab6twc7vo7n@localhost> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00674.txt.bz2 Hi all! It seems like indeed my code is incompatible with Python 2.4, which accordi= ng to the README file is still supported by GDB. My understanding (correct me if I'm wrong) is that in Python there is the "old style buffer API", the "new style buffer api" and "memory views". From: https://docs.python.org/2.7/c-api/buffer.html: - "old style buffer API": Deprecated in 2.7, removed in 3.0 - "new style buffer API": Introduced in 3.0, backported to 2.6 - "memory view": Introduced in 3.0, backported to 2.7 (used bypy_record_bt= race) That means that there is no buffer API that covers the complete range of Py= thon versions that are supported by GDB (2.4 to 3.x). This leaves us with four possible courses of action: 1) Drop the support for Python 2.4, 2.5, 2.6, 3.0, 3.1 and 3.2, making GDB support "Versions 2.7 and >=3D 3.3". Rationale: According to https://docs.python.org/devguide/index.html#branchstatus these versions are end-of-life'd and do not receive any security patches anymore: Version Released End-of-life 3.2 2011-02-20 2016-02-20 3.1 2009-06-27 2012-04-11 3.0 2008-12-03 2009-01-13 2.6 2008-10-01 2013-10-29 (Versions < 2.6 are not even listed any more on that page.) This would fix the situation immediately but annoy Jose. 2) Refactor "gdb.Membuf" from python/py-inferior.c into its own file and use that. I don't like this idea too much because it is basically reinventing t= he wheel and gdb.Membuf is less versatile than build-in buffers, strings, etc. 3) Use the "new style buffer API" and limit GDB's support to Python >=3D 2.= 6. In this case we would have to limit the supported Python versions anyway so on the one hand there is not much reason to not throw out 2.6 as well. On t= he other hand, there still seem to be some Python 2.6 users. 4) Return a string in "gdb.BtraceInstruction.data ()". The instruction data= can potentially contain null bytes which can cause issues for obvious reasons. Regards, Tim > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Yao Qi > Sent: Friday, February 24, 2017 12:00 AM > To: Jose E. Marchesi ; Wiederhake, Tim > > Cc: gdb-patches@sourceware.org; Metzger, Markus T > > Subject: Re: MemoryView missing from Python 2.4 and 2.6 >=20 > On 17-02-23 17:48:20, Jose E. Marchesi wrote: > > While building git GDB on a certain distribution that features Python > > 2.6.6 (I know, ancient) we triggered a build failure: > > > > g++ -g -O2 -I. -I../../gdb -I../../gdb/common -I../../gdb/config - > DLOCALEDIR=3D"\"/usr/local/share/locale\"" -DHAVE_CONFIG_H - > I../../gdb/../include/opcode -I../../gdb/../opcodes/.. -I../../gdb/../rea= dline/.. > -I../../gdb/../zlib -I../bfd -I../../gdb/../bfd -I../../gdb/../include - > I../libdecnumber -I../../gdb/../libdecnumber -I../../gdb/gnulib/import - > Ibuild-gnulib/import -DTUI=3D1 -I/usr/include/python2.6 - > I/usr/include/python2.6 -Wall -Wpointer-arith -Wno-unused -Wunused- > value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body > -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign- > compare -Wno-write-strings -Wno-narrowing -Wformat-nonliteral -Werror -c > -o py-record-btrace.o -MT py-record-btrace.o -MMD -MP -MF .deps/py- > record-btrace.Tpo -fno-strict-aliasing -DNDEBUG -fwrapv > ../../gdb/python/py-record-btrace.c > > ../../gdb/python/py-record-btrace.c: In function ???PyObject* > btpy_insn_data(PyObject*, void*)???: > > ../../gdb/python/py-record-btrace.c:333:10: error: > ???PyMemoryView_FromObject??? was not declared in this scope > > return PyMemoryView_FromObject (object); > > ^~~~~~~~~~~~~~~~~~~~~~~ > > ../../gdb/python/py-record-btrace.c:333:10: note: suggested alternative: > ???PyBuffer_FromObject??? > > return PyMemoryView_FromObject (object); > > ^~~~~~~~~~~~~~~~~~~~~~~ > > PyBuffer_FromObject > > make: *** [py-record-btrace.o] Error 1 > > > > Looks like the Memory View object was introduced in Python 2.7. >=20 > Hi Tim, > Could you take a look? >=20 > -- > Yao Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928