Professional Web Applications Themes

GCC C++ Issue: pure virtual method called - Mac Programming

I have a threaded C++ application that produces a 'pure virtual method called' error about 3 out of 10 times while starting up the application. The error is confusing because this should be a compile-time error instead of runtime. My question is how I can trap an error like this so that I can look at a stack trace from the debugger. I tried several things like setting a breakpoint on __cxa_pure_virtual but none of these hooks seem to get called. It is difficult to find the correct bit of doentation about these GCC 'internals'. This is my GCC version: ...

  1. #1

    Default GCC C++ Issue: pure virtual method called


    I have a threaded C++ application that produces a 'pure virtual method called'
    error about 3 out of 10 times while starting up the application. The error is
    confusing because this should be a compile-time error instead of runtime.

    My question is how I can trap an error like this so that I can look at a stack
    trace from the debugger. I tried several things like setting a breakpoint on
    __cxa_pure_virtual but none of these hooks seem to get called. It is difficult
    to find the correct bit of doentation about these GCC 'internals'.

    This is my GCC version:

    Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
    Thread model: posix
    gcc version 3.3 20030304 (Apple Computer, Inc. build 1492)

    I know that this is beta software but I also have the same problem with older
    versions of GCC like 2.95 and 3.2.

    S.

    Stefan Arentz Guest

  2. #2

    Default Re: GCC C++ Issue: pure virtual method called

    >
    > I have a threaded C++ application that produces a 'pure virtual method called'
    > error about 3 out of 10 times while starting up the application. The error is
    > confusing because this should be a compile-time error instead of runtime.
    >
    > My question is how I can trap an error like this so that I can look at a stack
    > trace from the debugger. I tried several things like setting a breakpoint on
    > __cxa_pure_virtual but none of these hooks seem to get called. It is difficult
    > to find the correct bit of doentation about these GCC 'internals'.
    >
    > This is my GCC version:
    >
    > Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
    > Thread model: posix
    > gcc version 3.3 20030304 (Apple Computer, Inc. build 1492)
    >
    > I know that this is beta software but I also have the same problem with older
    > versions of GCC like 2.95 and 3.2.
    My guess is that it's a pointer error (a programming error). Some pointer points
    at the wrong place in the vtab and causes a call to a method which cannot be
    called.


    Mike Guest

  3. #3

    Default Re: GCC C++ Issue: pure virtual method called

    "Mike" <nospamnospam.com> writes:
    > >
    > > I have a threaded C++ application that produces a 'pure virtual method called'
    > > error about 3 out of 10 times while starting up the application. The error is
    > > confusing because this should be a compile-time error instead of runtime.
    > >
    > > My question is how I can trap an error like this so that I can look at a stack
    > > trace from the debugger. I tried several things like setting a breakpoint on
    > > __cxa_pure_virtual but none of these hooks seem to get called. It is difficult
    > > to find the correct bit of doentation about these GCC 'internals'.
    > >
    > > This is my GCC version:
    > >
    > > Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
    > > Thread model: posix
    > > gcc version 3.3 20030304 (Apple Computer, Inc. build 1492)
    > >
    > > I know that this is beta software but I also have the same problem with older
    > > versions of GCC like 2.95 and 3.2.
    >
    > My guess is that it's a pointer error (a programming error). Some pointer points
    > at the wrong place in the vtab and causes a call to a method which cannot be
    > called.
    Yeah, probably combined with some weird timing issues. It could be many places, that
    is why I need a stack trace :-)

    S.
    Stefan Arentz Guest

  4. #4

    Default Re: GCC C++ Issue: pure virtual method called

    > > > I have a threaded C++ application that produces a 'pure virtual method called'
    > > > error about 3 out of 10 times while starting up the application. The error is
    > > > confusing because this should be a compile-time error instead of runtime.
    > > >
    > > > My question is how I can trap an error like this so that I can look at a stack
    > > > trace from the debugger. I tried several things like setting a breakpoint on
    > > > __cxa_pure_virtual but none of these hooks seem to get called. It is difficult
    > > > to find the correct bit of doentation about these GCC 'internals'.
    > > >
    > > > This is my GCC version:
    > > >
    > > > Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
    > > > Thread model: posix
    > > > gcc version 3.3 20030304 (Apple Computer, Inc. build 1492)
    > > >
    > > > I know that this is beta software but I also have the same problem with older
    > > > versions of GCC like 2.95 and 3.2.
    > >
    > > My guess is that it's a pointer error (a programming error). Some pointer points
    > > at the wrong place in the vtab and causes a call to a method which cannot be
    > > called.
    >
    > Yeah, probably combined with some weird timing issues. It could be many places, that
    > is why I need a stack trace :-)
    Have you looked in the crash log?



    Mike Guest

  5. #5

    Default Re: GCC C++ Issue: pure virtual method called

    Hi Stefan,

    Stefan Arentz <stefan.arentzsoze.com> writes:
    > My question is how I can trap an error like this so that I can look
    > at a stack trace from the debugger. I tried several things like
    > setting a breakpoint on __cxa_pure_virtual but none of these hooks
    > seem to get called.
    "br __cxa_pure_virtual" works fine here to trap this (GCC 3.3, Apple
    build 1435). __cxa_pure_virtual() calls abort() here, so you can also
    enable core dumps, run the program, reproduce the error and than run
    gdb on the code dump.

    You probably already know that this error is caused by calling pure
    virtual methods from the constructor or destructor of the base class.
    It must be an indirect call, because GCC will issue an error about
    direct calls.

    benny
    Benjamin Riefenstahl Guest

Similar Threads

  1. LoadPostData method called twice
    By Nidhee in forum ASP.NET Building Controls
    Replies: 1
    Last Post: September 7th, 12:34 AM
  2. Replies: 0
    Last Post: November 9th, 07:11 PM
  3. #38456 [Asn]: Apache2 segfaults when virtual() is called in .php ErrorDoent
    By alex dot dean at pni dot com in forum PHP Bugs
    Replies: 1
    Last Post: October 14th, 10:21 PM
  4. Child OnPreRender method not being called.
    By Matt T. in forum ASP.NET Building Controls
    Replies: 1
    Last Post: January 7th, 04:44 PM
  5. Called as method or subroutine?
    By ed in forum PERL Miscellaneous
    Replies: 14
    Last Post: July 28th, 09:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139