README.debugging.txt

First you have to compile the Debug configuration, and update this,
in the MSVC command prompt, with -
> upd d
This will copy all the Debug versions to the bin folder.

Debugging FlightGear is quite a task. It is a very large program
and with all the extra debug of memory, it takes a long time
to load.

And unfortunately there are many debug assertions that can stop
the program, so sometimes it is necessary to say link it with
the Release version of say Simgear.

The 'main' entry point -
int main ( int argc, char **argv ) {
is in src/Main/bootstrap.cxx, where you can trap the startup.

Of course, as a c++ program you have to be aware that tons of
class instantiation is done even before this, but you can put
traps in any class instantiator to trap when it is called.

As can be seen in this function, the main startup in under
a try {   } catch { }, with

        std::set_terminate(fg_terminate);
        atexit(fgExitCleanup);
        fgMainInit(argc, argv);

This shows that the top level initialization is in src/Main/main.cxx
bool fgMainInit( int argc, char **argv ) {

But even after it has done lots of startup stuff, it hands off to
// Main top level initialization
bool fgMainInit( int argc, char **argv ) {
in src/Main/fg_os_osgviewer.cxx

While it is possible to set the log level using say
--log-level=debug
this still misses the forst outputs fo the program. If you want to
see these, then you must change the line -
    // set default log levels
    sglog().setLogLevels( SG_ALL, SG_ALERT );
to perhaps
    sglog().setLogLevels( SG_ALL, SG_DEBUG );
Then you will see the initial version message...

And of course eventually control is handed off to the 'windows'
event handler ...

To really watch the staged startup, you can trap in
static void fgIdleFunction ( void ) {
This is called back by the 'glut' code, and the variable
'idle_state' is incremented... so you can trap in each
case statement...



# EOF = README.debugging.txt

