Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263834

Work around gdb <incomplete type> for HashtableEntry

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 17
    • None
    • hotspot
    • b15

      We have a perennial problem in printing subtypes of HashtableEntry in gdb.
      This is probably due to a stupid bug in gdb; other debuggers like lldb or vs don't have such an issue.

      (gdb) b PlaceholderEntry::next
      (gdb) c
      Thread 2 "java" hit Breakpoint 2, PlaceholderEntry::next
      (gdb) p this
      $1 = (const PlaceholderEntry * const) 0x7ffff0242a30
      (gdb) p *this
      $2 = <incomplete type>
      (gdb) ptype this
      type = const class PlaceholderEntry {
          <incomplete type>
      } * const

      The work around is simple:

      -template <MEMFLAGS F> class BasicHashtableEntry : public CHeapObj<F> {
      +template <MEMFLAGS F> class BasicHashtableEntry {

      There's no need to subclass from CHeapObj since we do all the alloc/free ourselves in BasicHashtable<F>::new_entry(). I.e., we have

        // Entry objects should not be created, they should be taken from the
        // free list with BasicHashtable.new_entry().
        BasicHashtableEntry() { ShouldNotReachHere(); }
        // Entry objects should not be destroyed. They should be placed on
        // the free list instead with BasicHashtable.free_entry().
        ~BasicHashtableEntry() { ShouldNotReachHere(); }


            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: