[gvd-users] GVD C++ class display bug report

Hartmut Pohl gvd-users@lists.act-europe.fr
Mon, 03 Mar 2003 18:51:57 +0100


Hi there,

Recently I found this great debugger and was very pleased since I'am
now able to throw away the Tornado Debugger.

Today I uncovered a problem in displaying C++ classes.
Entering a command like "graph display *this" resulted in
"Could not parse type or value for *this" and the gdb
error message: "No symbol "virtual" in current context"

I set the log level to 4 and discovered the following:
Apparently gvd determines the classes/structs to display using the
ptype command. Using this command needs some know-how about the
used language. In my particular example the class strstreambase
is inherited "virtual" from the class ios. Gvd then asks gdb for
information about "virtual ios" which is unknown.

Unfortunately lots of my classes use this kind of inheritance.
Thus gvd is not yet really a replacement for the Tornado. Pity.

I'm using Gvd 1.2.5 with gdb 4.18.

Best regards,
	Hartmut

-------Log-------
[1] -> "graph display *this"
[1] -> "print &(*this)\n"
[1] <- "$7 = (CEventLogger *) \r\n"
        "(gdb) "
[1] -> "ptype *this\n"
[1] <- "type = class CEventLogger : public IEventLogger {\r\n"
        "  protected:\r\n"
        "    int mReportingLevel;\r\n"
        "    bool mTraceAll;\r\n"
        "    Severity mSeverity;\r\n"
        "    int mUserEventNo;\r\n"
        "    int mUserStringPos;\r\n"
        "    ostrstream mOStream;\r\n"
        "    bool mAssertionOngoing;\r\n"
        " 
set<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> 
 >,less<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > >,__default_alloc_template<false,0> > mTraceSourceSet;\r\n"
        "    fstream mLogFile;\r\n"
        "  private:\r\n"
        "    static list<IAssertCallback *,__default_alloc_template<false,0> 
 > sCallbackList;\r\n"
        "    static CEventLogger *spInstance;\r\n"
        "    static semaphore *sMutex;\r\n"
        "    static RING *sRngBuf;\r\n"
        "\r\n"
        "  public:\r\n"
        "    CEventLogger & operator=(CEventLogger &);\r\n"
        "    CEventLogger(CEventLogger const &);\r\n"
        "    CEventLogger(void);\r\n"
        "    ~CEventLogger(void);\r\n"
        "    static CEventLogger * GetInstance(void);\r\n"
        "    static IEventLogger * CreateInstance(void);\r\n"
        "    static void DeleteInstance(void);\r\n"
        "    virtual void Assert(int, char *, char *, char *, bool);\r\n"
        "    virtual ostrstream & Error(int, char *, char *);\r\n"
        "    virtual ostrstream & Warning(int, char *, char *);\r\n"
        "    virtual ostrstream & UserInfo(int, char *, char *);\r\n"
        "    virtual ostrstream & Success(int, char *, char *);\r\n"
        "    virtual ostrstream & Trace(int, char *, char *);\r\n"
        "    virtual ostrstream & Trc(int, char *, char *, int, int);\r\n"
        "    virtual void Flush(char const *);\r\n"
        "    virtual void RegisterAssertCallback(IAssertCallback *);\r\n"
        "    virtual void SetLogLevel(int);\r\n"
        "    virtual void AddTraceSource(basic_string<char, 
string_char_traits<char>, __default_alloc_template<false, 0> >);\r\n"
        "    virtual void PrintLog(void);\r\n"
        "  protected:\r\n"
        "    void PrepareLine(char const *, char const *, int);\r\n"
        "    void PrintToRngBuf(char const *);\r\n"
        "    void PrintToRngBuf(ostrstream &);\r\n"
        "    void PrintStartup(void);\r\n"
        "    void CriticalSectionBegin(void);\r\n"
        "    void CriticalSectionEnd(void);\r\n"
        "}\r\n"
        "(gdb) "
[1] -> "ptype IEventLogger \n"
[1] <- "type = class IEventLogger {\r\n"
        "  public:\r\n"
        "    IEventLogger & operator=(IEventLogger const &);\r\n"
        "    IEventLogger(IEventLogger const &);\r\n"
        "    IEventLogger(void);\r\n"
        "    static IEventLogger * CreateInstance(void);\r\n"
        "    static IEventLogger * Instance(void);\r\n"
        "    static void DeleteInstance(void);\r\n"
        "    virtual void Assert(int, char *, char *, char *, bool);\r\n"
        "    virtual ostrstream & Error(int, char *, char *);\r\n"
        "    virtual ostrstream & Warning(int, char *, char *);\r\n"
        "    virtual ostrstream & UserInfo(int, char *, char *);\r\n"
        "    virtual ostrstream & Success(int, char *, char *);\r\n"
        "    virtual ostrstream & Trace(int, char *, char *);\r\n"
        "    virtual ostrstream & Trc(int, char *, char *, int, int);\r\n"
        "    virtual void Flush(char const *);\r\n"
        "    virtual void RegisterAssertCallback(IAssertCallback *);\r\n"
        "    virtual void SetLogLevel(int);\r\n"
        "    virtual void AddTraceSource(basic_string<char, 
string_char_traits<char>, __default_alloc_template<false, 0> >);\r\n"
        "    virtual void PrintLog(void);\r\n"
        "}\r\n"
        "(gdb) "
[1] -> "ptype bool \n"
[1] <- "type = bool\r\n"
        "(gdb) "
[1] -> "ptype bool\n"
[1] <- "type = bool\r\n"
        "(gdb) "
[1] -> "ptype Severity \n"
[1] <- "type = enum Severity {eOFF, eASSERT, eERROR, eWARNING, eUSER_INFO, 
eSUCCESS, eTRACE, eTRC}\r\n"
        "(gdb) "
[1] -> "ptype ostrstream \n"
[1] <- "type = class ostrstream : public strstreambase, public ostream {\r\n"
        "  public:\r\n"
        "    ostrstream & operator=(ostrstream &);\r\n"
        "    ostrstream(int, ostrstream const &);\r\n"
        "    virtual ~ostrstream(void);\r\n"
        "    ostrstream(int);\r\n"
        "    ostrstream(int, char *, int, int);\r\n"
        "    _G_ssize_t pcount(void);\r\n"
        "    char * str(void);\r\n"
        "    void freeze(int);\r\n"
        "    int frozen(void);\r\n"
        "}\r\n"
        "(gdb) "
[1] -> "ptype strstreambase\n"
[1] <- "type = class strstreambase : public virtual ios {\r\n"
        "  private:\r\n"
        "    ios *_vb$3ios;\r\n"
        "  protected:\r\n"
        "    strstreambuf __my_sb;\r\n"
        "\r\n"
        "  public:\r\n"
        "    strstreambase & operator=(strstreambase &);\r\n"
        "    strstreambase(int, strstreambase const &);\r\n"
        "    virtual ~strstreambase(void);\r\n"
        "  protected:\r\n"
        "    strstreambase(int);\r\n"
        "    strstreambase(int, char *, int, int);\r\n"
        "  public:\r\n"
        "    strstreambuf * rdbuf(void);\r\n"
        "}\r\n"
        "(gdb) "
[1] -> "ptype virtual ios \n"
[1] <- "No symbol "virtual" in current context.\r\n"
        "(gdb) "
# Could not parse type or value for *this
-- 
   Hartmut_Pohl@agilent.com
--
Questions are never indiscreet, answers sometimes are.
    Oscar Wilde