当前位置: 首页 > news >正文

UE4调试UAT时为何断点不了BuildCookRun的部分代码

背景

我之前写了一篇文档,大意是使用 UAT 来调试 BuildCookRun 命令:

UE4如何调试BuildCookRun-CSDN博客

(图1)

但发现某一些cs代码(代码1)无法断点调试,配置如图1所示,图中马赛克的参数如代码2所示。 

//代码1:
private LinkEnvironment SetupBinaryLinkEnvironment(ReadOnlyTargetRules Target, UEToolChain ToolChain, LinkEnvironment LinkEnvironment, CppCompileEnvironment CompileEnvironment, FileReference SingleFileToCompile, ISourceFileWorkingSet WorkingSet, DirectoryReference ExeDir, TargetMakefile Makefile)
{……Log.TraceInformation("Compile target:{0}, module:{1}, LinkType:{2} ", Target.Name,    Module.Name, Target.LinkType);
LinkInputFiles = Module.Compile(Target, ToolChain, BinaryCompileEnvironment, SingleFileToCompile, WorkingSet, Makefile);……}
//代码2:
-ScriptsForProject=j:\Light_Check_MyGame\MyGame_Mini\MyGame_Mini.uproject   BuildCookRun -nop4 -project=j:\Light_Check_MyGame\MyGame_Mini\MyGame_Mini.uproject  -cook -stage -archive -archivedirectory=j:\Light_Check_MyGame\MyGame_Mini\Saved\Archived   -package -ue4exe=j:\Light_Check_MyGame\EngineSource/Engine/Binaries/Win64/UE4Editor-Cmd.exe -compressed -pak -prereqs -nodebuginfo -manifests -targetplatform=Win64 -build -target=MyGame_Mini  -clientconfig=Development -utf8output -compile

原因分析

原来,我的调试需求其实是想要调试“编译代码”的步骤,这只是 BuildCookRun 功能中的一部分,体现在  -build 参数这儿。BuildCookRun 是由 UAT 直接实现的,它调用UBT 去跑一系列动作,包括 Build Cook Archive 等,如代码3所示。

//代码3: EngineSource\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.csprotected void DoBuildCookRun(ProjectParams Params){const ProjectBuildTargets ClientTargets = ProjectBuildTargets.ClientCooked | ProjectBuildTargets.ServerCooked;Project.Build(this, Params, WorkingCL, bGenerateNativeScripts ? (ProjectBuildTargets.All & ~ClientTargets) : ProjectBuildTargets.All);Project.Cook(Params);        Project.CopyBuildToStagingDirectory(Params);Project.Package(Params, WorkingCL);Project.Archive(Params);Project.Deploy(Params);PrintRunTime();Project.Run(Params);Project.GetFile(Params);}

其中,Project.Build() ,我们今天的主角,调用的是另外一个程序 exe (神秘程序X),代码中的 Run 的底层是调用 IProcessResult Result = ProcessManager.CreateProcess  ,即操作系统的进程调用。

// 代码4:J:\\EngineSource\Engine\Source\Programs\AutomationTool\AutomationUtils\UBTUtils.cspublic static void RunUBT(CommandEnvironment Env, string UBTExecutable, string CommandLine){
……IProcessResult Result = Run(UBTExecutable, CommandLine, Options: ERunOptions.AllowSpew | ERunOptions.NoStdOutCapture); // 调用操作系统里的命令行if(Result.ExitCode != 0){throw new AutomationException((ExitCode)Result.ExitCode, "UnrealBuildTool failed. See log for more details. ({0})", CommandUtils.CombinePaths(Env.FinalLogFolder, LogName)) { OutputFormat = AutomationExceptionOutputFormat.Minimal };}}

这个神秘程序 X (代码4中的 UBTExecutable),及其参数(代码4中的 CommandLine),就是:

程序:J:\Light_Check_MyGame\EngineSource\Engine\Binaries\DotNET\UnrealBuildTool.exe

参数:UnrealHeaderTool Win64 Development -Project=j:\Light_Check_MyGame\_MyGame_Mini\_MyGame_Mini.uproject j:\Light_Check_MyGame\_MyGame_Mini\_MyGame_Mini.uproject -NoUBTMakefiles -Manifest=J:\Light_Check_MyGame\EngineSource\Engine\Intermediate\Build\Manifest.xml -NoHotReload -log="J:\Light_Check_MyGame\EngineSource\Engine\Programs\AutomationTool\Saved\Logs\UBT-UnrealHeaderTool-Win64-Development.txt"

由此,我们得知,UAT 调用了 UBT 。所以我们如果要看代码的编译过程,就应该调试UBT,参考这篇文章:  UBT如何编译UE4工程代码_编译ue4工程的文件-CSDN博客。 那么下图6中的所有代码范围,都属于 UBT 的范围,因此都应该按 UBT 来调试。这就是本文标题 《UE4调试UAT时为何断点不了BuildCookRun的部分代码》的答案了。

(图6)

下面贴出堆栈方便作为参考。

BuildCookRun的执行堆栈

