This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

symtab/1516: [regression] local classes, gcc 2.95.3, dwarf-2


>Number:         1516
>Category:       symtab
>Synopsis:       [regression] local classes, gcc 2.95.3, dwarf-2
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 18 00:58:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     mec.gnu@mindspring.com
>Release:        gdb HEAD 2004-01-16 02:35:50 UTC
>Organization:
>Environment:
target=native, host=i686-pc-linux-gnu, osversion=red-hat-8.0
gdb=HEAD 2004-01-16 02:35:50 UTC
cc=gcc 2.95.3
as=binutils 2.14
ld=binutils 2.14
libc=glibc 2.2.93-5-rh
gformat=dwarf-2
glevel=2
>Description:
local.cc has a class defined local to a function:

  int foobar (int x)
  {
    class Local {
    public:
      int loc1;
      char loc_foo (char c)
      {
        return c + 3;
      }
     };

    Local l;
    static Local l1;
    ...
   }

I am in Foo.  I do "ptype l".

  # gdb 6.0
  (gdb) ptype l
  type = class Local {
    public:
      int loc1;

      char loc_foo(char);
  }

  # gdb HEAD 2004-01-16 02:35:50 UTC
  (gdb) ptype l
  type = class foobar__Fi.0::Local {
    public:
      int loc1;

      char loc_foo(char);
  }

This is a regression from gdb 6.0.

I think the problem is in this new code:

  char *actual_class_name
    = class_name_from_physname (dwarf2_linkage_name
                                (child_die));
  if (actual_class_name != NULL
      && strcmp (actual_class_name, name) != 0)
  {
     TYPE_TAG_NAME (type)
       = obsavestring (actual_class_name,
                       strlen (actual_class_name),
                       &objfile->type_obstack);
     xfree (actual_class_name);
     need_to_update_name = 0;
   }

This is frustrating code.  It fires on gcc 2.95.3 and qualifies the class name with something that can't be found later.  But it doesn't fire on gcc 3.3.2 or gcc HEAD 2004-01-17.




  
>How-To-Repeat:
Compile local.cc with gcc 2.95.3 -gdwarf-2, break on marker1, go up to foobar frame, ptype local.
>Fix:
Maybe qualify this code so that it's not used for gcc 2. class_name_from_physname is demangling the name, so we're holding a mangled name and we have enough information to distinguish a v2 name or a v3 name.


>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]