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


Groups > comp.lang.python > #5356

Re: Python enabled gdb on Windows and relocation

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <vanboxem.ruben@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.04; 'doug': 0.04; 'sure.': 0.05; 'think,': 0.05; 'complaining': 0.07; 'e.g.,': 0.07; 'suggesting': 0.07; 'though.': 0.07; 'working:': 0.07; 'python': 0.07; '32-bit': 0.09; 'gcc': 0.09; 'initialized': 0.09; 'list)': 0.09; 'necessary,': 0.09; 'prefix': 0.09; 'prerequisite': 0.09; 'scripts': 0.10; 'configure': 0.11; 'linux': 0.11; 'am,': 0.14; 'described': 0.14; 'wrote:': 0.14; '__init__': 0.16; 'cflags': 0.16; 'example).': 0.16; 'expected.': 0.16; 'hardcoded': 0.16; 'install.': 0.16; 'should.': 0.16; '"python': 0.16; 'traceback': 0.16; 'tries': 0.16; '(most': 0.16; "wouldn't": 0.18; 'integrate': 0.19; 'skip:r 30': 0.19; 'temporary': 0.19; 'command': 0.19; 'variable': 0.21; '(or': 0.22; '(like': 0.22; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'linux,': 0.22; 'manually': 0.22; 'thu,': 0.22; 'so.': 0.22; 'trying': 0.23; "haven't": 0.23; '(without': 0.23; 'happen.': 0.23; 'last):': 0.23; 'set.': 0.23; 'wrong?': 0.23; 'version': 0.25; 'properly': 0.25; 'specify': 0.25; 'windows': 0.26; 'environment': 0.26; "i'm": 0.26; 'instead': 0.26; 'skip:b 20': 0.27; 'van': 0.27; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'thanks': 0.29; 'changing': 0.29; 'installed': 0.29; 'error': 0.29; 'problem': 0.29; 'hi,': 0.29; 'subject:Windows': 0.29; 'like.': 0.29; 'solution.': 0.29; "won't": 0.30; 'cc:addr:python.org': 0.31; 'enabled': 0.31; 'exist.': 0.31; 'exists,': 0.31; 'it.': 0.31; 'random': 0.31; 'supposed': 0.31; 'perhaps': 0.32; 'import': 0.32; 'skip:- 30': 0.32; 'another': 0.32; '(including': 0.33; 'configured': 0.33; 'minor': 0.33; "isn't": 0.34; 'skip:" 10': 0.34; 'requires': 0.35; 'there': 0.35; 'file': 0.35; 'suggestion': 0.35; 'print': 0.35; '"",': 0.35; 'change,': 0.35; 'fails': 0.35; 'option.': 0.35; 'missing': 0.36; 'think': 0.36; 'else': 0.37; 'problems': 0.37; 'some': 0.37; 'rest': 0.37; 'should': 0.37; 'received:209.85': 0.37; 'skip:- 10': 0.37; 'run': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'so,': 0.38; 'used': 0.38; 'anything': 0.38; 'cc:2**1': 0.38; 'built': 0.39; 'though,': 0.39; 'mailing': 0.39; 'set': 0.39; 'could': 0.39; 'received:209': 0.39; 'how': 0.39; 'add': 0.39; 'works': 0.40; 'basic': 0.40; 'solution': 0.40; 'would': 0.40; 'happen': 0.61; '2011': 0.62; 'link': 0.62; 'cc:no real name:2**1': 0.63; 'special': 0.66; 'skip:$ 10': 0.67; 'response.': 0.67; 'received:209.85.216.181': 0.68; 'received:mail- qy0-f181.google.com': 0.68; 'yeah.': 0.68; 'proposal': 0.68; 'below,': 0.71; 'reply-to:no real name:2**0': 0.72; 'header:Reply- To:1': 0.72; 'reply-to:addr:gmail.com': 0.78; '9:19': 0.84; 'resistance': 0.84; 'time"': 0.84; 'to:addr:google.com': 0.84; 'evans': 0.91; 'plain-text': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=kxjb8LV575zLRterSwTsgXBAEuPSHynAjdOr98Cxzeg=; b=C+U08gzm093qwwKvmFfgqBWwDdfCgKxxZ/KOZYM9SZLG6d2gjZr2gA79SZZOj3IWBF I3OZj+0Pqk9a3iL2uLSNT/ZVTDRUseZ+zYg8Fr09wVXhjfYia3t7EEy1w9oT5tH2aTqX Zr1mhuiIb6SeBUSYjoef21KuBndA6DEL8smhM=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; b=NGqS9/g+Zmgk0S4/OtVGhAg5NsBdRni+y1k2hvyCDquF0+ro751aD1cIPJ1iZKz2yU lgjZKq0Ym71d6CQ385ckSugMZg0O8mP0fn+eN3/Sfq26QFvfBuGkcEyHQV91YubfNJxd IKjuJtHWUVRpwv9pitqUo5R/foh1Z3cDj2wpQ=
MIME-Version 1.0
In-Reply-To <BANLkTi=2xwRJmHfDBULRHidJUecMi0ix+w@mail.gmail.com>
References <BANLkTikrK8DJOEpACA_uUVdZx25P5pc1tA@mail.gmail.com> <BANLkTimshMHOAnc2xtO=Vjvxg_oEZ0EUJA@mail.gmail.com> <BANLkTi=2xwRJmHfDBULRHidJUecMi0ix+w@mail.gmail.com>
Date Sat, 14 May 2011 11:09:13 +0200
Subject Re: Python enabled gdb on Windows and relocation
From Ruben Van Boxem <vanboxem.ruben@gmail.com>
To Doug Evans <dje@google.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc gdb@sourceware.org, python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To vanboxem.ruben@gmail.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1541.1305364161.9059.python-list@python.org> (permalink)
Lines 104
NNTP-Posting-Host 82.94.164.166
X-Trace 1305364162 news.xs4all.nl 81482 [::ffff:82.94.164.166]:58752
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5356

