diff options
author | Tom Tromey <tromey@redhat.com> | 2009-04-23 21:28:20 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2009-04-23 21:28:20 +0000 |
commit | b14b1491f237a685a00ba669fb8410ae9ee7f648 (patch) | |
tree | 0d95cea6581f1777f0f83662fa7ae9840cdfd805 | |
parent | 5e7b5f74c234fb11db064df93e309463a9058740 (diff) | |
download | gdb-b14b1491f237a685a00ba669fb8410ae9ee7f648.zip gdb-b14b1491f237a685a00ba669fb8410ae9ee7f648.tar.gz gdb-b14b1491f237a685a00ba669fb8410ae9ee7f648.tar.bz2 |
gdb
2009-04-23 Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com>
Tom Tromey <tromey@redhat.com>
* configure, config.in: Regenerate.
* configure.ac: Support for relocatable GDB datadir. Use
GDB_AC_WITH_DIR. Always define TARGET_SYSTEM_ROOT_RELOCATABLE.
* acinclude.m4 (GDB_AC_WITH_DIR): New defun.
* top.c (init_main): Add "set data-directory".
* defs.h (gdb_datadir): Declare.
* main.c (gdb_datadir): New global.
(captured_main): Initialize gdb_datadir. Use relocate_directory.
(relocate_path): New function.
(relocate_directory): Likewise.
(get_init_files): Use relocate_path.
(README): Mention --with-gdb-datadir.
gdb/doc
2009-04-23 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Data Files): New node.
(GDB Files): Update menu.
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/README | 5 | ||||
-rw-r--r-- | gdb/acinclude.m4 | 35 | ||||
-rw-r--r-- | gdb/config.in | 16 | ||||
-rwxr-xr-x | gdb/configure | 148 | ||||
-rw-r--r-- | gdb/configure.ac | 69 | ||||
-rw-r--r-- | gdb/defs.h | 3 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 31 | ||||
-rw-r--r-- | gdb/main.c | 143 | ||||
-rw-r--r-- | gdb/top.c | 9 |
11 files changed, 299 insertions, 181 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ec17070..0bfe563 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2009-04-23 Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com> + Tom Tromey <tromey@redhat.com> + + * configure, config.in: Regenerate. + * configure.ac: Support for relocatable GDB datadir. Use + GDB_AC_WITH_DIR. Always define TARGET_SYSTEM_ROOT_RELOCATABLE. + * acinclude.m4 (GDB_AC_WITH_DIR): New defun. + * top.c (init_main): Add "set data-directory". + * defs.h (gdb_datadir): Declare. + * main.c (gdb_datadir): New global. + (captured_main): Initialize gdb_datadir. Use relocate_directory. + (relocate_path): New function. + (relocate_directory): Likewise. + (get_init_files): Use relocate_path. + (README): Mention --with-gdb-datadir. + 2009-04-23 Joel Brobecker <brobecker@adacore.com> * ada-tasks (task_command_1): Call target_find_new_threads. @@ -436,6 +436,11 @@ prefer; but you may abbreviate option names if you use `--'. Same as `--host=HOST'. If you omit this, GDB will guess; it's quite accurate. +`--with-gdb-datadir=PATH' + Set the GDB-specific data directory. GDB will look here for + certain supporting files or scripts. This defaults to the `gdb' + subdirectory of `datadir' (which can be set using `--datadir'). + `configure' accepts other options, for compatibility with configuring other GNU tools recursively; but these are the only options that affect GDB or its supporting libraries. diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 932dd4f..d1f71c1 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -387,3 +387,38 @@ AC_DEFUN([CY_AC_TK_PRIVATE_HEADERS], [ AC_MSG_RESULT(${private_dir}) fi ]) + +dnl GDB_AC_WITH_DIR([VARIABLE], [ARG-NAME], [HELP], [DEFAULT]) +dnl Add a new --with option that defines a directory. +dnl The result is stored in VARIABLE. AC_DEFINE_DIR is called +dnl on this variable, as is AC_SUBST. +dnl ARG-NAME is the base name of the argument (without "--with"). +dnl HELP is the help text to use. +dnl If the user's choice is relative to the prefix, then the +dnl result is relocatable, then this will define the C macro +dnl VARIABLE_RELOCATABLE to 1; otherwise it is defined as 0. +dnl DEFAULT is the default value, which is used if the user +dnl does not specify the argument. +AC_DEFUN([GDB_AC_WITH_DIR], [ + AC_ARG_WITH([$2], AS_HELP_STRING([--with-][$2][=PATH], [$3]), [ + [$1]=$withval], [[$1]=[$4]]) + AC_DEFINE_DIR([$1], [$1], [$3]) + AC_SUBST([$1]) + if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then + if test "x$prefix" = xNONE; then + test_prefix=/usr/local + else + test_prefix=$prefix + fi + else + test_prefix=$exec_prefix + fi + value=0 + case ${ac_define_dir} in + "${test_prefix}"|"${test_prefix}/"*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + value=1 + ;; + esac + AC_DEFINE_UNQUOTED([$1]_RELOCATABLE, $value, [Define if the $2 directory should be relocated when GDB is moved.]) + ]) diff --git a/gdb/config.in b/gdb/config.in index 1bfd837..d4d4469 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -26,10 +26,11 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA -/* Global directory for separate debug files. */ +/* look for global separate debug info in this path [LIBDIR/debug] */ #undef DEBUGDIR -/* Define if the debug directory should be relocated when GDB is moved. */ +/* Define if the separate-debug-dir directory should be relocated when GDB is + moved. */ #undef DEBUGDIR_RELOCATABLE /* Define to BFD's default architecture. */ @@ -42,6 +43,13 @@ language is requested. */ #undef ENABLE_NLS +/* look for global separate data files in this path [DATADIR/gdb] */ +#undef GDB_DATADIR + +/* Define if the gdb-datadir directory should be relocated when GDB is moved. + */ +#undef GDB_DATADIR_RELOCATABLE + /* Define to be a string naming the default host character set. */ #undef GDB_DEFAULT_HOST_CHARSET @@ -670,10 +678,10 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* System-wide gdbinit file. */ +/* automatically load a system-wide gdbinit file */ #undef SYSTEM_GDBINIT -/* Define if the system-wide gdbinit file should be relocated when GDB is +/* Define if the system-gdbinit directory should be relocated when GDB is moved. */ #undef SYSTEM_GDBINIT_RELOCATABLE diff --git a/gdb/configure b/gdb/configure index d709727..4444ffa 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 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 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 GDB_NM_FILE datarootdir docdir htmldir pdfdir 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 DEBUGDIR GDB_DATADIR 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 READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE SYSTEM_GDBINIT 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 GDB_NM_FILE datarootdir docdir htmldir pdfdir LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS' ac_subst_files='host_makefile_frag' ac_pwd=`pwd` @@ -887,6 +887,8 @@ Optional Packages: --with-separate-debug-dir=PATH look for global separate debug info in this path [LIBDIR/debug] + --with-gdb-datadir=PATH look for global separate data files in this path + [DATADIR/gdb] --with-relocated-sources=PATH automatically relocate this path for source files --with-libunwind use libunwind frame unwinding support @@ -908,7 +910,7 @@ Optional Packages: with caution on other system) --with-sysroot[=DIR] search for usr/lib et al within DIR - --with-system-gdbinit=FILE + --with-system-gdbinit=PATH automatically load a system-wide gdbinit file --with-tcl directory containing tcl configuration (tclConfig.sh) --with-tk directory containing tk configuration (tkConfig.sh) @@ -7105,19 +7107,20 @@ fi -debugdir=${libdir}/debug # Check whether --with-separate-debug-dir or --without-separate-debug-dir was given. if test "${with_separate_debug_dir+set}" = set; then withval="$with_separate_debug_dir" - debugdir="${withval}" -fi; + DEBUGDIR=$withval +else + DEBUGDIR=${libdir}/debug +fi; test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $debugdir` + ac_define_dir=`eval echo $DEBUGDIR` ac_define_dir=`eval echo $ac_define_dir` cat >>confdefs.h <<_ACEOF @@ -7125,27 +7128,76 @@ cat >>confdefs.h <<_ACEOF _ACEOF -#AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"), -if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local + if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then + if test "x$prefix" = xNONE; then + test_prefix=/usr/local + else + test_prefix=$prefix + fi else - test_prefix=$prefix + test_prefix=$exec_prefix fi + value=0 + case ${ac_define_dir} in + "${test_prefix}"|"${test_prefix}/"*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + value=1 + ;; + esac + +cat >>confdefs.h <<_ACEOF +#define DEBUGDIR_RELOCATABLE $value +_ACEOF + + + +# GDB's datadir relocation + + + +# Check whether --with-gdb-datadir or --without-gdb-datadir was given. +if test "${with_gdb_datadir+set}" = set; then + withval="$with_gdb_datadir" + + GDB_DATADIR=$withval else - test_prefix=$exec_prefix -fi -case ${debugdir} in -"${test_prefix}"|"${test_prefix}/"*|\ -'${exec_prefix}'|'${exec_prefix}/'*) + GDB_DATADIR=${datadir}/gdb +fi; -cat >>confdefs.h <<\_ACEOF -#define DEBUGDIR_RELOCATABLE 1 + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + ac_define_dir=`eval echo $GDB_DATADIR` + ac_define_dir=`eval echo $ac_define_dir` + +cat >>confdefs.h <<_ACEOF +#define GDB_DATADIR "$ac_define_dir" _ACEOF - ;; -esac + + + if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then + if test "x$prefix" = xNONE; then + test_prefix=/usr/local + else + test_prefix=$prefix + fi + else + test_prefix=$exec_prefix + fi + value=0 + case ${ac_define_dir} in + "${test_prefix}"|"${test_prefix}/"*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + value=1 + ;; + esac + +cat >>confdefs.h <<_ACEOF +#define GDB_DATADIR_RELOCATABLE $value +_ACEOF + + # Check whether --with-relocated-sources or --without-relocated-sources was given. @@ -19896,6 +19948,7 @@ _ACEOF fi +target_sysroot_reloc=0 # Check whether --with-sysroot or --without-sysroot was given. if test "${with_sysroot+set}" = set; then @@ -19923,8 +19976,7 @@ if test "${with_sysroot+set}" = set; then "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ '${prefix}'|'${prefix}/'*|\ '${exec_prefix}'|'${exec_prefix}/'*) - t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" - TARGET_SYSTEM_ROOT_DEFINE="$t" + target_sysroot_reloc=1 ;; esac @@ -19934,21 +19986,24 @@ else TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"' fi; +TARGET_SYSTEM_ROOT_DEFINE="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE=$target_sysroot_reloc" + -system_gdbinit= # Check whether --with-system-gdbinit or --without-system-gdbinit was given. if test "${with_system_gdbinit+set}" = set; then withval="$with_system_gdbinit" - system_gdbinit=${withval} -fi; + SYSTEM_GDBINIT=$withval +else + SYSTEM_GDBINIT= +fi; test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $system_gdbinit` + ac_define_dir=`eval echo $SYSTEM_GDBINIT` ac_define_dir=`eval echo $ac_define_dir` cat >>confdefs.h <<_ACEOF @@ -19957,28 +20012,28 @@ _ACEOF -if test "x$prefix" = xNONE; then - test_prefix=$ac_default_prefix -else - test_prefix=$prefix -fi -if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then - test_exec_prefix=$test_prefix -else - test_exec_prefix=$exec_prefix -fi -case ${system_gdbinit} in - "${test_prefix}"|"${test_prefix}/"*|\ - "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ - '${prefix}'|'${prefix}/'*|\ - '${exec_prefix}'|'${exec_prefix}/'*) + if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then + if test "x$prefix" = xNONE; then + test_prefix=/usr/local + else + test_prefix=$prefix + fi + else + test_prefix=$exec_prefix + fi + value=0 + case ${ac_define_dir} in + "${test_prefix}"|"${test_prefix}/"*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + value=1 + ;; + esac -cat >>confdefs.h <<\_ACEOF -#define SYSTEM_GDBINIT_RELOCATABLE 1 +cat >>confdefs.h <<_ACEOF +#define SYSTEM_GDBINIT_RELOCATABLE $value _ACEOF - ;; -esac + # Check whether --enable-werror or --disable-werror was given. if test "${enable_werror+set}" = set; then @@ -22112,6 +22167,8 @@ s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@DEBUGDIR@,$DEBUGDIR,;t t +s,@GDB_DATADIR@,$GDB_DATADIR,;t t s,@subdirs@,$subdirs,;t t s,@TARGET_OBS@,$TARGET_OBS,;t t s,@PKGVERSION@,$PKGVERSION,;t t @@ -22138,6 +22195,7 @@ s,@ALLOCA@,$ALLOCA,;t t s,@CONFIG_LDFLAGS@,$CONFIG_LDFLAGS,;t t s,@TARGET_SYSTEM_ROOT@,$TARGET_SYSTEM_ROOT,;t t s,@TARGET_SYSTEM_ROOT_DEFINE@,$TARGET_SYSTEM_ROOT_DEFINE,;t t +s,@SYSTEM_GDBINIT@,$SYSTEM_GDBINIT,;t t s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t s,@WERROR_CFLAGS@,$WERROR_CFLAGS,;t t s,@SER_HARDWIRE@,$SER_HARDWIRE,;t t diff --git a/gdb/configure.ac b/gdb/configure.ac index 4c2768d..af396cc 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -92,31 +92,15 @@ AC_SUBST(PACKAGE) # generate its Makefile.in. AM_INIT_AUTOMAKE(gdb, UNUSED-VERSION, [no-define]) -debugdir=${libdir}/debug - -AC_ARG_WITH(separate-debug-dir, -[AS_HELP_STRING([--with-separate-debug-dir=PATH], [look for global separate debug info in this path [LIBDIR/debug]])], -[debugdir="${withval}"]) - -AC_DEFINE_DIR(DEBUGDIR, debugdir, - [Global directory for separate debug files. ]) -#AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"), - -if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix - fi -else - test_prefix=$exec_prefix -fi -case ${debugdir} in -"${test_prefix}"|"${test_prefix}/"*|\ -'${exec_prefix}'|'${exec_prefix}/'*) - AC_DEFINE(DEBUGDIR_RELOCATABLE, 1, [Define if the debug directory should be relocated when GDB is moved.]) - ;; -esac +GDB_AC_WITH_DIR(DEBUGDIR, separate-debug-dir, + [look for global separate debug info in this path @<:@LIBDIR/debug@:>@], + [${libdir}/debug]) + +# GDB's datadir relocation + +GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir, + [look for global separate data files in this path @<:@DATADIR/gdb@:>@], + [${datadir}/gdb]) AC_ARG_WITH(relocated-sources, AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this path for source files]), @@ -1479,6 +1463,7 @@ fi dnl Handle optional features that can be enabled. +target_sysroot_reloc=0 AC_ARG_WITH(sysroot, AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [search for usr/lib et al within DIR]), [ @@ -1504,44 +1489,20 @@ AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [search for usr/lib et al within DI "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ '${prefix}'|'${prefix}/'*|\ '${exec_prefix}'|'${exec_prefix}/'*) - t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" - TARGET_SYSTEM_ROOT_DEFINE="$t" + target_sysroot_reloc=1 ;; esac ], [ TARGET_SYSTEM_ROOT= TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"' ]) +TARGET_SYSTEM_ROOT_DEFINE="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE=$target_sysroot_reloc" AC_SUBST(TARGET_SYSTEM_ROOT) AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) -system_gdbinit= -AC_ARG_WITH(system-gdbinit, -AS_HELP_STRING([--with-system-gdbinit=FILE], [automatically load a system-wide gdbinit file]), -[system_gdbinit=${withval}]) - -AC_DEFINE_DIR(SYSTEM_GDBINIT, system_gdbinit, - [System-wide gdbinit file.]) - -if test "x$prefix" = xNONE; then - test_prefix=$ac_default_prefix -else - test_prefix=$prefix -fi -if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then - test_exec_prefix=$test_prefix -else - test_exec_prefix=$exec_prefix -fi -case ${system_gdbinit} in - "${test_prefix}"|"${test_prefix}/"*|\ - "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ - '${prefix}'|'${prefix}/'*|\ - '${exec_prefix}'|'${exec_prefix}/'*) - AC_DEFINE(SYSTEM_GDBINIT_RELOCATABLE, 1, - [Define if the system-wide gdbinit file should be relocated when GDB is moved.]) - ;; -esac +GDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit, + [automatically load a system-wide gdbinit file], + []) AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]), @@ -153,6 +153,9 @@ extern int dbx_commands; /* System root path, used to find libraries etc. */ extern char *gdb_sysroot; +/* GDB datadir, used to store data files. */ +extern char *gdb_datadir; + /* Search path for separate debug files. */ extern char *debug_file_directory; diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 4c41b50..e0f7a66 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-04-23 Tom Tromey <tromey@redhat.com> + + * gdb.texinfo (Data Files): New node. + (GDB Files): Update menu. + 2009-04-23 Joel Brobecker <brobecker@adacore.com> * gdbint.texinfo (Defining Other Architecture Features): Remove diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 2cdac20..53fecf3 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -12734,6 +12734,7 @@ program. To debug a core dump of a previous run, you must also tell * Files:: Commands to specify files * Separate Debug Files:: Debugging information in separate files * Symbol Errors:: Errors reading symbol files +* Data Files:: GDB data files @end menu @node Files @@ -13568,6 +13569,36 @@ it. @end table +@node Data Files +@section GDB Data Files + +@cindex prefix for data files +@value{GDBN} will sometimes read an auxiliary data file. These files +are kept in a directory known as the @dfn{data directory}. + +You can set the data directory's name, and view the name @value{GDBN} +is currently using. + +@table @code +@kindex set data-directory +@item set data-directory @var{directory} +Set the directory which @value{GDBN} searches for auxiliary data files +to @var{directory}. + +@kindex show data-directory +@item show data-directory +Show the directory @value{GDBN} searches for auxiliary data files. +@end table + +@cindex default data directory +@cindex @samp{--with-gdb-datadir} +You can set the default data directory by using the configure-time +@samp{--with-gdb-datadir} option. If the data directory is inside +@value{GDBN}'s configured binary prefix (set with @samp{--prefix} or +@samp{--exec-prefix}), then the default data directory will be updated +automatically if the installed @value{GDBN} is moved to a new +location. + @node Targets @chapter Specifying a Debugging Target @@ -64,6 +64,9 @@ int dbx_commands = 0; /* System root path, used to find libraries etc. */ char *gdb_sysroot = 0; +/* GDB datadir, used to store data files. */ +char *gdb_datadir = 0; + struct ui_file *gdb_stdout; struct ui_file *gdb_stderr; struct ui_file *gdb_stdlog; @@ -95,6 +98,57 @@ static void print_gdb_help (struct ui_file *); extern char *external_editor_command; +/* Relocate a file or directory. PROGNAME is the name by which gdb + was invoked (i.e., argv[0]). INITIAL is the default value for the + file or directory. FLAG is true if the value is relocatable, false + otherwise. Returns a newly allocated string; this may return NULL + under the same conditions as make_relative_prefix. */ +static char * +relocate_path (const char *progname, const char *initial, int flag) +{ + if (flag) + return make_relative_prefix (progname, BINDIR, initial); + return xstrdup (initial); +} + +/* Like relocate_path, but specifically checks for a directory. + INITIAL is relocated according to the rules of relocate_path. If + the result is a directory, it is used; otherwise, INITIAL is used. + The chosen directory is then canonicalized using lrealpath. This + function always returns a newly-allocated string. */ +static char * +relocate_directory (const char *progname, const char *initial, int flag) +{ + char *dir; + + dir = relocate_path (progname, initial, flag); + if (dir) + { + struct stat s; + + if (stat (dir, &s) != 0 || !S_ISDIR (s.st_mode)) + { + xfree (dir); + dir = NULL; + } + } + if (!dir) + dir = xstrdup (initial); + + /* Canonicalize the directory. */ + if (*dir) + { + char *canon_sysroot = lrealpath (dir); + if (canon_sysroot) + { + xfree (dir); + dir = canon_sysroot; + } + } + + return dir; +} + /* Compute the locations of init files that GDB should source and return them in SYSTEM_GDBINIT, HOME_GDBINIT, LOCAL_GDBINIT. If there is no system gdbinit (resp. home gdbinit and local gdbinit) to be loaded, @@ -115,24 +169,16 @@ get_init_files (char **system_gdbinit, struct stat homebuf, cwdbuf, s; char *homedir, *relocated_sysgdbinit; - sysgdbinit = SYSTEM_GDBINIT; - if (!sysgdbinit [0] || stat (sysgdbinit, &s) != 0) - sysgdbinit = NULL; - -#ifdef SYSTEM_GDBINIT_RELOCATABLE - relocated_sysgdbinit = make_relative_prefix (gdb_program_name, BINDIR, - SYSTEM_GDBINIT); - if (relocated_sysgdbinit) + if (SYSTEM_GDBINIT[0]) { - struct stat s; - int res = 0; - - if (stat (relocated_sysgdbinit, &s) == 0) + relocated_sysgdbinit = relocate_path (gdb_program_name, + SYSTEM_GDBINIT, + SYSTEM_GDBINIT_RELOCATABLE); + if (relocated_sysgdbinit && stat (relocated_sysgdbinit, &s) == 0) sysgdbinit = relocated_sysgdbinit; else xfree (relocated_sysgdbinit); } -#endif homedir = getenv ("HOME"); @@ -291,73 +337,14 @@ captured_main (void *data) current_directory = gdb_dirbuf; /* Set the sysroot path. */ -#ifdef TARGET_SYSTEM_ROOT_RELOCATABLE - gdb_sysroot = make_relative_prefix (argv[0], BINDIR, TARGET_SYSTEM_ROOT); - if (gdb_sysroot) - { - struct stat s; - int res = 0; - - if (stat (gdb_sysroot, &s) == 0) - if (S_ISDIR (s.st_mode)) - res = 1; + gdb_sysroot = relocate_directory (argv[0], TARGET_SYSTEM_ROOT, + TARGET_SYSTEM_ROOT_RELOCATABLE); - if (res == 0) - { - xfree (gdb_sysroot); - gdb_sysroot = xstrdup (TARGET_SYSTEM_ROOT); - } - } - else - gdb_sysroot = xstrdup (TARGET_SYSTEM_ROOT); -#else - gdb_sysroot = xstrdup (TARGET_SYSTEM_ROOT); -#endif - - /* Canonicalize the sysroot path. */ - if (*gdb_sysroot) - { - char *canon_sysroot = lrealpath (gdb_sysroot); - if (canon_sysroot) - { - xfree (gdb_sysroot); - gdb_sysroot = canon_sysroot; - } - } + debug_file_directory = relocate_directory (argv[0], DEBUGDIR, + DEBUGDIR_RELOCATABLE); -#ifdef DEBUGDIR_RELOCATABLE - debug_file_directory = make_relative_prefix (argv[0], BINDIR, DEBUGDIR); - if (debug_file_directory) - { - struct stat s; - int res = 0; - - if (stat (debug_file_directory, &s) == 0) - if (S_ISDIR (s.st_mode)) - res = 1; - - if (res == 0) - { - xfree (debug_file_directory); - debug_file_directory = xstrdup (DEBUGDIR); - } - } - else - debug_file_directory = xstrdup (DEBUGDIR); -#else - debug_file_directory = xstrdup (DEBUGDIR); -#endif - - /* Canonicalize the debugfile path. */ - if (*debug_file_directory) - { - char *canon_debug = lrealpath (debug_file_directory); - if (canon_debug) - { - xfree (debug_file_directory); - debug_file_directory = canon_debug; - } - } + gdb_datadir = relocate_directory (argv[0], GDB_DATADIR, + GDB_DATADIR_RELOCATABLE); get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit); @@ -1619,6 +1619,15 @@ Use \"on\" to enable the notification, and \"off\" to disable it."), NULL, show_exec_done_display_p, &setlist, &showlist); + + add_setshow_filename_cmd ("data-directory", class_maintenance, + &gdb_datadir, _("Set GDB's data directory."), + _("Show GDB's data directory."), + _("\ +When set, GDB uses the specified path to search for data files."), + NULL, NULL, + &setlist, + &showlist); } void |