public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: jkratoch@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
Date: Wed, 04 Mar 2009 22:34:00 -0000	[thread overview]
Message-ID: <20090304223412.21467.qmail@sourceware.org> (raw)

The branch, archer has been updated
       via  91200d8f856c3165270b24ab392b74d9155b7180 (commit)
       via  e42b07c2ea95c94f7f08f35479758953fa6a7d1c (commit)
       via  a0533baa7d7bb7110d5acc5bd4dabca8871af538 (commit)
       via  84db8f9a3164350cdaa19dcc0c9122d55a5019bd (commit)
       via  8cd105bd9c53585384cb4249c942bed395ba2b89 (commit)
       via  dea5a03d229ce609df3ab3dd10f762608e8df094 (commit)
       via  9a0e06375eeafd272d38863feed8c9a8c1408701 (commit)
       via  7322121d6f77ef446b26f5d048529ae85de30ffd (commit)
       via  e180fc688f2f720ed9431d5712821142db49b46f (commit)
       via  7d013430def2b170f8e8ab1d24312dfecaccc13d (commit)
       via  661248db174bd85e6816ab6794483533f95e3097 (commit)
       via  db7ebad5e30d3ba79028421b7aa39779f796769b (commit)
      from  ff1b04aa80fbb589c4a1bc5e1cdcd1a386022c69 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 91200d8f856c3165270b24ab392b74d9155b7180
Merge: a0533baa7d7bb7110d5acc5bd4dabca8871af538 e42b07c2ea95c94f7f08f35479758953fa6a7d1c
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 4 23:33:44 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

commit a0533baa7d7bb7110d5acc5bd4dabca8871af538
Merge: ff1b04aa80fbb589c4a1bc5e1cdcd1a386022c69 84db8f9a3164350cdaa19dcc0c9122d55a5019bd
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 4 23:32:45 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer
    
    Conflicts:
    	gdb/Makefile.in
    	gdb/configure
    	gdb/configure.ac

-----------------------------------------------------------------------

Summary of changes:
 gdb/Makefile.in            |   23 ++++++------------
 gdb/config.in              |    6 ++--
 gdb/configure              |   47 ++++++++++++++++++++++---------------
 gdb/configure.ac           |   24 ++++++++++++------
 gdb/doc/gdb.texinfo        |    6 ++++
 gdb/python/python-membuf.c |   34 ++++++++++++++++++++-------
 gdb/python/python.c        |   55 +++++++++++++++++++++++++++++++------------
 7 files changed, 125 insertions(+), 70 deletions(-)

First 500 lines of diff:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index fdb0582..01cb9e9 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -177,7 +177,9 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
 # Did the user give us a --with-gdb-datadir option?
 GDB_DATADIR_PATH = @GDB_DATADIR_PATH@
 
-GDB_PYTHONDIR_PATH = @GDB_PYTHONDIR_PATH@
+# The argument to --with-pythondir.  If not given, this is
+# GDB_DATADIR_PATH/python.
+pythondir = @pythondir@
 
 # Helper code from gnulib.
 LIBGNU = gnulib/libgnu.a
@@ -1987,26 +1989,17 @@ PY_FILES = gdb/FrameIterator.py gdb/command/alias.py \
     gdb/__init__.py
 
 # Install the Python library.  Python library files go under
-# $(GDB_PYTHONDIR_PATH)/python.
+# $(pythondir).
 install-python:
 	files='$(PY_FILES)'; for file in $$files; do \
 	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir; \
-	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
+	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(pythondir)/$$dir; \
+	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \
 	done
 
-# Other packages may have their files installed in $(GDB_PYTHONDIR_PATH).
+# Brute force.
 uninstall-python:
-	rm -rf $(DESTDIR)/$(GDB_PYTHONDIR_PATH)/python
-	files='$(PY_FILES)'; for file in $$files; do \
-	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  rm -f $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
-	  while test "x$$file" != "x$$dir"; do \
-	    rmdir 2>/dev/null "$(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir"; \
-	    file="$$dir"; \
-	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  done \
-	done
+	rm -rf $(DESTDIR)/$(pythondir)
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being
diff --git a/gdb/config.in b/gdb/config.in
index 1cfb12b..0c8ccab 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -66,9 +66,6 @@
 /* Define to the default OS ABI for this configuration. */
 #undef GDB_OSABI_DEFAULT
 
-/* Base directory for GDB Python modules. */
-#undef GDB_PYTHONDIR_PATH
-
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
@@ -633,6 +630,9 @@
    'ptrdiff_t'. */
 #undef PTRDIFF_T_SUFFIX
 
+/* Define to install path for Python sources */
+#undef PYTHONDIR
+
 /* Bug reporting address */
 #undef REPORT_BUGS_TO
 
