* 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.
This commit is contained in:
Joseph Myers 2009-04-21 10:13:05 +00:00
parent ccabeb57ba
commit 29b0e8a24a
9 changed files with 69 additions and 1 deletions

View File

@ -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.

View File

@ -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

21
gdb/configure vendored
View File

@ -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"

View File

@ -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

View File

@ -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>

View File

@ -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{}

View File

@ -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

View File

@ -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;

View File

@ -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