* Add --with-relocated-sources configure option
@ 2009-04-20 20:26 Joseph S. Myers
2009-04-20 21:10 ` Eli Zaretskii
2009-04-20 21:36 ` Tom Tromey
0 siblings, 2 replies; 6+ messages in thread
From: Joseph S. Myers @ 2009-04-20 20:26 UTC (permalink / raw)
To: gdb-patches
This patch adds a configure option --with-relocated-sources to build
GDB with a default substitute-path. The use of this option is for
distributing binaries of GDB, libraries and source code for those
libraries together, as explained in the documentation added for it:
@cindex @samp{--with-relocated-sources}
You can configure a default source path substitution rule by
configuring @value{GDBN} with the
@samp{--with-relocated-sources=@var{path}} option. The @var{path}
should be the name of a directory under @value{GDBN}'s configured
binary prefix (set with @samp{--prefix} or @samp{--exec-prefix}), and
paths in debug information under @var{path} will be relocated
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
distributed together.
OK to commit?
gdb:
2009-04-20 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.
gdb/doc:
2009-04-20 Joseph Myers <joseph@codesourcery.com>
* gdb.texinfo (Source Path): Document --with-relocated-sources.
Index: gdb/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.93
diff -u -r1.93 configure.ac
--- gdb/configure.ac 17 Apr 2009 17:44:04 -0000 1.93
+++ gdb/configure.ac 20 Apr 2009 20:17:52 -0000
@@ -118,6 +118,13 @@
;;
esac
+AC_ARG_WITH(relocated-sources,
+[ --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: gdb/main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.73
diff -u -r1.73 main.c
--- gdb/main.c 28 Jan 2009 15:01:00 -0000 1.73
+++ gdb/main.c 20 Apr 2009 20:17:53 -0000
@@ -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 @@
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: gdb/source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.96
diff -u -r1.96 source.c
--- gdb/source.c 13 Mar 2009 02:34:13 -0000 1.96
+++ gdb/source.c 20 Apr 2009 20:17:53 -0000
@@ -1746,7 +1746,7 @@
/* 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: gdb/source.h
===================================================================
RCS file: /cvs/src/src/gdb/source.h,v
retrieving revision 1.10
diff -u -r1.10 source.h
--- gdb/source.h 3 Jan 2009 05:57:53 -0000 1.10
+++ gdb/source.h 20 Apr 2009 20:17:53 -0000
@@ -66,4 +66,7 @@
/* 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
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.580
diff -u -r1.580 gdb.texinfo
--- gdb/doc/gdb.texinfo 15 Apr 2009 22:20:32 -0000 1.580
+++ gdb/doc/gdb.texinfo 20 Apr 2009 20:18:00 -0000
@@ -5809,6 +5809,18 @@
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}
+You can configure a default source path substitution rule by
+configuring @value{GDBN} with the
+@samp{--with-relocated-sources=@var{path}} option. The @var{path}
+should be the name of a directory under @value{GDBN}'s configured
+binary prefix (set with @samp{--prefix} or @samp{--exec-prefix}), and
+paths in debug information under @var{path} will be relocated
+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
+distributed together.
+
@table @code
@item directory @var{dirname} @dots{}
@item dir @var{dirname} @dots{}
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add --with-relocated-sources configure option
2009-04-20 20:26 Add --with-relocated-sources configure option Joseph S. Myers
@ 2009-04-20 21:10 ` Eli Zaretskii
2009-04-20 23:15 ` Joseph S. Myers
2009-04-20 21:36 ` Tom Tromey
1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-04-20 21:10 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gdb-patches
> Date: Mon, 20 Apr 2009 20:26:08 +0000 (UTC)
> From: "Joseph S. Myers" <joseph@codesourcery.com>
>
> gdb/doc:
> 2009-04-20 Joseph Myers <joseph@codesourcery.com>
>
> * gdb.texinfo (Source Path): Document --with-relocated-sources.
This part is okay (assuming that the code is approved), with a few
comments:
> +@cindex @samp{--with-relocated-sources}
> +You can configure a default source path substitution rule by
> +configuring @value{GDBN} with the
This needs an additional index entry which does not require to
remember the name of the option by heart. Something like
@cindex default source path substitution
> +@samp{--with-relocated-sources=@var{path}} option. The @var{path}
> +should be the name of a directory under @value{GDBN}'s configured
> +binary prefix (set with @samp{--prefix} or @samp{--exec-prefix}), and
> +paths in debug information under @var{path} will be relocated
> +automatically if the installed @value{GDBN} is moved to a new
> +location.
First, GNU coding standards frown on using ``path'' for file names or
directory names (see the node "GNU Manuals" in standards.texi).
Second, the second part of the last sentence above, the one which
starts with "and paths", got me confused. Let's see if I understood
your intent. Assuming I configured GDB like this:
./configure --prefix=/some/dir --with-relocated-sources=/some/dir/bar
then, even if the GDB tree is moved to /elsewhere/foo, GDB will
automagically find its sources in /elsewhere/foo/bar. Is that true?
If it's true, then I suggest (1) to drop the word "binary" in "binary
prefix", and (2) rephrase the "will be relocated automatically" part,
because nothing is actually relocated; rather, GDB substitutes the new
path for the old without any explicit command from the user. The text
as written suggests that files are somehow moved (``relocated'')
somewhere.
> This is useful if @value{GDBN}, libraries or executables
> +with debug information and corresponding source code are being
> +distributed together.
Don't you mean that this is useful if they are also _moved_ to a
different location together?
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add --with-relocated-sources configure option
2009-04-20 20:26 Add --with-relocated-sources configure option Joseph S. Myers
2009-04-20 21:10 ` Eli Zaretskii
@ 2009-04-20 21:36 ` Tom Tromey
1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-04-20 21:36 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gdb-patches
>>>>> "Joseph" == Joseph S Myers <joseph@codesourcery.com> writes:
Joseph> +AC_ARG_WITH(relocated-sources,
Joseph> +[ --with-relocated-sources=path Automatically relocate this path for source files],
I'd prefer it if all new options use AC_HELP_STRING.
Ok with that change.
thanks,
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add --with-relocated-sources configure option
2009-04-20 21:10 ` Eli Zaretskii
@ 2009-04-20 23:15 ` Joseph S. Myers
2009-04-20 23:55 ` Tom Tromey
2009-04-21 3:15 ` Eli Zaretskii
0 siblings, 2 replies; 6+ messages in thread
From: Joseph S. Myers @ 2009-04-20 23:15 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Tue, 21 Apr 2009, Eli Zaretskii wrote:
> > Date: Mon, 20 Apr 2009 20:26:08 +0000 (UTC)
> > From: "Joseph S. Myers" <joseph@codesourcery.com>
> >
> > gdb/doc:
> > 2009-04-20 Joseph Myers <joseph@codesourcery.com>
> >
> > * gdb.texinfo (Source Path): Document --with-relocated-sources.
>
> This part is okay (assuming that the code is approved), with a few
> comments:
How does the documentation in this revised version of the patch seem?
I've also updated the configure support to use AC_HELP_STRING as requested
by Tom.
> Second, the second part of the last sentence above, the one which
> starts with "and paths", got me confused. Let's see if I understood
> your intent. Assuming I configured GDB like this:
>
> ./configure --prefix=/some/dir --with-relocated-sources=/some/dir/bar
>
> then, even if the GDB tree is moved to /elsewhere/foo, GDB will
> automagically find its sources in /elsewhere/foo/bar. Is that true?
Yes.
> > This is useful if @value{GDBN}, libraries or executables
> > +with debug information and corresponding source code are being
> > +distributed together.
>
> Don't you mean that this is useful if they are also _moved_ to a
> different location together?
Yes; I was thinking moved via being distributed (packaged on one system,
unpacked on another).
gdb:
2009-04-20 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.
gdb/doc:
2009-04-20 Joseph Myers <joseph@codesourcery.com>
* gdb.texinfo (Source Path): Document --with-relocated-sources.
Index: gdb/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.93
diff -u -r1.93 configure.ac
--- gdb/configure.ac 17 Apr 2009 17:44:04 -0000 1.93
+++ gdb/configure.ac 20 Apr 2009 23:10:35 -0000
@@ -118,6 +118,13 @@
;;
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: gdb/main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.73
diff -u -r1.73 main.c
--- gdb/main.c 28 Jan 2009 15:01:00 -0000 1.73
+++ gdb/main.c 20 Apr 2009 23:10:35 -0000
@@ -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 @@
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: gdb/source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.96
diff -u -r1.96 source.c
--- gdb/source.c 13 Mar 2009 02:34:13 -0000 1.96
+++ gdb/source.c 20 Apr 2009 23:10:35 -0000
@@ -1746,7 +1746,7 @@
/* 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: gdb/source.h
===================================================================
RCS file: /cvs/src/src/gdb/source.h,v
retrieving revision 1.10
diff -u -r1.10 source.h
--- gdb/source.h 3 Jan 2009 05:57:53 -0000 1.10
+++ gdb/source.h 20 Apr 2009 23:10:35 -0000
@@ -66,4 +66,7 @@
/* 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
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.580
diff -u -r1.580 gdb.texinfo
--- gdb/doc/gdb.texinfo 15 Apr 2009 22:20:32 -0000 1.580
+++ gdb/doc/gdb.texinfo 20 Apr 2009 23:10:44 -0000
@@ -5809,6 +5809,19 @@
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{}
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add --with-relocated-sources configure option
2009-04-20 23:15 ` Joseph S. Myers
@ 2009-04-20 23:55 ` Tom Tromey
2009-04-21 3:15 ` Eli Zaretskii
1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-04-20 23:55 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: Eli Zaretskii, gdb-patches
>>>>> "Joseph" == Joseph S Myers <joseph@codesourcery.com> writes:
Joseph> +AC_HELP_STRING([--with-relocated-sources=path], [Automatically relocate this path for source files]),
I missed this last time, but since you are getting another doc review
I thought I would point it out: `=path' should be `=PATH' here,
according to GNU rules.
I see a couple of places in configure --help that don't do this
properly. I will fix those shortly.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Add --with-relocated-sources configure option
2009-04-20 23:15 ` Joseph S. Myers
2009-04-20 23:55 ` Tom Tromey
@ 2009-04-21 3:15 ` Eli Zaretskii
1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2009-04-21 3:15 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gdb-patches
> Date: Mon, 20 Apr 2009 23:15:20 +0000 (UTC)
> From: "Joseph S. Myers" <joseph@codesourcery.com>
> cc: gdb-patches@sourceware.org
>
> On Tue, 21 Apr 2009, Eli Zaretskii wrote:
>
> > > Date: Mon, 20 Apr 2009 20:26:08 +0000 (UTC)
> > > From: "Joseph S. Myers" <joseph@codesourcery.com>
> > >
> > > gdb/doc:
> > > 2009-04-20 Joseph Myers <joseph@codesourcery.com>
> > >
> > > * gdb.texinfo (Source Path): Document --with-relocated-sources.
> >
> > This part is okay (assuming that the code is approved), with a few
> > comments:
>
> How does the documentation in this revised version of the patch seem?
Looks good to me, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-21 3:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-20 20:26 Add --with-relocated-sources configure option Joseph S. Myers
2009-04-20 21:10 ` Eli Zaretskii
2009-04-20 23:15 ` Joseph S. Myers
2009-04-20 23:55 ` Tom Tromey
2009-04-21 3:15 ` Eli Zaretskii
2009-04-20 21:36 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox