public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/12385] Full debug info not emitted for C++ classes with external virtual functions
       [not found] <bug-12385-4@http.gcc.gnu.org/bugzilla/>
@ 2024-01-23 15:38 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-23 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.2.0
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
I see now with GCC 13.2 (with GCC 7.5 'test' is missing):

 <1><29>: Abbrev Number: 2 (DW_TAG_class_type)
    <2a>   DW_AT_name        : (indirect string, offset: 0xe4): ObjectBase
    <2e>   DW_AT_declaration : 1
    <2e>   DW_AT_sibling     : <0x85>
 <2><32>: Abbrev Number: 3 (DW_TAG_subprogram)
    <33>   DW_AT_external    : 1
    <33>   DW_AT_name        : (indirect string, offset: 0xa4): test
    <37>   DW_AT_decl_file   : 1
    <38>   DW_AT_decl_line   : 4
    <39>   DW_AT_decl_column : 16
    <3a>   DW_AT_linkage_name: (indirect string, offset: 0x88):
_ZN10ObjectBase4testEv
    <3e>   DW_AT_virtuality  : 1        (virtual)
    <3f>   DW_AT_vtable_elem_location: 2 byte block: 10 0       (DW_OP_constu:
0)
    <42>   DW_AT_containing_type: <0x29>
    <46>   DW_AT_accessibility: 1       (public)
    <47>   DW_AT_declaration : 1
    <47>   DW_AT_object_pointer: <0x4f>
    <4b>   DW_AT_sibling     : <0x55>
 <3><4f>: Abbrev Number: 4 (DW_TAG_formal_parameter)
    <50>   DW_AT_type        : <0x85>
    <54>   DW_AT_artificial  : 1
 <3><54>: Abbrev Number: 0
 <2><55>: Abbrev Number: 5 (DW_TAG_subprogram)
    <56>   DW_AT_external    : 1
    <56>   DW_AT_name        : (indirect string, offset: 0xe4): ObjectBase
    <5a>   DW_AT_linkage_name: (indirect string, offset: 0xae):
_ZN10ObjectBaseC4Ev
    <5e>   DW_AT_artificial  : 1
    <5e>   DW_AT_accessibility: 1       (public)
    <5f>   DW_AT_declaration : 1
    <5f>   DW_AT_object_pointer: <0x67>
    <63>   DW_AT_sibling     : <0x6d>
 <3><67>: Abbrev Number: 4 (DW_TAG_formal_parameter)
    <68>   DW_AT_type        : <0x85>
    <6c>   DW_AT_artificial  : 1
 <3><6c>: Abbrev Number: 0
 <2><6d>: Abbrev Number: 6 (DW_TAG_subprogram)
    <6e>   DW_AT_external    : 1
    <6e>   DW_AT_name        : (indirect string, offset: 0x14): test2
    <72>   DW_AT_decl_file   : 1
    <73>   DW_AT_decl_line   : 9
    <74>   DW_AT_decl_column : 6
    <75>   DW_AT_linkage_name: (indirect string, offset: 0xcc):
_ZN10ObjectBase5test2Ev
    <79>   DW_AT_accessibility: 1       (public)
    <7a>   DW_AT_declaration : 1
    <7a>   DW_AT_object_pointer: <0x7e>
 <3><7e>: Abbrev Number: 4 (DW_TAG_formal_parameter)
    <7f>   DW_AT_type        : <0x85>
    <83>   DW_AT_artificial  : 1
 <3><83>: Abbrev Number: 0
 <2><84>: Abbrev Number: 0

so both functions are there and so is the CTOR.  Thus fixed.

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

* [Bug debug/12385] Full debug info not emitted for C++ classes with external virtual functions
  2003-09-24  7:56 [Bug debug/12385] New: " sgjohnston at yahoo dot com
                   ` (2 preceding siblings ...)
  2003-10-10 14:18 ` drow at gcc dot gnu dot org
@ 2004-01-10  6:26 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-10  6:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-10 06:26 -------
Some more discussion about this problem: <http://gcc.gnu.org/ml/gcc/2004-01/
msg00117.html> (and no it looks like you took the same stance as your email).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Last reconfirmed|2003-10-10 14:18:00         |2004-01-10 06:26:17
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12385


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

* [Bug debug/12385] Full debug info not emitted for C++ classes with external virtual functions
  2003-09-24  7:56 [Bug debug/12385] New: " sgjohnston at yahoo dot com
  2003-09-25 21:43 ` [Bug debug/12385] " pinskia at gcc dot gnu dot org
  2003-09-26  7:04 ` sgjohnston at yahoo dot com
@ 2003-10-10 14:18 ` drow at gcc dot gnu dot org
  2004-01-10  6:26 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: drow at gcc dot gnu dot org @ 2003-10-10 14:18 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12385


drow at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-10-10 14:18:00
               date|                            |


------- Additional Comments From drow at gcc dot gnu dot org  2003-10-10 14:17 -------
Right now debug information would be emitted in file1.cc for your last
testcase.  I think it's tied to the vtable; the vtable is emitted with the
class's "key function" which is fn1 in this case.

On the other hand I don't think tying debug output to vtable emission makes
a whole lot of sense.  Consider:
library.h:
class f1
{
  public: virtual int bar();
};

library.cc:
#include "library.h"
int f1::bar() { return 2; }

app.cc:
#include "lib.h"

int main()
{
  f1 bat;
  return 2 + bat.bar();
}

Try it.  Build lib.cc with -shared and app.cc with -g.  No debug info for
the class is emitted even though we ought to be able to see the local variable:
(gdb) ptype bat
type = struct C {
    <incomplete type>
}

This shows up debugging libstdc++ all the time.


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

* [Bug debug/12385] Full debug info not emitted for C++ classes with external virtual functions
  2003-09-24  7:56 [Bug debug/12385] New: " sgjohnston at yahoo dot com
  2003-09-25 21:43 ` [Bug debug/12385] " pinskia at gcc dot gnu dot org
@ 2003-09-26  7:04 ` sgjohnston at yahoo dot com
  2003-10-10 14:18 ` drow at gcc dot gnu dot org
  2004-01-10  6:26 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sgjohnston at yahoo dot com @ 2003-09-26  7:04 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12385



------- Additional Comments From sgjohnston at yahoo dot com  2003-09-26 05:19 -------
This happens with gdb 5.3. I agree that gdb should never end up in an infinite
recursion, that's definately a bug... although that specifically only happens in
an esoteric situation with namespaces. But I still think the dwarf2 output is
incorrect (or maybe less than optimal?) based on two factors:

1. if no virtual functions are present, gcc behaves perfectly and emits the full
class.
2. if virual functions are present, then there are circumstances where parts of
the class would never have debugging info emitted, depending on compilation unit
structure. for example:

file1.cc:

class C {
   virtual void fn1();
   virtual void fn2();
};

C::fn1() {stuff...}

file2.cc:

class C {
   virtual void fn1();
   virtual void fn2();
};

C::fn2() {stuff...}

As far as I can tell, no dies would be emitted for fn1 or fn2 (or any of the
implicit functions like operator=()). Given that the class has been fully
defined between the two files, at the least the two files output should contain
all the dies between them. I actually think it's better (and neccesary for gdb!)
for the entire class die to be written with each file, as it is if no virtual
functions are used.

I looked brieflt at the dwarf2 standard, it says that AT_declaration should be
set if a structure is incomplete. I'm not sure what the definition of incomplete
is here... I'll look more carefully at it shortly.

Thanks
Stuart


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

* [Bug debug/12385] Full debug info not emitted for C++ classes with external virtual functions
  2003-09-24  7:56 [Bug debug/12385] New: " sgjohnston at yahoo dot com
@ 2003-09-25 21:43 ` pinskia at gcc dot gnu dot org
  2003-09-26  7:04 ` sgjohnston at yahoo dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-25 21:43 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12385



------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-25 21:30 -------
I want to say this is gdb bug (but I have not looked at the dwarf-2 standard to confirm this).

What version of gdb gets confused?


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

end of thread, other threads:[~2024-01-23 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-12385-4@http.gcc.gnu.org/bugzilla/>
2024-01-23 15:38 ` [Bug debug/12385] Full debug info not emitted for C++ classes with external virtual functions rguenth at gcc dot gnu.org
2003-09-24  7:56 [Bug debug/12385] New: " sgjohnston at yahoo dot com
2003-09-25 21:43 ` [Bug debug/12385] " pinskia at gcc dot gnu dot org
2003-09-26  7:04 ` sgjohnston at yahoo dot com
2003-10-10 14:18 ` drow at gcc dot gnu dot org
2004-01-10  6:26 ` pinskia at gcc dot gnu dot org

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