aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-23 22:26:41 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-23 22:26:41 +0000
commitdc5b5f05da2fe3c480ae63187a441fce3d964fb8 (patch)
tree36f3ff32f6cdf2a9f3d5cf0594a3f3666b82d543
parentcbcca16e658552387a0226faa7f26d76c3d810c0 (diff)
PR go/64595
* go-lang.c (go_langhook_init_options_struct): Set default debug_info_level. (go_langhook_post_options): If debug_info_level is still the default, make sure write_symbols is set. * gccgo.texi (Invoking gccgo): Document that -g1 is the default. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220064 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/go/ChangeLog9
-rw-r--r--gcc/go/gccgo.texi12
-rw-r--r--gcc/go/go-lang.c12
3 files changed, 33 insertions, 0 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index a2d236c1833..d525f5dd7cf 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,12 @@
+2015-01-23 Ian Lance Taylor <iant@google.com>
+
+ PR go/64595
+ * go-lang.c (go_langhook_init_options_struct): Set default
+ debug_info_level.
+ (go_langhook_post_options): If debug_info_level is still the
+ default, make sure write_symbols is set.
+ * gccgo.texi (Invoking gccgo): Document that -g1 is the default.
+
2015-01-16 Richard Henderson <rth@redhat.com>
* go-gcc.cc (Gcc_backend::call_expression): Add chain_expr argument.
diff --git a/gcc/go/gccgo.texi b/gcc/go/gccgo.texi
index 0dd493f38e1..45fc9d718e7 100644
--- a/gcc/go/gccgo.texi
+++ b/gcc/go/gccgo.texi
@@ -223,6 +223,18 @@ may be used. Or the checks may be removed via
@option{-fno-go-check-divide-overflow}. This option is currently on
by default, but in the future may be off by default on systems that do
not require it.
+
+@item -g
+@cindex @option{-g for gccgo}
+This is the standard @command{gcc} option (@pxref{Debugging Options, ,
+Debugging Options, gcc, Using the GNU Compiler Collection (GCC)}). It
+is mentioned here because by default @command{gccgo} turns on
+debugging information generation with the equivalent of the standard
+option @option{-g1}. This is because Go programs require debugging
+information to be available in order to get backtrace information. An
+explicit @option{-g0} may be used to disable the generation of
+debugging information, in which case certain standard library
+functions, such as @code{runtime.Callers}, will not operate correctly.
@end table
@c man end
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c
index 2797e99620c..fe5b583b51b 100644
--- a/gcc/go/go-lang.c
+++ b/gcc/go/go-lang.c
@@ -171,6 +171,12 @@ go_langhook_init_options_struct (struct gcc_options *opts)
/* Exceptions are used to handle recovering from panics. */
opts->x_flag_exceptions = 1;
opts->x_flag_non_call_exceptions = 1;
+
+ /* Go programs expect runtime.Callers to work, and that uses
+ libbacktrace that uses debug info. Set the debug info level to 1
+ by default. In post_options we will set the debug type if the
+ debug info level was not set back to 0 on the command line. */
+ opts->x_debug_info_level = DINFO_LEVEL_TERSE;
}
/* Infrastructure for a vector of char * pointers. */
@@ -289,6 +295,12 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
if (!global_options_set.x_flag_optimize_sibling_calls)
global_options.x_flag_optimize_sibling_calls = 0;
+ /* If the debug info level is still 1, as set in init_options, make
+ sure that some debugging type is selected. */
+ if (global_options.x_debug_info_level == DINFO_LEVEL_TERSE
+ && global_options.x_write_symbols == NO_DEBUG)
+ global_options.x_write_symbols = PREFERRED_DEBUGGING_TYPE;
+
/* Returning false means that the backend should be used. */
return false;
}