Debugging own code

Apr 16, 2012 at 12:28 PM
Edited Apr 16, 2012 at 12:29 PM

Is there some sort of extra step that is needed to trigger breakpoints on my own code?

I start the debugger and it automaticaly halts in OnlineSubSystem, and I can use f10 to step through the code so I know the debugger is working.  I set a breakpoint on chooseplayerstart, and that breakpoint triggers too.

I also have a breakpoint on my custom RatePlayerStart code, which never gets triggered.

If I step into RatePlayerStart from Epics ChoosePlayerStart I can see the debugger is evaluating all the data and moving over the breakpoint that I set, but it never activates if I tell it to run there automatically (eg press f5).

Coordinator
Apr 16, 2012 at 1:44 PM
Edited Apr 16, 2012 at 1:44 PM

Hi GeekyPayback

You have forgotten to add your game to command line parameters. So each time you start the debugger you start UDK code only.

Please have a look into Documentation show to specify additional command line parameters in a project,.  (Section - "How to start debugger with custom command line arguments")

Regards

Unreal Script IDE Developer.

Apr 16, 2012 at 10:19 PM
Edited Apr 16, 2012 at 10:42 PM

These are my commandline parameters - game_board?game=zGame.zGameInfo

The game still doesn't seem to break but I am listing the game to launch

Coordinator
Apr 17, 2012 at 8:43 AM

have a look into your log when you start UDK if you have any warning regarding your Mod.  (Do you have your game mode named zGame?)

It maybe not loaded for some reason. I still think you specifing your parameters incorrectly. Try to start your game without IDE using command line and see if your game is up and running, if not, you need to ask for help on UDK.com forum.

 

Regards

Unreal Script IDE Developer.

Apr 18, 2012 at 10:18 PM

This is the log.  The package name is zGame, the gamemode itself is called zGameInfo so Im sure its loading. The game is a boardgame, so I can tell my code is working because it doesnt play like an FPS. The game loads and runs fine, and I can debug the code as long as I set my breakpoints in the UDK code rather than my own.  Any ideas what I could be setting wrong?  

My command line arguments are now :- sushi_bar_game_board.udk?game=zGame.zGameInfo

Init: UnrealScript Debugger Core Initialized.
Log: Attaching UnrealScript Debugger (currently attached)
Init: XAudio2Device initialized.
Init: Client initialized
Log: Steam Client API is unavailable
Log: LoadMap: sushi_bar_game_board.udk?Name=Player?Team=255?game=zGame.zGameInfo
Log: Game class is 'zGameInfo'
Log: Primary PhysX scene will be in software.
Log: Creating Primary PhysX Scene.
Log: Bringing World sushi_bar_game_board.TheWorld up for play (0) at 2012.04.18-23.13.33
Log: WARNING: Cooking Convex For Actor: sushi_bar_game_board.TheWorld:PersistentLevel.zTile_0 Component: StaticMeshComponent_0 StaticMesh: EditorMeshes.PhAT_FloorBox (Scale: 0.150000 0.150000 0.150000) Please go and set PreCachedPhysScale on the mesh to have this scale for RunTime spawned objects.
Log: WARNING: Cooking Convex For Actor: sushi_bar_game_board.TheWorld:PersistentLevel.zDice_0 Component: StaticMeshComponent_24 StaticMesh: EngineMeshes.Cube (Scale: 0.250000 0.250000 0.250000) Please go and set PreCachedPhysScale on the mesh to have this scale for RunTime spawned objects.
Log: Bringing up level for play took: 0.025631
ScriptWarning: Accessed None 'Profile'
	UIDataStore_OnlinePlayerData Transient.DataStoreClient_0:UIDataStore_OnlinePlayerData_0
	Function Engine.UIDataStore_OnlinePlayerData:OnLoginChange:0206
ScriptWarning: Accessed None 'Profile'
	UIDataStore_OnlinePlayerData Transient.DataStoreClient_0:UIDataStore_OnlinePlayerData_0
	Function Engine.UIDataStore_OnlinePlayerData:OnLoginChange:0248
Log: ########### Finished loading level: 0.112670 seconds
Init: Game engine initialized
Log: Initializing Engine Completed
Log: >>>>>>>>>>>>>> Initial startup: 11.38s <<<<<<<<<<<<<<<
Log: Assembled 438 auto-complete commands, manual: 90, exec: 294, kismet: 0
Log: Detaching UnrealScript Debugger (currently detached)
Coordinator
Apr 19, 2012 at 8:49 PM

Let's start fromthe beginning. 

 

reasons why code does not hit breakpoints

1) your module not loaded

2) your module is not compile in "debug mode"

3) code is not called from UDK main code

 

Resons why a module (mod, game) is not loaded:

1) command line parameters not specified or pointing to incorrect module name

2) it is not enable in .Ini file DefaultEngineUDK.ini section [UnrealEd.EditorEngine] contains line "ModEditPackages=<Your game module>"

 

