diff options
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/config.in | 3 | ||||
-rwxr-xr-x | gdb/configure | 21 | ||||
-rw-r--r-- | gdb/configure.ac | 7 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 13 | ||||
-rw-r--r-- | gdb/main.c | 8 | ||||
-rw-r--r-- | gdb/source.c | 2 | ||||
-rw-r--r-- | gdb/source.h | 3 |
9 files changed, 69 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dc41f71..7252cdb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2009-04-21 Joseph Myers <joseph@codesourcery.com> + + * configure.ac (--with-relocated-sources): New. + * configure, config.in: Regenerate. + * source.c (add_substitute_path_rule): Remove static. + * source.h (add_substitute_path_rule): Declare. + * main.c: Include "source.h". + (captured_main): Add substitution rule if RELOC_SRCDIR. + 2009-04-21 Pierre Muller <muller.u-strasbg.fr> * gnu-nat.h (proc_debug): Add missing continuation line in macro. diff --git a/gdb/config.in b/gdb/config.in index ab0c840..1bfd837 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -630,6 +630,9 @@ 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX +/* Relocated directory for source files. */ +#undef RELOC_SRCDIR + /* Bug reporting address */ #undef REPORT_BUGS_TO diff --git a/gdb/configure b/gdb/configure index 0ba6d2c..d37c4f2 100755 --- a/gdb/configure +++ b/gdb/configure @@ -882,6 +882,8 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-separate-debug-dir=path Look for global separate debug info in this path LIBDIR/debug + --with-relocated-sources=PATH + Automatically relocate this path for source files --with-libunwind Use libunwind frame unwinding support --with-curses use the curses library instead of the termcap library @@ -7133,6 +7135,25 @@ _ACEOF esac +# Check whether --with-relocated-sources or --without-relocated-sources was given. +if test "${with_relocated_sources+set}" = set; then + withval="$with_relocated_sources" + reloc_srcdir="${withval}" + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + ac_define_dir=`eval echo $reloc_srcdir` + ac_define_dir=`eval echo $ac_define_dir` + +cat >>confdefs.h <<_ACEOF +#define RELOC_SRCDIR "$ac_define_dir" +_ACEOF + + + +fi; + + subdirs="$subdirs doc testsuite" diff --git a/gdb/configure.ac b/gdb/configure.ac index b8555c8..68c8e4a 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -118,6 +118,13 @@ case ${debugdir} in ;; esac +AC_ARG_WITH(relocated-sources, +AC_HELP_STRING([--with-relocated-sources=PATH], [Automatically relocate this path for source files]), +[reloc_srcdir="${withval}" + AC_DEFINE_DIR(RELOC_SRCDIR, reloc_srcdir, + [Relocated directory for source files. ]) +]) + AC_CONFIG_SUBDIRS(doc testsuite) # Check whether to support alternative target configurations diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 428da00..b0f803b 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2009-04-21 Joseph Myers <joseph@codesourcery.com> + + * gdb.texinfo (Source Path): Document --with-relocated-sources. + 2009-04-18 Carlos O'Donell <carlos@codesourcery.com> Joseph Myers <joseph@codesourcery.com> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index ebba32f..50949e0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -5809,6 +5809,19 @@ for any reason a source file that is not relevant to your executable is located at the original location, a substitution rule is the only method available to point @value{GDBN} at the new location. +@cindex @samp{--with-relocated-sources} +@cindex default source path substitution +You can configure a default source path substitution rule by +configuring @value{GDBN} with the +@samp{--with-relocated-sources=@var{dir}} option. The @var{dir} +should be the name of a directory under @value{GDBN}'s configured +prefix (set with @samp{--prefix} or @samp{--exec-prefix}), and +directory names in debug information under @var{dir} will be adjusted +automatically if the installed @value{GDBN} is moved to a new +location. This is useful if @value{GDBN}, libraries or executables +with debug information and corresponding source code are being moved +together. + @table @code @item directory @var{dirname} @dots{} @item dir @var{dirname} @dots{} @@ -40,6 +40,8 @@ #include "interps.h" #include "main.h" +#include "source.h" + /* If nonzero, display time usage both at startup and for each command. */ int display_time; @@ -359,6 +361,12 @@ captured_main (void *data) get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit); +#ifdef RELOC_SRCDIR + add_substitute_path_rule (RELOC_SRCDIR, + make_relative_prefix (argv[0], BINDIR, + RELOC_SRCDIR)); +#endif + /* There will always be an interpreter. Either the one passed into this captured main, or one specified by the user at start up, or the console. Initialize the interpreter to the one requested by diff --git a/gdb/source.c b/gdb/source.c index 43df92f..50f3510 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1746,7 +1746,7 @@ find_substitute_path_rule (const char *from) /* Add a new substitute-path rule at the end of the current list of rules. The new rule will replace FROM into TO. */ -static void +void add_substitute_path_rule (char *from, char *to) { struct substitute_path_rule *rule; diff --git a/gdb/source.h b/gdb/source.h index 47968f0..72271fe 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -66,4 +66,7 @@ extern struct symtab_and_line set_current_source_symtab_and_line (const struct s /* Reset any information stored about a default file and line to print. */ extern void clear_current_source_symtab_and_line (void); + +/* Add a source path substitution rule. */ +extern void add_substitute_path_rule (char *, char *); #endif |