Hi, In an attempt to devise a method of getting more detailed timing information on FlightGear's subsystems, I created a debug timing info class.
The idea is to just collect the timing of preset stamps, and print them after the fact, so that ongoing processing during execution of the code under scrutiny is disrupted in the least possible way. The class looks like this, class TimingInfo { private: string eventName; SGTimeStamp time; public: TimingInfo(string name, SGTimeStamp &t) { eventName = name; time = t;}; string getName() { return eventName; }; SGTimeStamp getTime() { return time; }; }; typedef vector<TimingInfo> eventTimeVec; typedef vector<TimingInfo>::iterator eventTimeVecIterator; Now, when trying to add this to SimGear's SGSubsystem class, I got a segmentation fault immediately. After some experimentation, I found out that even adding a single integer variable to SGSubsystems, as in: class SGSubsystem { .. .. protected: bool _suspended; //eventTimeVec *timingInfo; int test; }; In addition, I'd have a function SGSubsystem::stamp(string event), which adds time stamps to the vector, and a function printTimingInformation(), which conditionally prints timing results to the console afer function execution is finished. Causes FlightGear to crash in AIBase: ==11879== Process terminating with default action of signal 11 (SIGSEGV) ==11879== Access not within mapped region at address 0x58 ==11879== at 0x85B459F: ssgList::sizeChk() (ssgList.cxx:70) ==11879== by 0x85B47F2: ssgList::addEntity(ssgEntity*) (ssgList.cxx:55) ==11879== by 0x85AEFA3: ssgBranch::addKid(ssgEntity*) (ssgBranch.cxx:85) ==11879== by 0x8477014: FGAIBase::init(bool) (AIBase.cxx:185) ==11879== by 0x846FAE0: FGAIManager::attach(SGSharedPtr<FGAIBase>) (AIManager.cxx:204) ==11879== by 0x846FD1A: FGAIManager::processScenario(std::string const&) (AIManager.cxx:285) ==11879== by 0x8470483: FGAIManager::postinit() (AIManager.cxx:98) ==11879== by 0x858A593: SGSubsystemGroup::postinit() (subsystem_mgr.cxx:130) ==11879== by 0x8589CFE: SGSubsystemMgr::postinit() (subsystem_mgr.cxx:317) ==11879== by 0x8064479: fgInitSubsystems() (fg_init.cxx:1853) ==11879== by 0x805514B: fgIdleFunction() (main.cxx:953) ==11879== by 0x80871F0: GLUTidle() (fg_os.cxx:122) I'm currently working around the problem by adding the "eventTimeVec *timingInfo" variable to the derived classes, in particular. This approach works well, but isn't nearly as elegant as adding a debug timer to the base class. Does anybody have a clue what is happening here? Adding an integer class member variable seems perfectly legal to me. Am I hitting a stack limit, or is this just uncovering an existing bug? Cheers, Durk ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel