Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5378

Re: Python enabled gdb on Windows and relocation

References <BANLkTikrK8DJOEpACA_uUVdZx25P5pc1tA@mail.gmail.com> <BANLkTimshMHOAnc2xtO=Vjvxg_oEZ0EUJA@mail.gmail.com> <BANLkTi=2xwRJmHfDBULRHidJUecMi0ix+w@mail.gmail.com> <BANLkTinkEF5RUwDr=29c_QBdu=abcGNNCQ@mail.gmail.com> <83ei41fx4a.fsf@gnu.org>
Date 2011-05-14 11:38 -0700
Subject Re: Python enabled gdb on Windows and relocation
From Doug Evans <dje@google.com>
Newsgroups comp.lang.python
Message-ID <mailman.1555.1305398301.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, May 14, 2011 at 2:29 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Sat, 14 May 2011 11:09:13 +0200
>> From: Ruben Van Boxem <vanboxem.ruben@gmail.com>
>> Cc: gdb@sourceware.org, python-list@python.org
>>
>> 1. Check hardcoded path; my suggestion would be "<gdb executable>/../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.  There 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).

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python enabled gdb on Windows and relocation Doug Evans <dje@google.com> - 2011-05-14 11:38 -0700

csiph-web