public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Ruben Van Boxem <vanboxem.ruben@gmail.com>
To: gdb@sourceware.org, python-list@python.org
Subject: Python enabled gdb on Windows and relocation
Date: Thu, 12 May 2011 16:20:00 -0000	[thread overview]
Message-ID: <BANLkTimshMHOAnc2xtO=Vjvxg_oEZ0EUJA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikrK8DJOEpACA_uUVdZx25P5pc1tA@mail.gmail.com>

(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 != 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:

<sysroot>
<sysroot>/bin
<sysroot>/bin/python27.dll
<sysroot>/bin/gdb.exe
<sysroot>/lib
<sysroot>/lib/python27
<sysroot>/lib/python27/<all *.py files from the official windows install>

Currently, this scheme only works if I manually set the PYTHONPATH
environment variable to <root>/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):
  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?

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.

       reply	other threads:[~2011-05-12 16:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTikrK8DJOEpACA_uUVdZx25P5pc1tA@mail.gmail.com>
2011-05-12 16:20 ` Ruben Van Boxem [this message]
2011-05-14  6:39   ` Doug Evans
2011-05-14  9:09     ` Ruben Van Boxem
2011-05-14  9:30       ` Eli Zaretskii
2011-05-14 10:10         ` Ruben Van Boxem
2011-05-14 18:38         ` Doug Evans
2011-05-14 18:31       ` Doug Evans
2011-05-14 18:40         ` Doug Evans
2011-05-15 12:30         ` Ruben Van Boxem
2011-05-15 13:27           ` Ruben Van Boxem
2011-05-15 16:12             ` Ruben Van Boxem
2011-05-17 16:32               ` Ruben Van Boxem
2011-05-17 20:52               ` Doug Evans
2011-06-09  2:04               ` Asm warrior
     [not found]                 ` <BANLkTimfNgaKWbZdN-YVz9Vs2UW6vKsfiQ@mail.gmail.com>
2011-06-09 12:09                   ` Ruben Van Boxem
2011-05-17 20:36             ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTimshMHOAnc2xtO=Vjvxg_oEZ0EUJA@mail.gmail.com' \
    --to=vanboxem.ruben@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=python-list@python.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).