From e71da632ea31fbff035556f044b11333840e2a97 Mon Sep 17 00:00:00 2001 From: Mark Heffernan Date: Thu, 7 May 2009 19:58:10 +0000 Subject: [PATCH] invoke.texi (Debugging Options): Document change of debugging dump location. 2009-05-07 Mark Heffernan * 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. From-SVN: r147249 --- gcc/ChangeLog | 7 ++++++ gcc/doc/invoke.texi | 58 ++++++++++++++++++++++++++------------------- gcc/opts.c | 21 ++++++++++++++++ 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d4008431d48..84606104947 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2009-05-07 Mark Heffernan + + * 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. + 2009-05-07 Hariharan Sandanagobalane * config/picochip/picochip.h (NO_DOLLAR_IN_LABEL): Added. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 0021e800916..2674c47ef89 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4585,13 +4585,14 @@ and dbg_cnt(tail_call) will return false always. @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 particular with and without @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 described for the @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 diff --git a/gcc/opts.c b/gcc/opts.c index 1170967b949..aab540c0399 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -961,6 +961,27 @@ decode_options (unsigned int argc, const char **argv) 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)