public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61574] New: Confusing .debug_line generation by -g option
@ 2014-06-20 18:23 jamesgua at ca dot ibm.com
  2014-06-20 20:05 ` [Bug c++/61574] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jamesgua at ca dot ibm.com @ 2014-06-20 18:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61574

            Bug ID: 61574
           Summary: Confusing .debug_line generation by -g option
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jamesgua at ca dot ibm.com

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char** argv)
{
  string str1 = "Hello";
  string str2;

  str2 = str1;
  cout << "str2: " << str2 << ", and same as str1: " << str1 << endl;

  str2 += "World!";
  cout << "Now str2: " << str2 << endl;

  return 0;
}

g++ -g -osample sample.cpp
gdb ./sample
...
Breakpoint 1, main (argc=1, argv=0x3ffffffff4f8) at sample.cpp:17
17        return 0;
(gdb) n
9         string str2;
(gdb)
17        return 0;
(gdb)
18      }
...
This is really confusing and out of sequential execution expectation. It
happens on x86_64/ppcl4le platform using g++ 4.8.2. 
Output from cmd: readelf --debug-dump=decodedline sample
...
sample.cpp                                    17          0x10000e90
sample.cpp                                     9          0x10000e94
sample.cpp                                    17          0x10000ea4
sample.cpp                                     9          0x10000ee4
sample.cpp                                    17          0x10000efc
...


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

* [Bug c++/61574] Confusing .debug_line generation by -g option
  2014-06-20 18:23 [Bug c++/61574] New: Confusing .debug_line generation by -g option jamesgua at ca dot ibm.com
@ 2014-06-20 20:05 ` pinskia at gcc dot gnu.org
  2014-06-22  1:32 ` jamesgua at ca dot ibm.com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-06-20 20:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61574

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is deconstructors.


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

* [Bug c++/61574] Confusing .debug_line generation by -g option
  2014-06-20 18:23 [Bug c++/61574] New: Confusing .debug_line generation by -g option jamesgua at ca dot ibm.com
  2014-06-20 20:05 ` [Bug c++/61574] " pinskia at gcc dot gnu.org
@ 2014-06-22  1:32 ` jamesgua at ca dot ibm.com
  2014-06-22  2:44 ` pinskia at gcc dot gnu.org
  2014-06-23 11:52 ` jamesgua at ca dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: jamesgua at ca dot ibm.com @ 2014-06-22  1:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61574

--- Comment #2 from jamesgua at ca dot ibm.com ---
(In reply to Andrew Pinski from comment #1)
> This is deconstructors.

I mean why we have those line numbers "17 9 17 9 17", debugger follow the line
number information and user may think the program running backward instead the
incremental way. This is not intuitive.


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

* [Bug c++/61574] Confusing .debug_line generation by -g option
  2014-06-20 18:23 [Bug c++/61574] New: Confusing .debug_line generation by -g option jamesgua at ca dot ibm.com
  2014-06-20 20:05 ` [Bug c++/61574] " pinskia at gcc dot gnu.org
  2014-06-22  1:32 ` jamesgua at ca dot ibm.com
@ 2014-06-22  2:44 ` pinskia at gcc dot gnu.org
  2014-06-23 11:52 ` jamesgua at ca dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-06-22  2:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61574

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to jamesgua from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > This is deconstructors.
> 
> I mean why we have those line numbers "17 9 17 9 17", debugger follow the
> line number information and user may think the program running backward
> instead the incremental way. This is not intuitive.

Yes I know. I was just saying what is causing it. And I think there might be
another bug for this already too.


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

* [Bug c++/61574] Confusing .debug_line generation by -g option
  2014-06-20 18:23 [Bug c++/61574] New: Confusing .debug_line generation by -g option jamesgua at ca dot ibm.com
                   ` (2 preceding siblings ...)
  2014-06-22  2:44 ` pinskia at gcc dot gnu.org
@ 2014-06-23 11:52 ` jamesgua at ca dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: jamesgua at ca dot ibm.com @ 2014-06-23 11:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61574

--- Comment #4 from jamesgua at ca dot ibm.com ---
Found the same issue with G++ 4.6.1 on zLinux.


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

end of thread, other threads:[~2014-06-23 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-20 18:23 [Bug c++/61574] New: Confusing .debug_line generation by -g option jamesgua at ca dot ibm.com
2014-06-20 20:05 ` [Bug c++/61574] " pinskia at gcc dot gnu.org
2014-06-22  1:32 ` jamesgua at ca dot ibm.com
2014-06-22  2:44 ` pinskia at gcc dot gnu.org
2014-06-23 11:52 ` jamesgua at ca dot ibm.com

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).