From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8482 invoked by alias); 14 May 2011 18:38:33 -0000 Received: (qmail 8473 invoked by uid 22791); 14 May 2011 18:38:33 -0000 X-SWARE-Spam-Status: No, hits=-1.9 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) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 May 2011 18:38:19 +0000 Received: from kpbe12.cbf.corp.google.com (kpbe12.cbf.corp.google.com [172.25.105.76]) by smtp-out.google.com with ESMTP id p4EIcI28023251 for ; Sat, 14 May 2011 11:38:18 -0700 Received: from yxa15 (yxa15.prod.google.com [10.190.1.15]) by kpbe12.cbf.corp.google.com with ESMTP id p4EIcHb2019048 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sat, 14 May 2011 11:38:17 -0700 Received: by yxa15 with SMTP id 15so1550614yxa.23 for ; Sat, 14 May 2011 11:38:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.91.35.33 with SMTP id n33mr2182455agj.126.1305398297036; Sat, 14 May 2011 11:38:17 -0700 (PDT) Received: by 10.90.72.6 with HTTP; Sat, 14 May 2011 11:38:16 -0700 (PDT) In-Reply-To: <83ei41fx4a.fsf@gnu.org> References: <83ei41fx4a.fsf@gnu.org> Date: Sat, 14 May 2011 18:38:00 -0000 Message-ID: Subject: Re: Python enabled gdb on Windows and relocation From: Doug Evans To: Eli Zaretskii Cc: vanboxem.ruben@gmail.com, 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/msg00062.txt.bz2 On Sat, May 14, 2011 at 2:29 AM, Eli Zaretskii wrote: >> Date: Sat, 14 May 2011 11:09:13 +0200 >> From: Ruben Van Boxem >> Cc: gdb@sourceware.org, python-list@python.org >> >> 1. Check hardcoded path; my suggestion would be "/../lib= /python27" >> 2. If this fails to find the necessary files/scripts, find it like you >> described above in Linux, without PYTHONPATH set. >> 3. Check PYTHONPATH. >> >> I would think only number one would change, and perhaps be only >> enabled with a special configure option. Nothing else would have to >> change, and Windows users would rejoice :) > > The problem, I think, is that it's not so easy on Unix to get the > place where the GDB executable leaves. =A0There isn't a system call to > do that (similar to what Windows gives you). > > So I think on Posix platforms, number 2 would be used most of the > time. For reference sake, gdb is "relocatable". [meaning, if you take a gdb installation and move it, it should continue to work fine] And if gdb's python lives inside the gdb tree, that too should continue to work fine if moved with gdb (the value to pass to Py_SetProgramName is appropriately (re-)computed when gdb is run). [For completeness sake, IIRC the calculation of a path being "relocatable" isn't bulletproof, but it works in practice.] It's not impossible for gdb to find where it lives, but you're right it can be moderately difficult (basically, if argv[0] isn't an absolute path then scan $PATH for it).