This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] flag to create dump files in same directory as object files


On Wed, May 6, 2009 at 1:32 PM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> I'm sure you can't mean "user-visible semantics were changed, but since
> the old ones weren't documented, the new don't need documenting now".
> Would you open a PR on this, please, if you don't intend to fix the
> documentation?

Fair enough.  Below is the patch with the invoke.texi changes.

cheers,

Mark

2009-05-07  Mark Heffernan  <meheff@google.com>

	* doc/invoke.texi (Debugging Options): Document change of debugging
	dump location.
        * opts.c (decode_options): Make dump_base_name relative to
	aux_base_name directory.


Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi     (revision 147106)
+++ doc/invoke.texi     (working copy)
@@ -4585,13 +4585,14 @@ and dbg_cnt(tail_call) will return false
 @itemx -fdump-rtl-@var{pass}
 @opindex d
 Says to make debugging dumps during compilation at times specified by
-@var{letters}.    This is used for debugging the RTL-based passes of the
-compiler.  The file names for most of the dumps are made by appending a
-pass number and a word to the @var{dumpname}.  @var{dumpname} is generated
-from the name of the output file, if explicitly specified and it is not
-an executable, otherwise it is the basename of the source file. These
-switches may have different effects when @option{-E} is used for
-preprocessing.
+@var{letters}.  This is used for debugging the RTL-based passes of the
+compiler.  The file names for most of the dumps are made by appending
+a pass number and a word to the @var{dumpname}, and the files are
+created in the directory of the output file.  @var{dumpname} is
+generated from the name of the output file, if explicitly specified
+and it is not an executable, otherwise it is the basename of the
+source file. These switches may have different effects when
+@option{-E} is used for preprocessing.

 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
 @option{-d} option @var{letters}.  Here are the possible
@@ -4919,7 +4920,8 @@ invocations with different options, in p
 @opindex fdump-translation-unit
 Dump a representation of the tree structure for the entire translation
 unit to a file.  The file name is made by appending @file{.tu} to the
-source file name.  If the @samp{-@var{options}} form is used, @var{options}
+source file name, and the file is created in the same directory as the
+output file.  If the @samp{-@var{options}} form is used, @var{options}
 controls the details of the dump as described for the
 @option{-fdump-tree} options.

@@ -4927,16 +4929,19 @@ controls the details of the dump as desc
 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
 @opindex fdump-class-hierarchy
 Dump a representation of each class's hierarchy and virtual function
-table layout to a file.  The file name is made by appending @file{.class}
-to the source file name.  If the @samp{-@var{options}} form is used,
-@var{options} controls the details of the dump as described for the
-@option{-fdump-tree} options.
+table layout to a file.  The file name is made by appending
+@file{.class} to the source file name, and the file is created in the
+same directory as the output file.  If the @samp{-@var{options}} form
+is used, @var{options} controls the details of the dump as described
+for the @option{-fdump-tree} options.

 @item -fdump-ipa-@var{switch}
 @opindex fdump-ipa
 Control the dumping at various stages of inter-procedural analysis
-language tree to a file.  The file name is generated by appending a switch
-specific suffix to the source file name.  The following dumps are possible:
+language tree to a file.  The file name is generated by appending a
+switch specific suffix to the source file name, and the file is created
+in the same directory as the output file.  The following dumps are
+possible:

 @table @samp
 @item all
@@ -4954,22 +4959,25 @@ Dump after function inlining.
 @item -fdump-statistics-@var{option}
 @opindex -fdump-statistics
 Enable and control dumping of pass statistics in a separate file.  The
-file name is generated by appending a suffix ending in @samp{.statistics}
-to the source file name.  If the @samp{-@var{option}} form is used,
-@samp{-stats} will cause counters to be summed over the whole compilation unit
-while @samp{-details} will dump every event as the passes generate them.
-The default with no option is to sum counters for each function compiled.
+file name is generated by appending a suffix ending in
+@samp{.statistics} to the source file name, and the file is created in
+the same directory as the output file.  If the @samp{-@var{option}}
+form is used, @samp{-stats} will cause counters to be summed over the
+whole compilation unit while @samp{-details} will dump every event as
+the passes generate them.  The default with no option is to sum
+counters for each function compiled.

 @item -fdump-tree-@var{switch}
 @itemx -fdump-tree-@var{switch}-@var{options}
 @opindex fdump-tree
 Control the dumping at various stages of processing the intermediate
-language tree to a file.  The file name is generated by appending a switch
-specific suffix to the source file name.  If the @samp{-@var{options}}
-form is used, @var{options} is a list of @samp{-} separated options that
-control the details of the dump.  Not all options are applicable to all
-dumps, those which are not meaningful will be ignored.  The following
-options are available
+language tree to a file.  The file name is generated by appending a
+switch specific suffix to the source file name, and the file is
+created in the same directory as the output file.  If the
+@samp{-@var{options}} form is used, @var{options} is a list of
+@samp{-} separated options that control the details of the dump.  Not
+all options are applicable to all dumps, those which are not
+meaningful will be ignored.  The following options are available

 @table @samp
 @item address

Index: opts.c
===================================================================
--- opts.c      (revision 147106)
+++ opts.c      (working copy)
@@ -961,6 +961,27 @@ decode_options (unsigned int argc, const

   handle_options (argc, argv, lang_mask);

+  /* Make DUMP_BASE_NAME relative to the AUX_BASE_NAME directory,
+     typically the directory to contain the object file.  */
+  if (aux_base_name && ! IS_ABSOLUTE_PATH (dump_base_name))
+    {
+      const char *aux_base;
+
+      base_of_path (aux_base_name, &aux_base);
+      if (aux_base_name != aux_base)
+       {
+         int dir_len = aux_base - aux_base_name;
+         char *new_dump_base_name =
+           XNEWVEC (char, strlen(dump_base_name) + dir_len + 1);
+
+         /* Copy directory component from AUX_BASE_NAME.  */
+         memcpy (new_dump_base_name, aux_base_name, dir_len);
+         /* Append existing DUMP_BASE_NAME.  */
+         strcpy (new_dump_base_name + dir_len, dump_base_name);
+         dump_base_name = new_dump_base_name;
+       }
+    }
+
   /* Handle related options for unit-at-a-time, toplevel-reorder, and
      section-anchors.  */
   if (!flag_unit_at_a_time)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]