* 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.
gdb/doc:
* gdb.texinfo (Source Path): Document --with-relocated-sources.
+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.
'ptrdiff_t'. */
#undef PTRDIFF_T_SUFFIX
+/* Relocated directory for source files. */
+#undef RELOC_SRCDIR
+
/* Bug reporting address */
#undef REPORT_BUGS_TO
--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
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"
;;
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
+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>
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{}
#include "interps.h"
#include "main.h"
+#include "source.h"
+
/* If nonzero, display time usage both at startup and for each command. */
int display_time;
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
/* 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;
/* 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