Board index FlightGear Support Compiling

Memory error when debugging

Building FlightGear from source, and in the need for help?

Memory error when debugging

Postby alcallejo » Fri Oct 25, 2013 10:20 pm

Hello everybody,

I'm trying to debug FlightGear. These are my coordinates:

-- Platform: 64-bit Windows 7
-- FlightGear: Git repository (pulled on October 17, 2013)
-- Environment: Visual Studio 2010 Express, CMake 2.8.12

Looks like there are two possible ways of debugging FlightGear:

a) Run fgfs.exe and try to attach the process to Visual Studio
b) Start a debugging session from within FlightGear's Visual Studio solution

Since I want to debug right from the beginning, and see how everything is initialized, the second option seems the way to go. I have successfully built FlightGear (and SimGear) in Debug mode. The first problem is that I don't know where the entry point (the "main" function) is, which would allow me to set a breakpoint in the first lines of code. Thus, I've tried to right-click on "fgfs" project and select Debug > Start new instance, so that it runs a new debugging session and stops on the first line, but I get the following memory error in Effect.cxx instead:

https://9b3d65ac-a-62cb3a1a-s-sites.goo ... edirects=0

I've also set --fg-root="C:\Program Files\FlightGear-Source\fgdata" as an input argument by right-clicking on "fgfs" project and selecting Properties > Debugging > Command Arguments.
Is there anything else I should do to set up the debugging session?

Thanks,
Alfonso
Last edited by alcallejo on Mon Nov 04, 2013 11:07 pm, edited 1 time in total.
alcallejo
 
Posts: 9
Joined: Thu Sep 12, 2013 3:17 pm

Re: Memory error when debugging

Postby adrian » Fri Oct 25, 2013 10:35 pm

Arguments from my gdb setup:
--fg-root=/home/adrian/fgfs/install/fgfs/fgdata/ --aircraft=ufo --airport=LRSB --log-level=normal --control=joystick --enable-random-objects --disable-hud --disable-hud-3d --enable-horizon-effect --enable-enhanced-lighting --enable-distance-attenuation --enable-ai-models --enable-clouds3d --enable-fullscreen --prop:/sim/frame-rate-throttle-hz=50 --fog-nicest --geometry=1920x1024 --visibility-miles=100 --bpp=32 --fov=90 --texture-filtering=16 --timeofday=noon --disable-real-weather-fetch --prop:input/mice/mouse/mode/button[2]/binding/value=2 --prop:/environment/metar/data='NIL\n'
--fg-scenery=/home/adrian/fgfs/scenery

Try to set breakpoint at main entry point in src/Main/bootstrap.cxx : 166
adrian
 
Posts: 362
Joined: Wed Sep 15, 2010 3:15 pm

Re: Memory error when debugging

Postby Hooray » Fri Oct 25, 2013 10:46 pm

Hi & welcome,

like Adrian said, see bootstrap.cxx - which calls into main.cxx (splash screen updates etc) - next, for initialization, $FG_SRC/Main is going to be most-relevant, especially the stuff in fg_init.cxx - options processing is done prior to that in options.cxx, global data structures are to be found in globals.cxx, the property stuff is in fg_props.cxx,

$FG_SRC/Viewer contains the OSGViewer stuff that will set up the main OSG window and any other configured windows/views.

Let us know if you have any other questions.

Also, if you have a few minutes, I suggest to check out these links:

http://wiki.flightgear.org/FlightGear-P ... f_Interest
http://wiki.flightgear.org/Howto:Start_core_development
http://wiki.flightgear.org/Howto:Create_new_subsystems

http://wiki.flightgear.org/Portal:Developer

As you can see, http://wiki.flightgear.org/FlightGear-P ... f_Interest would seem of special interest - while it's a stub at the moment, we do appreciate any help in populating it - getting a wiki account to contribute to the wiki is quick & easy

To learn more about the property tree, see: http://wiki.flightgear.org/Property_Tree

You'll probably also want to check out: http://docs.freeflightsim.org

Finally, you can also use the built-in profiler to help with the creation of callgraphs: http://wiki.flightgear.org/Built-in_Profiler
Which is, how I created some callgraph images, like this one:
Image
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Memory error when debugging

Postby alcallejo » Mon Oct 28, 2013 5:56 pm

Hi,

Thanks for the suggestions and the documentation links. I tried setting breakpoints on bootstrap.cxx:128 and bootstrap.cxx:172, but I still get the same memory error.
As far as the input arguments, I kept --fg-root="C:\Program Files\FlightGear-Source\fgdata because I'm OK with the default rendering options (and either way, I should be able to stop the program before the arguments are even read).
So I still have no clue about the cause of the memory error. Is right-clicking on "fgfs" project the best way of starting a debugging session? Also, every time I try doing that, I am prompted by VS saying that I have to compile ZERO_CHECK.

Thanks,
Alfonso
alcallejo
 
Posts: 9
Joined: Thu Sep 12, 2013 3:17 pm

Re: Memory error when debugging

Postby alcallejo » Tue Oct 29, 2013 2:54 pm

I have noticed that, after building both SimGear and FlightGear in Debug mode, if I try to run fgfs.exe (through a *.cmd file so that I can set --fg-root="C:\Program Files\FlightGear-Source\fgdata") I get the error shown in the attached screenshot. Note that with the Release version I can do this flawlessly.

https://9b3d65ac-a-62cb3a1a-s-sites.goo ... gging2.png

Thanks,
Alfonso
Last edited by alcallejo on Mon Nov 04, 2013 5:11 pm, edited 1 time in total.
alcallejo
 
Posts: 9
Joined: Thu Sep 12, 2013 3:17 pm

Re: Memory error when debugging

Postby Johan G » Tue Oct 29, 2013 4:29 pm

Somehow I cant see the image. :(
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Memory error when debugging

Postby alcallejo » Tue Oct 29, 2013 7:28 pm

Last edited by alcallejo on Mon Nov 04, 2013 5:14 pm, edited 3 times in total.
alcallejo
 
Posts: 9
Joined: Thu Sep 12, 2013 3:17 pm

Re: Memory error when debugging

Postby Johan G » Tue Oct 29, 2013 10:36 pm

Nope, but what is even weirder is that I can use the quote button, copy the image link to a new browser tab and see it without any problems. :?:

Maybe it is that it is served by secure http, though I can not see why that should not work. :roll:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Memory error when debugging

Postby alcallejo » Mon Nov 04, 2013 10:47 pm

I replaced the [img] tags with direct links, so now you should be able to open up the images.

I still don't know what's causing the memory error when I start debugging. I recently tried to run the release version from the Visual Studio solution and it worked smoothly, which proves that it probably has nothing to do with the input arguments or the environment variables. Looking a little more in detail at the error, looks like it has something to do with osgDB, which is part of OpenSceneGraph 3rd-party library. Perhaps I need to compile OSG in debug mode as well? If I used the release version of OSG, shouldn't it skip the functions without entering the code?

Thanks,
Alfonso
alcallejo
 
Posts: 9
Joined: Thu Sep 12, 2013 3:17 pm


Return to Compiling

Who is online

Users browsing this forum: No registered users and 2 guests