public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Effect of 'register' keyword on debug info
       [not found] ` <mcrlikituoi.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
@ 2012-05-24  7:03   ` Rohit Arul Raj
  2012-05-24 14:53     ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Rohit Arul Raj @ 2012-05-24  7:03 UTC (permalink / raw)
  To: gcc-help; +Cc: Ian Lance Taylor

On Thu, May 24, 2012 at 3:40 AM, Ian Lance Taylor <iant@google.com> wrote:
> Rohit Arul Raj <rohitarulraj@gmail.com> writes:
>
>> Looking at the debug info and the generated assembly, the values of
>> variables 'f1' and 'd1' are stored in the same register.
>> Due to this, while debugging, after setting the break point at (A)
>> [line no 8], if we print the value of 'f1' i get the wrong value.
>
>
>> Q: Is this the side effect of using 'register' keyword? If 'f1' is
>> getting optimized out, shouldn't we get that info while debugging?
>
> This question as stated is not really appropriate for the mailing list
> gcc@gcc.gnu.org, which is for the development of GCC itself.  This
> question would be appropriate for gcc-help@gcc.gnu.org.  Please take any
> followups to gcc-help.  Thanks.
>
> This has nothing to do with using the register keyword.
>
> Yes, you should ideally be told when a value is unavailable.  This
> specific area of GCC has been much improved since GCC 4.5.2.
>

Thanks Ian.
I tried with gcc v4.6.3 and get the same behavior.
Should this be considered as a bug with debug info generation then?

>
>> Also, using -fvar-tracking, i get this output while debugging the same
>> code.
>
> That looks like better output to me.
>
> Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Effect of 'register' keyword on debug info
  2012-05-24  7:03   ` Effect of 'register' keyword on debug info Rohit Arul Raj
@ 2012-05-24 14:53     ` Ian Lance Taylor
  2012-05-25  8:07       ` Rohit Arul Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2012-05-24 14:53 UTC (permalink / raw)
  To: Rohit Arul Raj; +Cc: gcc-help

Rohit Arul Raj <rohitarulraj@gmail.com> writes:

> On Thu, May 24, 2012 at 3:40 AM, Ian Lance Taylor <iant@google.com> wrote:
>> Rohit Arul Raj <rohitarulraj@gmail.com> writes:
>>
>>> Looking at the debug info and the generated assembly, the values of
>>> variables 'f1' and 'd1' are stored in the same register.
>>> Due to this, while debugging, after setting the break point at (A)
>>> [line no 8], if we print the value of 'f1' i get the wrong value.
>>
>>
>>> Q: Is this the side effect of using 'register' keyword? If 'f1' is
>>> getting optimized out, shouldn't we get that info while debugging?
>>
>> This question as stated is not really appropriate for the mailing list
>> gcc@gcc.gnu.org, which is for the development of GCC itself.  This
>> question would be appropriate for gcc-help@gcc.gnu.org.  Please take any
>> followups to gcc-help.  Thanks.
>>
>> This has nothing to do with using the register keyword.
>>
>> Yes, you should ideally be told when a value is unavailable.  This
>> specific area of GCC has been much improved since GCC 4.5.2.
>>
>
> Thanks Ian.
> I tried with gcc v4.6.3 and get the same behavior.
> Should this be considered as a bug with debug info generation then?

Yes.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Effect of 'register' keyword on debug info
  2012-05-24 14:53     ` Ian Lance Taylor
@ 2012-05-25  8:07       ` Rohit Arul Raj
  2012-05-25 13:12         ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Rohit Arul Raj @ 2012-05-25  8:07 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On Thu, May 24, 2012 at 8:23 PM, Ian Lance Taylor <iant@google.com> wrote:
> Rohit Arul Raj <rohitarulraj@gmail.com> writes:
>
>> On Thu, May 24, 2012 at 3:40 AM, Ian Lance Taylor <iant@google.com> wrote:
>>> Rohit Arul Raj <rohitarulraj@gmail.com> writes:
>>>
>>>> Looking at the debug info and the generated assembly, the values of
>>>> variables 'f1' and 'd1' are stored in the same register.
>>>> Due to this, while debugging, after setting the break point at (A)
>>>> [line no 8], if we print the value of 'f1' i get the wrong value.
>>>
>>>
>>>> Q: Is this the side effect of using 'register' keyword? If 'f1' is
>>>> getting optimized out, shouldn't we get that info while debugging?
>>>
>>> This question as stated is not really appropriate for the mailing list
>>> gcc@gcc.gnu.org, which is for the development of GCC itself.  This
>>> question would be appropriate for gcc-help@gcc.gnu.org.  Please take any
>>> followups to gcc-help.  Thanks.
>>>
>>> This has nothing to do with using the register keyword.
>>>
>>> Yes, you should ideally be told when a value is unavailable.  This
>>> specific area of GCC has been much improved since GCC 4.5.2.
>>>
>>
>> Thanks Ian.
>> I tried with gcc v4.6.3 and get the same behavior.
>> Should this be considered as a bug with debug info generation then?
>
> Yes.
>
> Ian

Further, by default the debug info for variables 'd1' and 'f1' are
generated as location expressions. Where as with '-fvar-tracking', the
debug info is generated as location lists.

1) Is it possible to generate location expressions to identify that
the variable has been optimized out?
2) If (1) is not possible and if '-fvar-tracking' gives accurate info
on live variables, why isn't it turned ON by default at '-O0'?

Since the code is compiled at '-O0' should correct debug info be generated?

Thanks for the help,
Rohit

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Effect of 'register' keyword on debug info
  2012-05-25  8:07       ` Rohit Arul Raj
@ 2012-05-25 13:12         ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2012-05-25 13:12 UTC (permalink / raw)
  To: Rohit Arul Raj; +Cc: gcc-help

Rohit Arul Raj <rohitarulraj@gmail.com> writes:

> Further, by default the debug info for variables 'd1' and 'f1' are
> generated as location expressions. Where as with '-fvar-tracking', the
> debug info is generated as location lists.
>
> 1) Is it possible to generate location expressions to identify that
> the variable has been optimized out?

I don't know.

> 2) If (1) is not possible and if '-fvar-tracking' gives accurate info
> on live variables, why isn't it turned ON by default at '-O0'?

That is a good question.  Right now -fvar-tracking is turned on by
default at -O1.  I guess the assumption was that at -O0 variables
wouldn't wind up in the same register.

> Since the code is compiled at '-O0' should correct debug info be generated?

Yes.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-25 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAPVMLfWHqD2caZroPUWPPOcgOOThBw0+YksZ1F9SXS2hbH64XQ@mail.gmail.com>
     [not found] ` <mcrlikituoi.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
2012-05-24  7:03   ` Effect of 'register' keyword on debug info Rohit Arul Raj
2012-05-24 14:53     ` Ian Lance Taylor
2012-05-25  8:07       ` Rohit Arul Raj
2012-05-25 13:12         ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).