This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, testsuite] Add missing -gdwarf-2 flag in debug/dwarf2 testcase
- From: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Mike Stump <mikestump at comcast dot net>, "gcc at gcc dot gnu dot org List" <gcc at gcc dot gnu dot org>, "dodji at redhat dot com Seketeli" <dodji at redhat dot com>, "janisjo at codesourcery dot com Johnson" <janisjo at codesourcery dot com>
- Date: Tue, 9 Apr 2013 21:25:34 +0530
- Subject: Re: [Patch, testsuite] Add missing -gdwarf-2 flag in debug/dwarf2 testcase
- References: <20130330062307 dot GA13331 at atmel dot com> <515A37AA dot 1050702 at redhat dot com> <F1D390C2-2D95-48F2-AFB5-210F895FD80F at comcast dot net> <20130402130743 dot GA20532 at atmel dot com> <515AF498 dot 7000107 at redhat dot com> <20130402192420 dot GA23848 at atmel dot com> <515CEE58 dot 3010501 at redhat dot com> <20130404154841 dot GA7184 at atmel dot com> <515DBB4A dot 2090502 at redhat dot com> <20130404183246 dot GA13587 at atmel dot com>
On Fri, Apr 05, 2013 at 12:02:49AM +0530, Senthil Kumar Selvaraj wrote:
> On Thu, Apr 04, 2013 at 01:41:30PM -0400, Jason Merrill wrote:
> > On 04/04/2013 11:48 AM, Senthil Kumar Selvaraj wrote:
> > >+Common Var(dwarf_version, 4) Negative(gdwarf-)
> >
> > I don't think you need to mention the variable on this line; it's
> > already there and statically initialized for gdwarf-.
> >
> Yeah, you're right. I was originally attempting to use "value"
> directly, and that of course, didn't work as it was set to 1.
> Sorry, I should have been more careful.
>
> > >I wasn't able to get this done in a clean way. To make the gdwarf option
> > >handling code detect this error, the only I found was to make it
> > >JoinedOrMissing, and then raise the error if there was an argument
> > >provided.
> >
> > That sounds clean enough to me.
> >
>
> Ok, I thought it was odd to specify that gdwarf has an optional
> argument in the opt file, only to reject it outright when processing it.
> Will send another patch tomorrow.
I added detection and error emission if version is specified with
gdwarf. Does this look ok?
Regards
Senthil
diff --git gcc/common.opt gcc/common.opt
index e02e7ed..e3645c3 100644
--- gcc/common.opt
+++ gcc/common.opt
@@ -2308,9 +2308,13 @@ Common JoinedOrMissing
Generate debug information in default format
gcoff
-Common JoinedOrMissing Negative(gdwarf-)
+Common JoinedOrMissing Negative(gdwarf)
Generate debug information in COFF format
+gdwarf
+Common JoinedOrMissing UInteger Negative(gdwarf-)
+Generate debug information in the default DWARF version format
+
gdwarf-
Common Joined UInteger Var(dwarf_version) Init(4) Negative(gstabs)
Generate debug information in DWARF v2 (or later) format
diff --git gcc/opts.c gcc/opts.c
index 45b12fe..4bfee42 100644
--- gcc/opts.c
+++ gcc/opts.c
@@ -1699,6 +1699,17 @@ common_handle_option (struct gcc_options *opts,
set_debug_level (SDB_DEBUG, false, arg, opts, opts_set, loc);
break;
+ case OPT_gdwarf:
+ if (arg && strlen(arg) != 0)
+ {
+ error_at (loc, "dwarf version is not allowed. "
+ "Try -gdwarf-%d or -g%d instead.", value, value);
+ break;
+ }
+ else
+ {
+ value = opts->x_dwarf_version;
+ }
case OPT_gdwarf_:
if (value < 2 || value > 4)
error_at (loc, "dwarf version %d is not supported", value);