Resons why your module is not compile in "debug mode":

you need to recompile whole project in Debug mode to make sure that debug info compiled in your module (by IDE is doing it automatically)

 

Regards

Unreal Script IDE Developer.

 

 

 

Apr 20, 2012 at 11:53 AM
Edited Apr 20, 2012 at 11:54 AM

ok.

reasons why code does not hit breakpoints

1) I think we've confirmed the module loaded

 

Log: LoadMap: sushi_bar_game_board.udk?Name=Player?Team=255?game=zGame.zGameInfo
Log: Game class is 'zGameInfo'

 

2) Heres the compile results showing its definitely in debug mode

 

Init: Version: 9656
Init: Epic Internal: 0
Init: Compiled (32-bit): Mar 20 2012 19:27:27
Init: Command line:  -debug -full
Init: Base directory: C:\UDK\UDK-2012-03\Binaries\Win32\
Init: Character set: Unicode
Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\Core.u'
--------------------Engine - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\Engine.u'
--------------------IpDrv - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\IpDrv.u'
--------------------GFxUI - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\GFxUI.u'
--------------------GameFramework - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\GameFramework.u'
--------------------UnrealEd - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\UnrealEd.u'
--------------------GFxUIEditor - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\GFxUIEditor.u'
--------------------WinDrv - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\WinDrv.u'
--------------------OnlineSubsystemPC - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\OnlineSubsystemPC.u'
--------------------OnlineSubsystemSteamworks - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\OnlineSubsystemSteamworks.u'
--------------------OnlineSubsystemGameCenter - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\OnlineSubsystemGameCenter.u'
--------------------UDKBase - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\UDKBase.u'
--------------------UTEditor - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\UTEditor.u'
--------------------UTGame - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\UTGame.u'
--------------------UTGameContent - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\UTGameContent.u'
--------------------zGame - Debug--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-03\Binaries\Win32\..\..\UDKGame\Script\zGame.u'

Success - 0 error(s), 0 warning(s)

Execution of commandlet took:  10.38 seconds
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

 

3) This function uses super, the log message appears and super runs so Main code is definetly calling it.

 

function Pawn SpawnDefaultPawnFor(Controller NewPlayer, NavigationPoint StartSpot)
{
	local zPawn ResultPawn;
	
	ResultPawn = zPawn(Super.SpawnDefaultPawnFor(NewPlayer, StartSpot));
	ResultPawn.StartSpot = StartSpot;
        `log ("start spot"@StartSpot);
	return ResultPawn;
}

 

Resons why a module (mod, game) is not loaded:

1) You can now see the module name and I promise the game is called zGameInfo.  Like I said, my code loads and runs when I hit debug so we know the module is loading

2) Line 62 of my DefaultEngineUDK.ini reads as follows

[UnrealEd.EditorEngine]
EditPackagesOutPath=..\..\UDKGame\Script
FRScriptOutputPath=..\..\UDKGame\ScriptFinalRelease
+EditPackages=UDKBase
+EditPackages=UTEditor
;ModEditPackages=MyMod
+ModEditPackages=zGame

Going through you list it looks like my project is set up correctly, but I still can't trigger breakpoints on my own code (they only work on the main UDK code)

Does any of what I've posted look wrong or can you think of anything else that would cause this?

Coordinator
Apr 20, 2012 at 2:33 PM
Edited Apr 20, 2012 at 2:33 PM

it seems all fine, Where do you set your breakpoint? On this line?

>> ResultPawn = zPawn(Super.SpawnDefaultPawnFor(NewPlayer, StartSpot));
Apr 20, 2012 at 2:48 PM
Edited Apr 20, 2012 at 2:50 PM

no, I try to break on the `log("start spot"@StartSpot); line, because I can see it happening.

Coordinator
Apr 20, 2012 at 3:01 PM

try to put a breakoint on the line which I showed, I do strip out '<Log> commands and it can be the reason by debugger do not hit 'Log line.

Apr 24, 2012 at 12:56 PM

I put the breakpoint on the line you showed.  It still didn't break.

Aug 29, 2012 at 12:46 PM

I am having the same problem as geekypayback, Followed all the steps and the debugger is running my code and printing a message to the log but it won't stop at the break point.

I'm not sure how to proceed to get it to work :/

Coordinator
Aug 29, 2012 at 2:13 PM

does the debugger hit the first execution line ? 

Aug 29, 2012 at 6:19 PM

Yes it hits "    AccountInterface = OnlineAccountInterface(NewInterface); " and subsequent breakpoints in the engine package but not in my own package. My code is running and the line I'm trying to break on is printing to the log file.

Aug 29, 2012 at 9:37 PM

So I've tinkered for hours with getting some test programs running and making a custom player and input scripts and messing with lots of ini files and stuff. (I'm new to UDK.)
And now the debugger works flawlessly and I can't reproduce the problem. I have no idea what the issue was or how it was resolved, but hey if it works it works!

Thank you for an awesome tool!