OSDN Git Service

gdb:
authorJoseph Myers <jsm@polyomino.org.uk>
Tue, 21 Apr 2009 10:13:03 +0000 (10:13 +0000)
committerJoseph Myers <jsm@polyomino.org.uk>
Tue, 21 Apr 2009 10:13:03 +0000 (10:13 +0000)
* 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.

gdb/ChangeLog
gdb/config.in
gdb/configure
gdb/configure.ac
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/main.c
gdb/source.c
gdb/source.h

index dc41f71..7252cdb 100644 (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.
index ab0c840..1bfd837 100644 (file)
    'ptrdiff_t'. */
 #undef PTRDIFF_T_SUFFIX
 
+/* Relocated directory for source files. */
+#undef RELOC_SRCDIR
+
 /* Bug reporting address */
 #undef REPORT_BUGS_TO
 
index 0ba6d2c..d37c4f2 100755 (executable)
@@ -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"
 
index b8555c8..68c8e4a 100644 (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
index 428da00..b0f803b 100644 (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>
 
index ebba32f..50949e0 100644 (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{}
index 5d4640b..86607d3 100644 (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 
index 43df92f..50f3510 100644 (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;
index 47968f0..72271fe 100644 (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