From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18937 invoked by alias); 20 May 2010 18:40:21 -0000 Received: (qmail 18852 invoked by uid 22791); 20 May 2010 18:40:19 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 May 2010 18:40:15 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 028602BABA6 for ; Thu, 20 May 2010 14:40:11 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id QTXm9M28vNAS for ; Thu, 20 May 2010 14:40:11 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id BE8E72BAB2F for ; Thu, 20 May 2010 14:40:11 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id C82EBF58FA; Thu, 20 May 2010 11:40:09 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [PATCH 2/2] Add gdb_libdir/python- in front of Python search path. Date: Thu, 20 May 2010 18:40:00 -0000 Message-Id: <1274380803-25266-3-git-send-email-brobecker@adacore.com> In-Reply-To: <1274380803-25266-1-git-send-email-brobecker@adacore.com> References: <1274380803-25266-1-git-send-email-brobecker@adacore.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-05/txt/msg00436.txt.bz2 This patch puts gdb_libdir/python- at the beginning of the python search path. This allows GDB to use its own copy/version of the Python library. 2010-05-20 Joel Brobecker * python.c (_initialize_python): Add variable libdir in gdb module. Insert gdb_libdir/python- at head of python search path. Tested on x86_64-linux. No regression. --- gdb/python/python.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/gdb/python/python.c b/gdb/python/python.c index 3110328..fa76838 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -654,6 +654,7 @@ Enables or disables printing of Python stack traces."), PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version); PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", (char*) host_name); PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", (char*) target_name); + PyModule_AddStringConstant (gdb_module, "libdir", (char*) gdb_libdir); gdbpy_initialize_auto_load (); gdbpy_initialize_values (); @@ -702,6 +703,11 @@ class GdbOutputFile:\n\ \n\ sys.stderr = GdbOutputFile()\n\ sys.stdout = GdbOutputFile()\n\ +\n\ +# Put gdb_libdir/python- in the python search path. This allows\n\ +# us to provide GDB bundled with its own python runtime (the .py/pyc files).\n\ +sys.path.insert(0, gdb.libdir + \"/python-%d.%d\" % (sys.version_info[0],\n\ + sys.version_info[1]))\n\ "); /* Release the GIL while gdb runs. */ -- 1.7.1