public inbox for insight-prs@sourceware.org
help / color / mirror / Atom feed
From: llewins@raytheon.com
To: insight-gnats@sources.redhat.com
Subject: insight/206: SEGV in Tcl_FindCommand
Date: Tue, 21 Jan 2003 00:53:00 -0000	[thread overview]
Message-ID: <20030121004503.21137.qmail@sources.redhat.com> (raw)


>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);

}



             reply	other threads:[~2003-01-21  0:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-21  0:53 llewins [this message]
2003-01-23 18:41 kseitz
2003-01-24  1:23 Lloyd J Lewins
2003-01-24 13:43 Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030121004503.21137.qmail@sources.redhat.com \
    --to=llewins@raytheon.com \
    --cc=insight-gnats@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).