From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24776 invoked by alias); 14 May 2011 06:39:19 -0000 Received: (qmail 24767 invoked by uid 22791); 14 May 2011 06:39:18 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 May 2011 06:39:04 +0000 Received: from hpaq5.eem.corp.google.com (hpaq5.eem.corp.google.com [172.25.149.5]) by smtp-out.google.com with ESMTP id p4E6d2IC026173 for ; Fri, 13 May 2011 23:39:02 -0700 Received: from yia25 (yia25.prod.google.com [10.243.65.25]) by hpaq5.eem.corp.google.com with ESMTP id p4E6d0PA031656 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 13 May 2011 23:39:01 -0700 Received: by yia25 with SMTP id 25so1332188yia.40 for ; Fri, 13 May 2011 23:39:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.91.218.17 with SMTP id v17mr2070343agq.18.1305355140028; Fri, 13 May 2011 23:39:00 -0700 (PDT) Received: by 10.90.72.6 with HTTP; Fri, 13 May 2011 23:38:59 -0700 (PDT) In-Reply-To: References: Date: Sat, 14 May 2011 06:39:00 -0000 Message-ID: Subject: Re: Python enabled gdb on Windows and relocation From: Doug Evans To: vanboxem.ruben@gmail.com Cc: gdb@sourceware.org, python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00057.txt.bz2 On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem wrote: > (now in plain-text as required by gdb mailing list) > > Hi, > > I am currently trying to integrate Python support into my toolchain > build (including GDB of course). It is a sysrooted > binutils+GCC+GDB+mingw-w64 toolchain. > > I currently have the basic setup working: I can link gdb with my > manually generated import lib to the python dll from the official > Windows install. If there is anything I am missing or a very easy > solution to the problems decsribed below, please just say so. I am > only suggesting what I would like to happen. > > Now on to the problems I'd like to discuss: > > 1. gdb.exe won't start without me having set PYTHONPATH manually. In a properly configured/built gdb on linux this isn't necessary, even if python is installed in some random place. I'm not sure about windows though. Did you specify --with-python when you configured gdb, and if so did you specify a value? e.g., --with-python=3DSOME_VALUE > I understand the need for this, but as gdb requires Python 2, and users > of my toolchain may have installed Python 3 or a 32-bit version python > they want to use from the same environment (without changing their own > PYTHONPATH), there is no way to run python-enabled gdb. > [...] Yeah. There is a proposal to add GDB_PYTHONPATH (or some such IIRC) and have gdb use that instead of PYTHONPATH if it exists, but there's been resistance to it. I think(!) what would happen is that gdb would set $PYTHONPATH to the value of $GDB_PYTHONPATH. [Inferiors started by gdb should still get the original value of PYTHONPATH though.] > 2. With PYTHONPATH set as a temporary workaround, gdb starts, but > spits out a traceback: > Traceback (most recent call last): > =A0 File "", line 35, in > =A0 File "m:\development\mingw64\share\gdb/python/gdb/__init__.py", line > 18, in > =A0=A0=A0 gdb.command.pretty_printers.register_pretty_printer_commands() > =A0 File "m:\development\mingw64\share\gdb/python/gdb\command\pretty_prin= ters.py", > line 368, in register_pretty_printer_commands > =A0=A0=A0 InfoPrettyPrinter() > =A0 File "m:\development\mingw64\share\gdb/python/gdb\command\pretty_prin= ters.py", > line 100, in __init__ > =A0=A0=A0 gdb.COMMAND_DATA) > RuntimeError: Could not find command prefix info. > > This is a minor problem I think, as "python import time" "python print > time.clock()" works as expected. What is wrong? I'm not sure. The error message is complaining that the "info" command prefix doesn't exi= st. I don't see how that can happen as python is initialized long after the info command is created.