Debugging the AZ Code Generator Utility
AZ Code Generator is in preview release and is subject to change. |
When using Waf and the AZ Code Generator utility, you might need to debug Waf Python scripts and your template drivers. You can also debug the AZ Code Generator utility itself, although it is less likely to be necessary. You can debug the AZ Code Generator utility by using Visual Studio in Windows or Xcode in macOS.
Topics
Prerequisites
The required preliminary steps depend on your operating system.
Windows Debugging
To debug AZ Code Generator using Visual Studio in Windows, you must generate a Visual
Studio HostTools solution (.sln
) file.
To generate a Visual Studio HostTools solution file
-
Run the following command line from the
dev
folder.lmbr_waf.bat configure --enabled-game-projects= --specs-to-include-in-project-generation=host_tools --visual-studio-solution-name=HostTools
-
In Visual Studio, open the
dev/Solutions/HostTools.sln
file.
macOS Debugging
To enable Waf support for Xcode, perform the following steps to generate an Xcode project.
To generate an Xcode project
-
Open the
dev/_WAF_/specs/all.json
file. -
Temporarily add
AzCodeGenerator
tomodules
. -
Run
./lmbr_waf.sh configure
to regenerate the Xcode project. -
Open the
dev/Solutions/LumberyardSDK.xcodeproj
file.
Debugging the AZ Code Generator Utility from the Waf build
To debug the AZ Code Generator Utility from the Waf build, you must find the arguments file generated by Waf.
Waf generates an arguments file that is passed to AZ Code Generator as a command line
parameter. All command line parameters from Waf for AZ Code Generator are contained
inside the
arguments file. This file is useful for debugging specific Waf AZ Code Generator invocations.
To make the arguments file that you use available to Waf, add the
--zones=az_code_gen
option to the Waf command line.
When you use the --zones=az_code_gen
option, the output looks like the
following.
lmbr_waf build_win_x64_vs_2013_release -p all --zones=az_code_gen [ 1/3150] az_code_gen (win_x64|release): BinTemp\win_x64_release\Code\Launcher\WindowsLauncher\GameSDKWindowsLauncherStaticModules.json 14:24:17 az_code_gen Invoking code generator with command: g:\lyengine\Systems\dev\Bin64\azcg\AzCodeGenerator.exe @g:\lyengine\Systems\dev\BinTemp\win_x64_release\CodeGenArguments\arguments_file_ee625f9186107e30ab3126cc30cc9b49.args
In this example Waf output, the following is the arguments file.
@g:\lyengine\Systems\dev\BinTemp\win_x64_release\CodeGenArguments\arguments_file_ee625f9186107e30ab3126cc30cc9b49.args
Setting Visual Studio Debug Arguments
To set up debugging of AZ Code Generator from Visual Studio, perform the following steps.
To debug AZ Code Generator from Visual Studio
-
Perform the steps to set up Windows debugging as described in Prerequisites.
-
In the Visual Studio Solution Explorer, right-click AzCodeGenerator, and then select Properties.
-
Under Debugging, paste the path to the arguments file into Command Arguments.
-
Click OK to close the Property window.
-
Right-click AzCodeGenerator and then click Set as StartUp Project.
-
Press F5 to launch the debugger.
Setting Xcode Debug Arguments
To set up debugging of AZ Code Generator from Xcode, perform the following steps.
To debug AZ Code Generator from Xcode
-
Perform the steps to set up macOS debugging as described in Prerequisites.
-
In Xcode, under the Product, Scheme menu, choose AzCodeGenerator.
-
At the bottom of the Product, Scheme menu, choose Edit Scheme.
-
Under Arguments, add a new entry to Arguments Passed On Launch that contains your debug arguments.
-
Under Info, from the Executable drop down, select Other.
-
Navigate to the directory
dev/BinMac64.Debug/azcg/AzCodeGenerator
. -
Click Choose.
-
-
Close the scheme editor.
-
Choose Product, Run to launch the debugger.