From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20250 invoked by alias); 17 May 2011 20:52:32 -0000 Received: (qmail 20242 invoked by uid 22791); 17 May 2011 20:52:32 -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; Tue, 17 May 2011 20:52:17 +0000 Received: from hpaq6.eem.corp.google.com (hpaq6.eem.corp.google.com [172.25.149.6]) by smtp-out.google.com with ESMTP id p4HKqGZt011080 for ; Tue, 17 May 2011 13:52:16 -0700 Received: from gwb11 (gwb11.prod.google.com [10.200.2.11]) by hpaq6.eem.corp.google.com with ESMTP id p4HKqEWv015692 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 17 May 2011 13:52:14 -0700 Received: by gwb11 with SMTP id 11so362899gwb.20 for ; Tue, 17 May 2011 13:52:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.91.218.17 with SMTP id v17mr878353agq.18.1305665533769; Tue, 17 May 2011 13:52:13 -0700 (PDT) Received: by 10.90.72.6 with HTTP; Tue, 17 May 2011 13:52:13 -0700 (PDT) In-Reply-To: References: Date: Tue, 17 May 2011 20:52:00 -0000 Message-ID: Subject: Re: Python enabled gdb on Windows and relocation From: Doug Evans To: vanboxem.ruben@gmail.com Cc: 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/msg00083.txt.bz2 On Sun, May 15, 2011 at 9:11 AM, Ruben Van Boxem wrote: > I am sorry for the repeated messages that no one cares about, but I > may have discovered GDB in its current form already allows what I > want: I tried to figure out what exact paths the snake in gdb was > using to search for its modules, and came up with this: > (gdb) python import sys > (gdb) python print sys.path > ['m:\\development\\mingw64\\share\\gdb/python', > 'M:\\Development\\mingw64\\bin\\python27.zip', > 'M:\\Development\\mingw64\\bin\\DLLs', > 'M:\\Development\\mingw64\\bin\\lib', > 'M:\\Development\\mingw64\\bin\\lib\\plat-win', > 'M:\\Development\\mingw64\\bin\\lib\\lib-tk', > 'M:\\Development\\mingw64\\bin', > 'M:\\Development\\mingw64\\bin\\lib\\site-packages'] > > This means that every python command within gdb searches > /share/gdb/python FIRST (even before an environment's > PYTHONPATH), alleviating any concerns or problems I or anyone would > have with another python installation, as this apparently built-in > path comes up first. All I, or anyone interested in doing this kind of > thing, have to do is copy all the python scripts from the Windows > installation's Lib directory to the /share/gdb/python > directory. > > I don't know where this path comes from, but it is quite handy, and > makes this whole discussion =A0moot for Python people. Only "issue" that > I'll have to work around is the --with-python-includes and > --with-python-libs that are missing, using either manual > CFLAGS/LDFLAGS or a variant of your script. IMO *if* gdb wanted to support people adding files to *its* /share/gdb directory, more thought is needed - e.g. maybe document a "site" directory for such files. Dunno. IMO we certainly don't want to formally allow folks to willy-nilly put anything there - no guarantees a future release might add something that collides with something the user put there. If and until then, you're probably pretty safe if you put everything in a subdirectory with a unique enough name, if you really wanted to go this route. Btw, there is the system.gdbinit file which sites *are* free to customize. E.g., configure --with-system-gdbinit=3D/share/gdb/system.gdbinit. You can put whatever you want in that file. E.g., you could add a directory to python's sys.path. [Technically speaking, the path /share/gdb/system.gdbinit goes against what I just said, but IMO this name is safe.]