Show key headers only | View raw


2011/5/14 Doug Evans <dje@google.com>:
> On Thu, May 12, 2011 at 9:19 AM, Ruben Van Boxem
> <vanboxem.ruben@gmail.com> 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=SOME_VALUE

I was cross-compiling a mingw toolchain+gdb from Linux, so I used
--with-python without a value (because gdb configure tries to find the
Python executabe), and I added -I"/path/to/python/includes" to CFLAGS
and -L"/path/to/pythondll/importlib" to LDFLAGS, which built as it
should. This is hacky though, and gdb configure should provide
--with-python-libs and --with-python-include to make it more
streamlined with any other build prerequisite (like
gmp/mpfr/mpc/cloog/ppl in GCC for example).

>
>> 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.]

That way would be almost ideal, but a hardcoded *relative* path to the
python scripts (that is standardized within gdb) wouldn't hurt. An
extra environment variable would require a lot of explaining for
Windows, and is not "plug-and-play", like the rest of a sysrooted
toolchain is supposed to be like. I think this should work on all
setups:

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 :)
Again, this is only my suggestion, if there are problems with it in
way I haven't thought of, please say so, and we can come up with
another solution.

>
>> 2. With PYTHONPATH set as a temporary workaround, gdb starts, but
>> spits out a traceback:
>> Traceback (most recent call last):
>>   File "<string>", line 35, in <module>
>>   File "m:\development\mingw64\share\gdb/python/gdb/__init__.py", line
>> 18, in <module>
>>     gdb.command.pretty_printers.register_pretty_printer_commands()
>>   File "m:\development\mingw64\share\gdb/python/gdb\command\pretty_printers.py",
>> line 368, in register_pretty_printer_commands
>>     InfoPrettyPrinter()
>>   File "m:\development\mingw64\share\gdb/python/gdb\command\pretty_printers.py",
>> line 100, in __init__
>>     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 exist.
> I don't see how that can happen as python is initialized long after
> the info command is created.
>

Thanks for the prompt response.

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


Thread

Re: Python enabled gdb on Windows and relocation Ruben Van Boxem <vanboxem.ruben@gmail.com> - 2011-05-14 11:09 +0200

csiph-web