From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19119 invoked by alias); 12 May 2011 16:20:41 -0000 Received: (qmail 19094 invoked by uid 22791); 12 May 2011 16:20:39 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-qw0-f41.google.com (HELO mail-qw0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 May 2011 16:19:56 +0000 Received: by qwa26 with SMTP id 26so1225101qwa.0 for ; Thu, 12 May 2011 09:19:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.67.37 with SMTP id p37mr313403qci.238.1305217195991; Thu, 12 May 2011 09:19:55 -0700 (PDT) Received: by 10.229.250.66 with HTTP; Thu, 12 May 2011 09:19:55 -0700 (PDT) Reply-To: vanboxem.ruben@gmail.com In-Reply-To: References: Date: Thu, 12 May 2011 16:20:00 -0000 Message-ID: Subject: Python enabled gdb on Windows and relocation From: Ruben Van Boxem To: gdb@sourceware.org, python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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/msg00052.txt.bz2 (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. 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. What I suggest is perhaps a Windows only change: a kind of "sysroot"ed gdb+python, so that the python used by gdb is truly built in. I cannot require everyone using my toolchain to install the correct python version for obvious reasons (Windows !=3D Linux in this regard). However way this is tackled, the gdb I want should look relative to it's current (relocatable) directory for Python modules/*;py files in a well-defined directory at build time. That would allow me to distribute gdb in a very clear way: /bin /bin/python27.dll /bin/gdb.exe /lib /lib/python27 /lib/python27/ Currently, this scheme only works if I manually set the PYTHONPATH environment variable to /lib/python27. This global environment variable could conflict with existing Python installations, that may have another bitness (I have 64- and 32-bit toolchains). I think you can see there are problems enough with the current set up. I also read this old discussion: http://comments.gmane.org/gmane.comp.gdb.patches/62811 that might imply that the PYTHONPATH check is something built-in to the python dll. Can anyone shed some light on this? 2. With PYTHONPATH set as a temporary workaround, gdb starts, but spits out a traceback: Traceback (most recent call last): =C2=A0 File "", line 35, in =C2=A0 File "m:\development\mingw64\share\gdb/python/gdb/__init__.py", line 18, in =C2=A0=C2=A0=C2=A0 gdb.command.pretty_printers.register_pretty_printer_comm= ands() =C2=A0 File "m:\development\mingw64\share\gdb/python/gdb\command\pretty_pri= nters.py", line 368, in register_pretty_printer_commands =C2=A0=C2=A0=C2=A0 InfoPrettyPrinter() =C2=A0 File "m:\development\mingw64\share\gdb/python/gdb\command\pretty_pri= nters.py", line 100, in __init__ =C2=A0=C2=A0=C2=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? Thanks very much! Ruben PS: I've sent this to both the gdb and python mailing lists, as these issues have a large overlap to both projects. PS2: Please reply-to-all as I do not want daily mails from both mailing lists on every issue brought up there. My apologies.