This is the mail archive of the gdb-prs@sourceware.org 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]

[Bug symtab/11465] New: Crash on NULL TYPE_FIELD_TYPE


This bugreport assumes this patch is reverted.
Going to revert this patch now.
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.376&r2=1.377
With the patch it does not crash but it has incorrect behavior(*).


This reproducer would crash:
cat <<HERE | g++ -c -o x.o -g -x c++ -; gdb -nx -readnow ./x.o
namespace N {
  class C {
  public:
    typedef void (*t) (C);
    void m (t);
  };
  typedef C::t u;
};
N::u f;
HERE

Attaching it in .s form to overcome possible g++ differences.

It is due to dwarf2_physname() accessing unfinished types being read-in,
dwarf2_physname() is not in FSF gdb-7.1 but it is now in FSF GDB HEAD.
=> It is a regression of current FSF GDB HEAD agains FSF GDB 7.1.


(*) The incorrect behavior with that first patch included can be shown on:
------------------------------------------------------------------------------
namespace N {
  class C {
  public:
    typedef void (*t) (C);
    C (t) {}
  };
  typedef C::t u;
  u f;
  C c (f);
  class CC {
  public:
    CC (int) {}
  } cc (1);
};
int
main ()
{
  return 0;
}
------------------------------------------------------------------------------
gcc-4.4.3-4.fc12.x86_64 and g++ (GCC) 4.4.4 20100401 (prerelease)
(gdb) p N::c.C
Cannot take address of method C.
(gdb) p N::cc.CC
$1 = {void (N::CC *, int)} 0x4005c4 <N::CC::CC(int)>
It is because internally GDB at line
  fnp->physname = physname ? physname : "";
detects
"N::C::C(void (*)())"
"N::CC::CC(int)"
where "()" should be "(C)".
------------------------------------------------------------------------------
g++ (GCC) 4.5.0 20100401 (experimental)
(gdb) p N::c.C
$1 = {void (N::C *, N::C::t)} 0x400516 <N::C::C(N::C::t)>
(gdb) p N::cc.CC
$2 = {void (N::CC *, int)} 0x400524 <N::CC::CC(int)>
looks correct but still it does not work:
(gdb) ptype N::C::t
type = void (*)(void)

-- 
           Summary: Crash on NULL TYPE_FIELD_TYPE
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: symtab
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jan dot kratochvil at redhat dot com
                CC: gdb-prs at sourceware dot org,keiths at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11465

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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