Menu
Lumberyard
Developer Guide (Version 1.12)

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.

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

  1. 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
  2. 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

  1. Open the dev/_WAF_/specs/all.json file.

  2. Temporarily add AzCodeGenerator to modules.

  3. Run ./lmbr_waf.sh configure to regenerate the Xcode project.

  4. 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

  1. Perform the steps to set up Windows debugging as described in Prerequisites.

  2. In the Visual Studio Solution Explorer, right-click AzCodeGenerator, and then select Properties.

  3. Under Debugging, paste the path to the arguments file into Command Arguments.

  4. Click OK to close the Property window.

  5. Right-click AzCodeGenerator and then click Set as StartUp Project.

  6. 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

  1. Perform the steps to set up macOS debugging as described in Prerequisites.

  2. In Xcode, under the Product, Scheme menu, choose AzCodeGenerator.

  3. At the bottom of the Product, Scheme menu, choose Edit Scheme.

  4. Under Arguments, add a new entry to Arguments Passed On Launch that contains your debug arguments.

  5. Under Info, from the Executable drop down, select Other.

    1. Navigate to the directory dev/BinMac64.Debug/azcg/AzCodeGenerator.

    2. Click Choose.

  6. Close the scheme editor.

  7. Choose Product, Run to launch the debugger.