Fix 316144 (valgrind.1 manpage contains ??? strings for references)
Patch by Mark Wielaard.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13314 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/NEWS b/NEWS
index f6abe29..a07a301 100644
--- a/NEWS
+++ b/NEWS
@@ -217,6 +217,7 @@
         FIXED 13294
 
 315545    [390] (find_TTEntry_from_hcode): Assertion '(UChar*)sec->tt[tteNo].tcptr <= (UChar*)hcode' failed
+316144    [390] valgrind.1 manpage contains unknown ??? strings for some core option references
 n-i-bz    [390] report error for vgdb snapshot requested before execution
 n-i-bz    [390] Some wrong command line options could be ignored
 n-i-bz    [390] same as 303624 (fixed in 3.8.0), but for x86 android
diff --git a/docs/xml/manual-core-adv.xml b/docs/xml/manual-core-adv.xml
index 2a022a0..00376a1 100644
--- a/docs/xml/manual-core-adv.xml
+++ b/docs/xml/manual-core-adv.xml
@@ -293,9 +293,9 @@
 
 
 
-
-<sect1 id="manual-core-adv.gdbserver" 
-       xreflabel="Debugging your program using Valgrind's gdbserver and GDB">
+<!-- Referenced from both the manual and manpage -->
+<sect1 id="&vg-gdbserver-id;"
+       xreflabel="&vg-gdbserver-label;">
 <title>Debugging your program using Valgrind gdbserver and GDB</title>
 
 <para>A program running under Valgrind is not executed directly by the
@@ -381,7 +381,7 @@
 <para>GDB can use various kinds of channels (TCP/IP, serial line, etc)
 to communicate with the gdbserver.  In the case of Valgrind's
 gdbserver, communication is done via a pipe and a small helper program
-called <xref linkend="manual-core-adv.vgdb"/>, which acts as an
+called <xref linkend="&vg-vgdb-id;"/>, which acts as an
 intermediary.  If no GDB is in use, vgdb can also be
 used to send monitor commands to the Valgrind gdbserver from a shell
 command line.
@@ -586,7 +586,7 @@
 sent from the GDB command line or from the shell command line or
 requested by the client program using the VALGRIND_MONITOR_COMMAND
 client request.  See
-<xref linkend="manual-core-adv.valgrind-monitor-commands"/> for the
+<xref linkend="&vg-monitor-id;"/> for the
 list of the Valgrind core monitor commands available regardless of the
 Valgrind tool selected.
 </para>
@@ -1105,8 +1105,9 @@
 
 </sect2>
 
-<sect2 id="manual-core-adv.vgdb"
-       xreflabel="vgdb">
+<!-- Referenced from both the manual and manpage -->
+<sect2 id="&vg-vgdb-id;"
+       xreflabel="&vg-vgdb-label;">
 <title>vgdb command line options</title>
 <para> Usage: <computeroutput>vgdb [OPTION]... [[-c] COMMAND]...</computeroutput></para>
 
@@ -1254,8 +1255,9 @@
 </sect2>
 
 
-<sect2 id="manual-core-adv.valgrind-monitor-commands" 
-       xreflabel="Valgrind monitor commands">
+<!-- Referenced from both the manual and manpage -->
+<sect2 id="&vg-monitor-id;"
+       xreflabel="&vg-monitor-label;">
 <title>Valgrind monitor commands</title>
 
 <para>This section describes the Valgrind monitor commands, available
diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml
index 70b0989..a60c3a4 100644
--- a/docs/xml/manual-core.xml
+++ b/docs/xml/manual-core.xml
@@ -152,7 +152,8 @@
 </sect1>
 
 
-<sect1 id="manual-core.comment" xreflabel="The Commentary">
+<!-- Referenced from both the manual and manpage -->
+<sect1 id="&vg-comment-id;" xreflabel="&vg-comment-label;">
 <title>The Commentary</title>
 
 <para>Valgrind tools write a commentary, a stream of text, detailing
@@ -857,7 +858,7 @@
       be used in conjunction with the
       <computeroutput>valgrind-listener</computeroutput> program.  For
       further details, see 
-      <link linkend="manual-core.comment">the commentary</link>
+      <link linkend="&vg-comment-id;">the commentary</link>
       in the manual.</para>
     </listitem>
   </varlistentry>
@@ -1755,7 +1756,7 @@
       between fairness and performance. For more details about the
       Valgrind thread serialisation scheme and its impact on
       performance and thread scheduling, see
-      <xref linkend="manual-core.pthreads_perf_sched"/>.
+      <xref linkend="&vg-pthreads-perf-sched-id;"/>.
 
       <itemizedlist>
         <listitem> <para>The value <option>--fair-sched=yes</option>
@@ -2084,7 +2085,8 @@
 sharing will fail.
 </para>
 
