Difference between revisions of "DebugMode"

From The Battle for Wesnoth Wiki
(Building the game with extra debugging: Revised, added cmake and scons info)
(See Also)
 
(4 intermediate revisions by 4 users not shown)
Line 8: Line 8:
  
 
Debug mode can also be enabled within the game using :debug (see [[CommandMode]]), and on Mac versions of the game, by holding down the Option key when starting Wesnoth.
 
Debug mode can also be enabled within the game using :debug (see [[CommandMode]]), and on Mac versions of the game, by holding down the Option key when starting Wesnoth.
 
Note: Debug mode is not safe with replays. If you enter debug mode, create a unit, move it, and then save replay, the replay will be corrupt since the unit creation is not recorded and thus all actions related to it will cause OOS errors. 
 
  
 
''' Debug mode is disabled when you play a network multiplayer game. '''
 
''' Debug mode is disabled when you play a network multiplayer game. '''
Line 15: Line 13:
 
== Building the game with extra debugging ==
 
== Building the game with extra debugging ==
  
The game can be built to support debugging, enabling a few code snippets for the benefit of external debuggers like ''gdb', and disabling compiler optimizations.
+
The game can be built to support debugging, enabling a few code snippets for the benefit of external debuggers like ''gdb'', and disabling compiler optimizations.
  
 
It is a good idea to run a debug build of the game if you do development, since it can be necessary to diagnose serious problems.
 
It is a good idea to run a debug build of the game if you do development, since it can be necessary to diagnose serious problems.
Line 25: Line 23:
 
'''cmake:'''
 
'''cmake:'''
  
  cmake -DCMAKE_BUILD_TYPE=Debug <path to top source dir>
+
  cmake -DCMAKE_BUILD_TYPE=Debug [...] <path to top source dir>
make
 
 
 
'''autotools (1.8 and earlier):'''
 
 
 
./configure --enable-debug
 
 
  make
 
  make
  
An unstripped debug build on linux is over 80MB, compared to 2-3MB stripped. You probably don't want to strip a debugging build, since the symbols are needed for the debugging tool.
+
An unstripped debug build on linux is over 400 MB, compared to around 16 MB stripped. You probably don't want to strip a debugging build, though, since the extra symbols are required by debug tools.
  
 
== See Also ==
 
== See Also ==
  
 
* [[CommandMode]]
 
* [[CommandMode]]
 +
* [[DebuggingWesnoth]]
 
* [[DeveloperResources]]
 
* [[DeveloperResources]]
  
 
[[Category:Building and Installing]]
 
[[Category:Building and Installing]]
 
[[Category:Development]]
 
[[Category:Development]]

Latest revision as of 06:10, 22 September 2021

Debug Mode

Running the game with commandline option --debug or -d enables debug mode within the game.

Debug mode displays additional information. It also enables context menu options to create units anywhere on the map, changing unit sides, and some additional CommandMode commands. If you create units in debug mode, you can then use the :unit command to set the unit's attributes (see CommandMode).

Debug mode can also be enabled within the game using :debug (see CommandMode), and on Mac versions of the game, by holding down the Option key when starting Wesnoth.

Debug mode is disabled when you play a network multiplayer game.

Building the game with extra debugging

The game can be built to support debugging, enabling a few code snippets for the benefit of external debuggers like gdb, and disabling compiler optimizations.

It is a good idea to run a debug build of the game if you do development, since it can be necessary to diagnose serious problems.

scons:

scons build=debug [...]

cmake:

cmake -DCMAKE_BUILD_TYPE=Debug [...] <path to top source dir>
make

An unstripped debug build on linux is over 400 MB, compared to around 16 MB stripped. You probably don't want to strip a debugging build, though, since the extra symbols are required by debug tools.

See Also

This page was last edited on 22 September 2021, at 06:10.