BuildCookRun.DoBuildCookRun() at J:/Light_Check_UHD/EngineSource/Engine/Source/Programs/AutomationTool/Scripts/BuildCookRun.Automation.cs:line 198
BuildCookRun.ExecuteBuild() at J:/Light_Check_UHD/EngineSource/Engine/Source/Programs/AutomationTool/Scripts/BuildCookRun.Automation.cs:line 39
BuildCommand.Execute()
Automation.Execute()
Automation.Process()
Program.MainProc()
Program.<>c__DisplayClass1_0.<Main>b__2()
InternalUtils.RunSingleInstance()
Program.Main()
[External code: 2 frames]
Launcher.Main()

RunUBT的执行堆栈

CommandUtils.RunUBT() at EngineSource/Engine/Source/Programs/AutomationTool/AutomationUtils/UBTUtils.cs:line 23
CommandUtils.RunUBT() at EngineSource/Engine/Source/Programs/AutomationTool/AutomationUtils/UBTUtils.cs:line 89
UE4Build.BuildWithUBT()
UE4Build.Build()
Project.Build()
BuildCookRun.DoBuildCookRun()
BuildCookRun.ExecuteBuild()
BuildCommand.Execute()
Automation.Execute()
Automation.Process()
Program.MainProc()
Program.<>c__DisplayClass1_0.<Main>b__2()
InternalUtils.RunSingleInstance()
Program.Main()
[External code: 2 frames]
Launcher.Main()


文章转载自:

http://AwGoKVgL.zxwqt.cn
http://1Chn5TSm.zxwqt.cn
http://sPa6sa1L.zxwqt.cn
http://ByD0Xtpr.zxwqt.cn
http://SVWVWc7b.zxwqt.cn
http://bU75uCV8.zxwqt.cn
http://l2aT6Ovi.zxwqt.cn
http://f3sikgkQ.zxwqt.cn
http://DZSNJpQM.zxwqt.cn
http://Iita9uPE.zxwqt.cn
http://eM8EdYuz.zxwqt.cn
http://36eb9reS.zxwqt.cn
http://z5oJUaUu.zxwqt.cn
http://QmpgnHIw.zxwqt.cn
http://vkWgytVd.zxwqt.cn
http://lEstCNvs.zxwqt.cn
http://a3sIqFCg.zxwqt.cn
http://GwoZBu1h.zxwqt.cn
http://eipASabg.zxwqt.cn
http://8tiuZ1Bq.zxwqt.cn
http://PVY5W2Zq.zxwqt.cn
http://Z87iIMIm.zxwqt.cn
http://81k8eSYG.zxwqt.cn
http://6XmXHpcD.zxwqt.cn
http://6a1aZObH.zxwqt.cn
http://l6MtvxyS.zxwqt.cn
http://TdVEU7lr.zxwqt.cn
http://nEu7E0KJ.zxwqt.cn
http://oJ7TfE9o.zxwqt.cn
http://QaDyQP9c.zxwqt.cn
http://www.dtcms.com/a/366477.html

相关文章:

  • MySQL 时间函数全解析:从 NOW() 到 UTC_TIMESTAMP() 的深度实践与选择策略
  • vscode launch.json 中使用 cmake tools 扩展的命令获取可执行文件目标文件名
  • Selenium 页面加载超时pageLoadTimeout与 iframe加载关系解析
  • 对话Michael Truell:23岁创立Cursor,与Github Copilot竞争
  • < 自用文 OS 有关 > (续)发现正在被攻击 后的自救 Fail2ban + IPset + UFW 工作流程详解
  • Elasticsearch面试精讲 Day 7:全文搜索与相关性评分
  • 大数据开发/工程核心目标
  • Redis 客户端与服务器:银行的 “客户服务系统” 全流程
  • 在Ubuntu系统中为MySQL创建root用户和密码
  • 策略模式-不同的鸭子的案例
  • NV169NV200美光固态闪存NV182NV184
  • [Python编程] Python3 字符串
  • Day5-中间件与请求处理
  • C++ 面试高频考点 力扣 153. 寻找旋转排序数组中的最小值 二分查找 题解 每日一题
  • C++ opencv+gstreamer编译,C++ opencv4.5.5+gstreamer1.0 -1.24.12 编译 ,cmake 4.0.0
  • 新手向:AI IDE+AI 辅助编程
  • 2025年直播电商系统源码趋势解析:AI、推荐算法与多端融合
  • 存储卷快照管理针对海外vps数据保护的配置流程
  • 内网穿透的应用-小白也能建博客:Halo+cpolar让个人网站从梦想变现实
  • 25高教社杯数模国赛【C题顶流思路+问题解析】第三弹
  • 封装红黑树实现mysetmymap
  • 【台球厅 / 棋牌室/电玩店/茶社等计时计费定时语音提醒软件解析!】佳易王 计时计费高级版V18.3 实测:双时间显示 + 语音提醒 + 智能记事全解析
  • 【C++】16. set和map
  • mysql安装(压缩包方式8.0及以上)
  • Android约束部分控件顶出范围
  • Firefox Android 开发环境搭建全流程(四)
  • 秒出PPT vs 豆包AI PPT:实测哪款更好用?
  • Gamma AI:AI演示文稿制作工具,高效解决PPT框架搭建难与排版耗时问题
  • bash自带的切片操作
  • java对接物联网设备(一)——使用okhttp网络工具框架对接标准API接口