This is the mail archive of the insight-prs@sources.redhat.com mailing list for the Insight 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]

insight/206: SEGV in Tcl_FindCommand


>Number:         206
>Category:       insight
>Synopsis:       SEGV in Tcl_FindCommand
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 21 00:53:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lloyd J. Lewins
>Release:        GNU gdb 2003-01-09-cvs
>Organization:
>Environment:
cygwin
>Description:
Compiled wih gcc:
gcc version 2.95.3-5 (cygwin special)

Using Insite cvs January 9:
GNU gdb 2003-01-09-cvs

Upon examining variable b, receive the following SEGV:
Program received signal SIGSEGV, Segmentation fault.
0x6603b620 in Tcl_FindCommand (interp=0xa032b48, name=0xa492160 "namespace",
    contextNsPtr=0x0, flags=0)
    at ../../../src/tcl/win/../generic/tclNamesp.c:1970
1970        if (cxtNsPtr->cmdResProc != NULL || iPtr->resolverPtr != NULL) {
>How-To-Repeat:
set break point at line 170, and run. Click on variable b and add to watch. In
watch, browse into b->classC->private. Watch window fails to update correctly,
and goes to back. Click watch window to bring to front to generate SEGV.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="main.cc"
Content-Disposition: inline; filename="main.cc"

/*
Submitted by L.J.Lewins, llewins@raytheon.com

Compiled wih gcc:
gcc version 2.95.3-5 (cygwin special)

Using Insite cvs January 9:
GNU gdb 2003-01-09-cvs

Upon examining variable b, receive the following SEGV:
Program received signal SIGSEGV, Segmentation fault.
0x6603b620 in Tcl_FindCommand (interp=0xa032b48, name=0xa492160 "namespace",
    contextNsPtr=0x0, flags=0)
    at ../../../src/tcl/win/../generic/tclNamesp.c:1970
1970        if (cxtNsPtr->cmdResProc != NULL || iPtr->resolverPtr != NULL) {

Reproduce:
set break point at line 170, and run. Click on variable b and add to watch. In
watch, browse into b->classC->private. Watch window fails to update correctly,
and goes to back. Click watch window to bring to front to generate SEGV.
*/

#include <string>

using namespace std;

class containerClass
{
public:
    class classB;

public:
    containerClass (void)
    {
    }
    
    class classA {
    public:
        classA(const unsigned num)
            : valV (num)
        {
        }

        classB* find(const unsigned val) const
        {
            return 0;
        }

        virtual unsigned val(void)
        {
            return valV;
        }

    protected:
        const unsigned   valV;
        string           nameV;

    private:
        // disallow default/copy constructor and assignment operator
        classA(void);
        classA(classA& source);
        classA& operator=(const classA& rhs);

    friend class containerClass;
    friend class classB;
    };

    class classC {
    public:
        classC (classA& myClassA)
            : nameV("foo"),
              myClassAV (myClassA)
        {
        }

        classA& myClassA (void) const
        {
            return myClassAV;
        }

    protected:
        string nameV;

    private:
        classA& myClassAV;
        
        // disallow defau;t/copy constructor and assignment operator
        classC(void);
        classC(classC& source);
        classC& operator=(const classC& rhs);
    };

    class classB : virtual public classC {
    public:
        classB(classA&            myClassA)
            : classC(myClassA),
              valV(0)
        {
        }

        virtual unsigned val(void)
        {
            return valV;
        }

    protected:
        unsigned              valV;

    private:
        // disallow defaut/copy constructor and assignment operator
        classB (void);
        classB (classB& source);
        classB& operator= (const classB& rhs);
    };

private:
    // disallow copy constructor and assignment operator
    containerClass (containerClass& source);
    containerClass& operator= (const containerClass& rhs);

friend class classA;
};

class classB;

class classA : public containerClass::classA
{
public:
    classA(const unsigned num)
        : containerClass::classA(num)
    {
    }

    classB* find(const unsigned val) const
    {
        return 0;
    }
    
private:
    // disallow copy constructor and assignment operator
    classA(classA& source);
    classA& operator=(const classA& rhs);
};

class classB : public containerClass::classB
{
public:
    classB(containerClass::classA& myClassA)
        : classC(myClassA),
          containerClass::classB(myClassA),
          reservedV(false)
    {
    }

protected:
    bool reservedV;

private:
    // disallow copy constructor and assignment operator
    classB(classB& source);
    classB& operator=(const classB& rhs);
};

int main(void)
{
    classA* a = new classA(0);

    classB* b = new classB(*a);

}



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