gdb  User: guest  Access: viewconf gnatsweb
MAIN PAGECREATEQUERYADV. QUERYLOGIN AGAINHELP

View Problem Report: 1516

or add note or send email to interested parties


Reporter's email: mec.gnu@mindspring.com
CC these people
on PR status email:
carlton@kealia.com
   
Number: 1516
Category: symtab
Synopsis: [regression] local classes, gcc 2.95.3, dwarf-2
Confidential: no
Severity: serious
Priority: medium
Responsible: unassigned
State: analyzed
Class: sw-bug
Submitter-Id: net
Arrival-Date: Sun Jan 18 00:58:00 UTC 2004
Closed-Date:
Last-Modified: Sat Jan 24 22:09:19 UTC 2004
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.




 
File Attachments:
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:
Unformatted:

or send email to interested parties

Audit Trail:

State-Changed-From-To: open->analyzed
State-Changed-By: chastain
State-Changed-When: Sat Jan 24 22:09:19 2004
State-Changed-Why:
    
    I'm downgrading this from "high" all the way down to "low", because it doesn't hurt users that much, and it's part of a design change that helps users in other ways.