Difference between revisions of "Modules/debug/Usage"

From MSX Game Library

< Modules‎ | debug

({{openMSX}} openMSX)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=== Emulators ===
 
=== Emulators ===
 
==== {{Emulicious}} Emulicious ====
 
==== {{Emulicious}} Emulicious ====
Emulicious support all avaible debug functions. The
+
Emulicious support all avaible debug functions. Messages sent by the game are displayed in the debugger's “Console” tab.
  
 +
For profiling your program with Emulicious, you don't need to modify any thing in your code. Emulicious provide many debug tools, including a Profiler which lets you see which parts of your code take the longest (Call Tree), or which functions cost the most (Hot Spots).
  
For profiling your program with Emulicious, you don't need to modify ant thing in your code. Emulicious use the symbols file to detection func
+
<img src="https://raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/tools/emulicious_3.png" style="width:512px;" />
 
+
<img src="https://raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/tools/emulicious_4.png" style="width:512px;" />
<img src="https://raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/tools/emulicious_3.png" style="width:50%" />
 
<img src="https://raw.githubusercontent.com/aoineko-fr/MSXgl/main/engine/doc/img/tools/emulicious_4.png" style="width:50%" />
 
  
 
It is recommended to call the <tt>DEBUG_INIT()</tt> function at the beginning of your program to mark the memory area reserved by the BIOS and let know the emulator to don't through warning when accessing this uninitialized memory.
 
It is recommended to call the <tt>DEBUG_INIT()</tt> function at the beginning of your program to mark the memory area reserved by the BIOS and let know the emulator to don't through warning when accessing this uninitialized memory.
Line 13: Line 12:
 
==== {{openMSX}} openMSX ====
 
==== {{openMSX}} openMSX ====
  
When <tt>DEBUG_TOOL</tt> is set to <tt>DEBUG_OPENMSX_P</tt>, you also need to setup additionnal emulator command line in your project configuration (<tt>project_config.js</tt>):
+
By default, openMSX does not allow you to use all the features of the Debug module: <tt>DEBUG_BREAK()</tt>, <tt>DEBUG_ASSERT()</tt> et <tt>DEBUG_PRINT()</tt> are not supported.
 +
 
 +
To overcome this limitation, user PVM has developed a TCL script that adds the missing functionalities. To use it, set <tt>DEBUG_TOOL</tt> to <tt>DEBUG_OPENMSX_P</tt> in your library configuration (<tt>msxgl_config.h</tt>) and setup additionnal emulator command line in your project configuration (<tt>project_config.js</tt>):
 
<syntaxhighlight lang="js">
 
<syntaxhighlight lang="js">
 
//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
 
//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
Line 19: Line 20:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
When <tt>PROFILE_TOOL</tt> is set to <tt>PROFILE_OPENMSX_G</tt> (Grauw's profiler), you also need to setup additionnal emulator command line in your project configuration (<tt>project_config.js</tt>):
+
 
 +
By default, openMSX has no code profiling tool either. 2 TCL scrips have been created to make up for this limitation. To use them, set <tt>PROFILE_TOOL</tt> to <tt>PROFILE_OPENMSX_G</tt> (Grauw's profiler) or <tt>PROFILE_OPENMSX_S</tt> (Sallute's profiler) in your library configuration file (<tt>msxgl_config.h</tt>).
 +
You also need to add emulator command line in your project configuration (<tt>project_config.js</tt>):
 +
 
 +
For <tt>PROFILE_OPENMSX_G</tt>:
 
<syntaxhighlight lang="js">
 
<syntaxhighlight lang="js">
 
//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
 
//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
Line 25: Line 30:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
When <tt>PROFILE_TOOL</tt> is set to <tt>PROFILE_OPENMSX_S</tt> (Sallute's profiler), you also need to setup additionnal emulator command line in your project configuration (<tt>project_config.js</tt>):
+
For <tt>PROFILE_OPENMSX_S</tt>:
 
<syntaxhighlight lang="js">
 
<syntaxhighlight lang="js">
 
//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
 
//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
EmulExtraParam= `-script ${ToolsDir}script/openMSX/profiler_salute.tcl -command "profile::section_scope_bp frame 0xFD9F; profile_osd ms;"`;
+
EmulExtraParam= `-script ${ToolsDir}script/openMSX/profiler_salutte.tcl -command "profile::section_scope_bp frame 0xFD9F; profile_osd ms;"`;
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
If you don't know which one to choose, take the second one, which has a documentation: https://github.com/MartinezTorres/OpenMSX_profiler
  
 
==== Others ====
 
==== Others ====
 +
All other emulators are not known to offer debug communication or profiling and, thus, are not supported.

Latest revision as of 21:13, 19 September 2024

Emulators

Emulicious

Emulicious support all avaible debug functions. Messages sent by the game are displayed in the debugger's “Console” tab.

For profiling your program with Emulicious, you don't need to modify any thing in your code. Emulicious provide many debug tools, including a Profiler which lets you see which parts of your code take the longest (Call Tree), or which functions cost the most (Hot Spots).

It is recommended to call the DEBUG_INIT() function at the beginning of your program to mark the memory area reserved by the BIOS and let know the emulator to don't through warning when accessing this uninitialized memory.

openMSX

By default, openMSX does not allow you to use all the features of the Debug module: DEBUG_BREAK(), DEBUG_ASSERT() et DEBUG_PRINT() are not supported.

To overcome this limitation, user PVM has developed a TCL script that adds the missing functionalities. To use it, set DEBUG_TOOL to DEBUG_OPENMSX_P in your library configuration (msxgl_config.h) and setup additionnal emulator command line in your project configuration (project_config.js):

//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
EmulExtraParam= `-script ${ToolsDir}script/openMSX/debugger_pvm.tcl`;


By default, openMSX has no code profiling tool either. 2 TCL scrips have been created to make up for this limitation. To use them, set PROFILE_TOOL to PROFILE_OPENMSX_G (Grauw's profiler) or PROFILE_OPENMSX_S (Sallute's profiler) in your library configuration file (msxgl_config.h). You also need to add emulator command line in your project configuration (project_config.js):

For PROFILE_OPENMSX_G:

//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
EmulExtraParam= `-script ${ToolsDir}script/openMSX/profiler_grauw.tcl`;

For PROFILE_OPENMSX_S:

//-- Emulator extra parameters to be add to command-line (string). Emulator sotfware specific
EmulExtraParam= `-script ${ToolsDir}script/openMSX/profiler_salutte.tcl -command "profile::section_scope_bp frame 0xFD9F; profile_osd ms;"`;

If you don't know which one to choose, take the second one, which has a documentation: https://github.com/MartinezTorres/OpenMSX_profiler

Others

All other emulators are not known to offer debug communication or profiling and, thus, are not supported.