问题描述
需要使用lldb对xts的hap进行调试,当前期望在使用aa test命令拉起应用时使用-D参数等待lldb连接。
当前使用-D参数拉起命令提示如下:
error: failed to start user test.
error: not supported in non-app-provision mode.
问题描述
需要使用lldb对xts的hap进行调试,当前期望在使用aa test命令拉起应用时使用-D参数等待lldb连接。
当前使用-D参数拉起命令提示如下:
error: failed to start user test.
error: not supported in non-app-provision mode.
解决方案步骤:
开启调试模式签名
// 在模块的build-profile.json5中增加debug签名配置
"signingConfigs": [{
"name": "debug",
"provisionProfile": "./signature/debug.p7b", // 调试用证书
"certificationPath": "./signature/debug.crt"
}]
强制指定debug编译类型
// 在测试模块的build-profile.json5中
"buildTypes": {
"debug": {
"compileType": "debug",
"runtimeArgs": ["-D"] // 强制启用调试参数
}
}
使用完整调试命令
# 需要指定测试类型和调试参数组合
aa test -p your.bundle.name -t unittest -D --timeout 300
关键原理:
XTS测试默认使用release provisioning模式,需要通过以下方式强制开启调试:
验证方式:
观察日志中出现Waiting for debugger on port 50050
提示即表示调试模式激活成功,此时可通过lldb连接调试会话
解决方案
xts包与应用包无区别,编译调试包可使用IDE进行编译。