Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Virtual table problems - Solved, but new problem arisen



On Saturday, August 16, 2003, at 04:21 pm, Alastair J.Houghton wrote:

Hi there, I'm converting an old program from CodeWarrior Gold 10 to ProjectBuilder 2.1 (gcc 3.1) and have the thing compiling and launching fine, however when it tries to access an enumerated value inside a struct, I get the following error:

The error you posted was from GDB, not from the compiler and not from your code. I don't know why GDB can't find the vtable (or the information for your enumerated type), but it almost certainly has nothing to do with the fact that the program crashes when you run it.

Thanks, it was actually a known bug in gdb regarding no support for enumerations within a namespace. Apple ought to put an engineer on that pronto.

The bad access signal is probably because m_ePersonType is out of range. Try adding a

printf ("%d", m_ePersonType);

immediately before that line. Also, make sure you have initialised m_ePersonType.

Turned out to be that CodeWarrior used chars for enums and gcc used a long. The initaliser was putting 0x08000000 into the value instead of 0x00000008, and was consequently out of bounds on the array. It looks like I have a large number of enums like this being both read and written to deal with :/

Does anyone have any clue about this?
My initial reaction is there is some ceiling on the size of the virtual tables allowed by gcc and I have exceeded that.

Nonesense. There may well be a limit, but I very much doubt you've hit it and in any case the problem you're having is nothing to do with the vtable.

Yep, thanks for the pointers. I was completely misled by the errors I was receiving and ended up barking up the wrong tree :)

One problem I'm encountering which is making debugging hard is that gcc doesn't seem to create symbol tables for methods in header files. As such, I cannot step through a lot of the code (which often passes around and calls function pointers - I have no idea what functions are being called - from some subclass' overloaded virtual function). I even have to deal with one pivotal concrete class which is solely defined in the header, the cpp file has just a single #include line!
Is there a way to get gcc (from Project Builder) to generate symbol tables for .h files so i can debug them?

- Nick.
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.