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 c++/12009] New: Wrong recognizion of instance of a class without virtual methods, if it contains the instance of a class with virtual methods as the first field


I have the class:
class CSphString
{
...
virtual ~CSphString();
};

class CSphQuery // no virtual methods at all
{
public:
	CSphString		m_sIndexes;
	int iAnotherField;
	void * pManyOtherFieldsAndMethodsFollow;
...
};

When looking to the instance of the class GDB recognizes it type as CSphString
(as the first field of the class) and so, shows only it's value.
However, if I define ~CSphQuery() as virtual (so, an instance begin to have the
pointer to VMT at the top), all recognized fine.

It seems that GDB sees the pointer to VMT with the D-tor ~CSphString() at the
beginning of class's instance (since the first field is the instance of
CSphString), and thinks that the whole instance of CSphQuery is by the fact
CSphString.

If I define my class as virtual also, its own VMT begin to stay at the beginning
of it's instance before the fields, and so, it is recognized and works proper way.

-- 
           Summary: Wrong recognizion of instance of a class without virtual
                    methods, if it contains the instance of a class with
                    virtual methods as the first field
           Product: gdb
           Version: 7.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: a dot n dot vinogradov at gmail dot com
                CC: gdb-prs at sourceware dot org


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

------- 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]