diff --git a/gdb/configure b/gdb/configure
index aa1dd84..3a5b582 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc testsuite"
 ac_subdirs_all="$ac_subdirs_all gdbtk"
 ac_subdirs_all="$ac_subdirs_all multi-ice"
 ac_subdirs_all="$ac_subdirs_all gdbserver"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT GDB_PYTHONDIR_PATH PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH pythondir subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
 ac_subst_files='host_makefile_frag'
 ac_pwd=`pwd`
 
@@ -884,6 +884,8 @@ Optional Packages:
   --with-separate-debug-dir=path   Look for global separate debug info in this path LIBDIR/debug
   --with-gdb-datadir      look for global separate data files in this path
                           [DATADIR/gdb]
+  --with-pythondir        install Python data files in this path
+                          [DATADIR/gdb/python]
   --with-libunwind            Use libunwind frame unwinding support
   --with-pkgversion=PKG   Use PKG in the version string in place of "GDB"
   --with-bugurl=URL       Direct users to URL to report a bug
@@ -7179,6 +7181,29 @@ GDB_DATADIR_PATH=${gdbdatadir}
 
 
 
+# Check whether --with-pythondir or --without-pythondir was given.
+if test "${with_pythondir+set}" = set; then
+  withval="$with_pythondir"
+  pythondir="${withval}"
+else
+  pythondir=no
+fi;
+
+# If the user passed in a path, define it.  Otherwise, compute it at
+# runtime based on the possibly-relocatable datadir.
+if test "$pythondir" = "no"; then
+  pythondir='$(GDB_DATADIR_PATH)/python'
+else
+
+cat >>confdefs.h <<_ACEOF
+#define PYTHONDIR "$pythondir"
+_ACEOF
+
+fi
+
+
+
+
 
 subdirs="$subdirs doc testsuite"
 
@@ -11424,7 +11449,6 @@ echo $ECHO_N "checking whether to use python... $ECHO_C" >&6
 echo "$as_me:$LINENO: result: $with_python" >&5
 echo "${ECHO_T}$with_python" >&6
 
-GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   { echo "$as_me:$LINENO: WARNING: python support disabled; some features may be unavailable." >&5
 echo "$as_me: WARNING: python support disabled; some features may be unavailable." >&2;}
@@ -11656,20 +11680,7 @@ _ACEOF
 
     fi
   fi
-  if test ${have_libpython} != no; then
-    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
-
-  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-  ac_define_dir=`eval echo $GDB_PYTHONDIR_PATH`
-  ac_define_dir=`eval echo $ac_define_dir`
-
-cat >>confdefs.h <<_ACEOF
-#define GDB_PYTHONDIR_PATH "$ac_define_dir"
-_ACEOF
-
-
-  else
+  if test ${have_libpython} = no; then
     case "${with_python}" in
     yes)
       { { echo "$as_me:$LINENO: error: python is missing or unusable" >&5
@@ -11691,8 +11702,6 @@ echo "$as_me: error: no usable python found at ${with_python}" >&2;}
   fi
 fi
 
-
-PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21998,6 +22007,7 @@ s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
 s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
 s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
 s,@GDB_DATADIR_PATH@,$GDB_DATADIR_PATH,;t t
+s,@pythondir@,$pythondir,;t t
 s,@subdirs@,$subdirs,;t t
 s,@TARGET_OBS@,$TARGET_OBS,;t t
 s,@PKGVERSION@,$PKGVERSION,;t t
@@ -22022,7 +22032,6 @@ s,@READLINE_CFLAGS@,$READLINE_CFLAGS,;t t
 s,@HAVE_LIBEXPAT@,$HAVE_LIBEXPAT,;t t
 s,@LIBEXPAT@,$LIBEXPAT,;t t
 s,@LTLIBEXPAT@,$LTLIBEXPAT,;t t
-s,@GDB_PYTHONDIR_PATH@,$GDB_PYTHONDIR_PATH,;t t
 s,@PYTHON_CFLAGS@,$PYTHON_CFLAGS,;t t
 s,@ALLOCA@,$ALLOCA,;t t
 s,@CONFIG_LDFLAGS@,$CONFIG_LDFLAGS,;t t
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 857a7cd..ff76053 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -148,6 +148,21 @@ esac
 GDB_DATADIR_PATH=${gdbdatadir}
 AC_SUBST(GDB_DATADIR_PATH)
 
+AC_ARG_WITH([pythondir],
+  [AS_HELP_STRING([--with-pythondir],
+                  [install Python data files in this path [DATADIR/gdb/python]])], [pythondir="${withval}"], [pythondir=no])
+
+# If the user passed in a path, define it.  Otherwise, compute it at
+# runtime based on the possibly-relocatable datadir.
+if test "$pythondir" = "no"; then
+  pythondir='$(GDB_DATADIR_PATH)/python'
+else
+  AC_DEFINE_UNQUOTED(PYTHONDIR, "$pythondir",
+      [Define to install path for Python sources])
+fi
+AC_SUBST(pythondir)
+
+
 AC_CONFIG_SUBDIRS(doc testsuite)
 
 # Check whether to support alternative target configurations
@@ -617,7 +632,6 @@ AC_ARG_WITH(python,
 AC_MSG_CHECKING([whether to use python])
 AC_MSG_RESULT([$with_python])
 
-GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   AC_MSG_WARN([python support disabled; some features may be unavailable.])
   have_libpython=no
@@ -660,11 +674,7 @@ else
       AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.])
     fi
   fi
-  if test ${have_libpython} != no; then
-    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
-    AC_DEFINE_DIR(GDB_PYTHONDIR_PATH, GDB_PYTHONDIR_PATH, 
-		  [Base directory for GDB Python modules.])
-  else
+  if test ${have_libpython} = no; then
     case "${with_python}" in
     yes)
       AC_MSG_ERROR([python is missing or unusable])
@@ -680,9 +690,7 @@ else
     LIBS=$save_LIBS
   fi
 fi
-AC_SUBST(GDB_PYTHONDIR_PATH)
 
-PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
   AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
   CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e44a64e..86941fe 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18488,6 +18488,12 @@ If this file does not exist, and if the parameter
 @code{debug-file-directory} is set, then @value{GDBN} will append the
 object file's real name to the value of this parameter, and try again.
 
+Finally, if this file does not exist, then @value{GDBN} will look in
+subdirectory of @code{gdb_datadir} (whose value is available from
+@code{maint show gdb_datadir}).  Specifically, @value{GDBN} will take
+the value of @code{gdb_datadir}, append @samp{python/auto-load}, and
+then append the object file's real name.
+
 Also, if a separate debug file is used, @value{GDBN} will look for the
 @samp{-gdb.py} file both in the directory associated with the
 application and the directory associated with the separate debug file.
diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index 57836f9..a4c7d74 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -125,12 +125,12 @@ mbpy_str (PyObject *self)
 {
   membuf_object *membuf_obj = (membuf_object *) self;
 
-  return PyString_FromFormat ("memory buffer for address %p, %u bytes long",
-			      (void *) (uintptr_t) membuf_obj->addr,
-			      (unsigned int) membuf_obj->length);
+  return PyString_FromFormat ("memory buffer for address %s, %s bytes long",
+			      paddress (membuf_obj->addr),
+			      pulongest (membuf_obj->length));
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
 {
   membuf_object *membuf_obj = (membuf_object *) self;
@@ -147,13 +147,13 @@ get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
   return membuf_obj->length;
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
 {
   return get_read_buffer (self, segment, ptrptr);
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_seg_count (PyObject *self, Py_ssize_t *lenp)
 {
   if (lenp)
@@ -162,7 +162,7 @@ get_seg_count (PyObject *self, Py_ssize_t *lenp)
   return 1;
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 {
   void *ptr = NULL;
@@ -212,13 +212,29 @@ static PyTypeObject membuf_object_type = {
   0,				  /*tp_setattro*/
   &buffer_procs,		  /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT,		  /*tp_flags*/
-  "GDB memory buffer object" 	  /*tp_doc*/
+  "GDB memory buffer object", 	  /*tp_doc*/
+  0,				  /* tp_traverse */
+  0,				  /* tp_clear */
+  0,				  /* tp_richcompare */
+  0,				  /* tp_weaklistoffset */
+  0,				  /* tp_iter */
+  0,				  /* tp_iternext */
+  0,				  /* tp_methods */
+  0,				  /* tp_members */
+  0,				  /* tp_getset */
+  0,				  /* tp_base */
+  0,				  /* tp_dict */
+  0,				  /* tp_descr_get */
+  0,				  /* tp_descr_set */
+  0,				  /* tp_dictoffset */
+  0,				  /* tp_init */
+  0,				  /* tp_alloc */
+  PyType_GenericNew		  /* tp_new */
 };
 
 void
 gdbpy_initialize_membuf (void)
 {
-  membuf_object_type.tp_new = PyType_GenericNew;
   if (PyType_Ready (&membuf_object_type) < 0)
     return;
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 554b2bc..2b06748 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -967,10 +967,11 @@ static void
 gdbpy_new_objfile (struct objfile *objfile)
 {
   char *realname;
-  char *filename;
+  char *filename, *debugfile;
   int len;
   FILE *input;
   PyGILState_STATE state;
+  struct cleanup *cleanups;
 
   if (!gdbpy_auto_load || !objfile || !objfile->name)
     return;
@@ -986,35 +987,49 @@ gdbpy_new_objfile (struct objfile *objfile)
   strcpy (filename + len, GDBPY_AUTO_FILENAME);
 
   input = fopen (filename, "r");
+  debugfile = filename;
+
+  cleanups = make_cleanup (xfree, filename);
+  make_cleanup (xfree, realname);
 
   if (!input && debug_file_directory)
     {
       /* Also try the same file in the separate debug info directory.  */
-      char *debugfile;
-
       debugfile = xmalloc (strlen (filename)
 			   + strlen (debug_file_directory) + 1);
       strcpy (debugfile, debug_file_directory);
       /* FILENAME is absolute, so we don't need a "/" here.  */
       strcat (debugfile, filename);
 
-      xfree (filename);
-      filename = debugfile;
+      make_cleanup (xfree, debugfile);
+      input = fopen (debugfile, "r");
+    }
+
+  if (!input && gdb_datadir)
+    {
+      /* Also try the same file in a subdirectory of gdb's data
+	 directory.  */
+      debugfile = xmalloc (strlen (gdb_datadir) + strlen (filename)
+			   + strlen ("/auto-load") + 1);
+      strcpy (debugfile, gdb_datadir);
+      strcat (debugfile, "/auto-load");
+      /* FILENAME is absolute, so we don't need a "/" here.  */
+      strcat (debugfile, filename);
 
-      input = fopen (filename, "r");
+      make_cleanup (xfree, debugfile);
+      input = fopen (debugfile, "r");
     }
 
   if (input)
     {
       /* We don't want to throw an exception here -- but the user
 	 would like to know that something went wrong.  */
-      if (PyRun_SimpleFile (input, filename))
+      if (PyRun_SimpleFile (input, debugfile))
 	gdbpy_print_stack ();
       fclose (input);
     }
 
-  xfree (realname);
-  xfree (filename);
+  do_cleanups (cleanups);
   gdbpy_current_objfile = NULL;
 
   PyGILState_Release (state);
@@ -1768,6 +1783,12 @@ Enables or disables auto-loading of Python code when an object is opened."),
   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);
+#ifdef PYTHONDIR
+  PyModule_AddStringConstant (gdb_module, "pythondir", PYTHONDIR);
+#else
+  if (gdb_datadir)
+    PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir);
+#endif
 
   gdbpy_initialize_values ();
   gdbpy_initialize_breakpoints ();
@@ -1819,13 +1840,15 @@ class GdbOutputFile:\n\
 \n\
 sys.stderr = GdbOutputFile()\n\
 sys.stdout = GdbOutputFile()\n\
-# FIXME: gdb.pythonlibdir is deprecated as it is just the standard libdir.\n\
-gdb.pythonlibdir = '" GDB_PYTHONDIR_PATH "'\n\
-gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\
-from os.path import exists\n\
-ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\
-if exists (ipy):\n\
-  execfile (ipy)\n\
+if hasattr (gdb, 'datadir'):\n\
+  gdb.pythondir = gdb.datadir + '/python'\n\
+if hasattr (gdb, 'pythondir'):\n\
+  sys.path.insert(0, gdb.pythondir)\n\
+  gdb.__path__ = [gdb.pythondir + '/gdb']\n\
+  from os.path import exists\n\
+  ipy = gdb.pythondir + '/gdb/__init__.py'\n\
+  if exists (ipy):\n\
+    execfile (ipy)\n\
 ");
 
   /* Release the GIL while gdb runs.  */


hooks/post-receive
--
Repository for Project Archer.


             reply	other threads:[~2009-03-04 22:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04 22:34 jkratoch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-03-30 19:06 jkratoch
2009-03-29 22:42 jkratoch
2009-03-27  0:35 jkratoch
2009-03-25 19:00 jkratoch
2009-03-24 17:33 jkratoch
2009-03-12 20:25 jkratoch
2009-03-09 17:05 jkratoch
2009-03-06 21:16 jkratoch
2009-03-06 16:59 jkratoch
2009-03-06 14:26 jkratoch
2009-03-05 21:53 jkratoch
2009-03-05 21:15 jkratoch
2009-03-04 23:54 jkratoch
2009-03-04 15:04 jkratoch
2009-03-03 21:47 jkratoch
2009-03-03 21:45 jkratoch
2009-03-02 22:55 jkratoch
2009-03-01 14:38 jkratoch
2009-02-28 19:26 jkratoch
2009-02-26 23:02 jkratoch

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=20090304223412.21467.qmail@sourceware.org \
    --to=jkratoch@sourceware.org \
    --cc=archer-commits@sourceware.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).