-<sect2 id="manual-core.pthreads_perf_sched" xreflabel="Scheduling and Multi-Thread Performance">
+<!-- Referenced from both the manual and manpage -->
+<sect2 id="&vg-pthreads-perf-sched-id;" xreflabel="&vg-pthreads-perf-sched-label;">
 <title>Scheduling and Multi-Thread Performance</title>
 
 <para>A thread executes code only when it holds the abovementioned
diff --git a/docs/xml/valgrind-manpage.xml b/docs/xml/valgrind-manpage.xml
index 8f2f630..bd4b924 100644
--- a/docs/xml/valgrind-manpage.xml
+++ b/docs/xml/valgrind-manpage.xml
@@ -240,7 +240,22 @@
 callgrind_control(1),
 ms_print(1),
 <filename>&vg-docs-path;</filename> or
-<filename>&vg-docs-url;</filename>.
+<filename>&vg-docs-url;</filename>,
+<ulink id="&vg-gdbserver-id;"
+       xreflabel="&vg-gdbserver-label;"
+       url="&vg-gdbserver-url;">&vg-gdbserver-label;</ulink>
+<ulink id="&vg-vgdb-id;"
+       xreflabel="&vg-vgdb-label;"
+       url="&vg-vgdb-url;">&vg-vgdb-label;</ulink>,
+<ulink id="&vg-monitor-id;"
+       xreflabel="&vg-monitor-label;"
+       url="&vg-monitor-url;">&vg-monitor-label;</ulink>,
+<ulink id="&vg-comment-id;"
+       xreflabel="&vg-comment-label;"
+       url="&vg-comment-url;">&vg-comment-label;</ulink>,
+<ulink id="&vg-pthreads-perf-sched-id;"
+       xreflabel="&vg-pthreads-perf-sched-label;"
+       url="&vg-pthreads-perf-sched-url;">&vg-pthreads-perf-sched-label;</ulink>.
 </para>
 
 </refsect1>
diff --git a/docs/xml/vg-entities.xml b/docs/xml/vg-entities.xml
index e65ed3e..f5994c1 100644
--- a/docs/xml/vg-entities.xml
+++ b/docs/xml/vg-entities.xml
@@ -23,4 +23,38 @@
 <!ENTITY vg-docs-url   "http://www.valgrind.org/docs/manual/index.html">
 <!ENTITY cl-gui-url    "http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindIndex">
 
+<!-- Some references are used between core manual manual and manpages. -->
+<!-- Define them here so the can easily be used in both places.  -->
+<!-- See manual-core*.xml and valgrind-manpage.xml -->
+<!ENTITY vg-manual-url "http://www.valgrind.org/docs/manual/">
+
+<!ENTITY vg-gdbserver-manual "manual-core-adv">
+<!ENTITY vg-gdbserver-ref "gdbserver">
+<!ENTITY vg-gdbserver-label "Debugging your program using Valgrind's gdbserver and GDB">
+<!ENTITY vg-gdbserver-id "&vg-gdbserver-manual;.&vg-gdbserver-ref;">
+<!ENTITY vg-gdbserver-url "&vg-manual-url;&vg-gdbserver-manual;.html#&vg-gdbserver-id;">
+
+<!ENTITY vg-vgdb-manual "manual-core-adv">
+<!ENTITY vg-vgdb-ref "vgdb">
+<!ENTITY vg-vgdb-label "vgdb">
+<!ENTITY vg-vgdb-id "&vg-vgdb-manual;.&vg-vgdb-ref;">
+<!ENTITY vg-vgdb-url "&vg-manual-url;&vg-vgdb-manual;.html#&vg-vgdb-id;">
+
+<!ENTITY vg-monitor-manual "manual-core-adv">
+<!ENTITY vg-monitor-ref "valgrind-monitor-commands">
+<!ENTITY vg-monitor-label "Valgrind monitor commands">
+<!ENTITY vg-monitor-id "&vg-monitor-manual;.&vg-monitor-ref;">
+<!ENTITY vg-monitor-url "&vg-manual-url;&vg-monitor-manual;.html#&vg-monitor-id;">
+
+<!ENTITY vg-comment-manual "manual-core">
+<!ENTITY vg-comment-ref "comment">
+<!ENTITY vg-comment-label "The Commentary">
+<!ENTITY vg-comment-id "&vg-comment-manual;.&vg-comment-ref;">
+<!ENTITY vg-comment-url "&vg-manual-url;&vg-comment-manual;.html#&vg-comment-id;">
+
+<!ENTITY vg-pthreads-perf-sched-manual "manual-core">
+<!ENTITY vg-pthreads-perf-sched-ref "pthreads_perf_sched">
+<!ENTITY vg-pthreads-perf-sched-label "Scheduling and Multi-Thread Performance">
+<!ENTITY vg-pthreads-perf-sched-id "&vg-pthreads-perf-sched-manual;.&vg-pthreads-perf-sched-ref;">
+<!ENTITY vg-pthreads-perf-sched-url "&vg-manual-url;&vg-pthreads-perf-sched-manual;.html#&vg-pthreads-perf-sched-id;">