|
5.7 TroubleshootingUnlike the controller code, the physics plugin code is executed in the same process and memory space as the Webots application. Therefore, a segmentation fault in the physics plugin code will cause the termination of the Webots application. Webots termination is often misinterpreted by users who believe that Webots itself has crashed, while the error is actually in the user's plugin code. For that reason, it is important to precisely locate the crash before reporting a bug to Cyberbotics Ltd. The following are some debugging hints that should help you find the exact location of a crash using the GNU Debugger. The first step is to recompile the physics plugin with the -g flag, in order to add debugging information to the compiled plugin. This can be achieved by adding this line to the plugin's Makefile:
Then you must recompile the plugin:
Now the -g flag should appear in the compilation line. Note that you can also recompile using the Make Clean and Make menus of the Webots text editor. Once you have recompiled the plugin, quit Webots, start the GNU Debugger, and run the main Webots executable in the debugger:
Note that the actual executable file might be located somewhere else, depending on your specific system or installation. Then, let the simulation run until it crashes. When the crash occurs, gdb prints an error message similar to this:
This indicates precisely the file name and line number where the problem occurred. If the indicated file name corresponds to one of the plugin source files, then the error is located in the plugin code. You can examine the call stack more precisely by using the where command of gdb. For example:
In this example you see that the error is located in the plugin's webots_physics_init() function. If the error is reported in an unknown function (and if the line number and file name are not displayed), then the crash may have occurred in Webots, or possible in a library used by your plugin. ![]() ^ page top ^ |
| E-mail to webmaster | Last updated: | Copyright © 2008 Cyberbotics Ltd. |