Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对iOS17进行启动数据的测量,能唤起对应的App,但是无法获取启动阶段的数据。 #151

Closed
erduoniba opened this issue Aug 19, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@erduoniba
Copy link

Smartphone (please complete the following information):

  • Device: iPhone13
  • OS: iOS17.0
  • Pyidevice Version [e.g. 2.2.0]

前置信息,按照文档进行安装:

Support iOS 17 (Command line is not supported )
pip install pymobiledevice3
sudo python3 -m pymobiledevice3 remote start-tunnel
from ios_device.remote.remote_lockdown import RemoteLockdownClient
from ios_device.servers.Instrument import  InstrumentServer
from demo.instrument_demo.sysmontap import  sysmontap
host = 'fdb1:c2d3:d8cd::1'
port = 60574  
with RemoteLockdownClient((host, port)) as rsd:
    rpc = InstrumentServer(rsd).init()
    sysmontap(rpc)
    rpc.stop()

Describe the bug
按照文档对iOS17进行启动数据的测量,测试代码如下:

with RemoteLockdownClient((host, port)) as rsd:
        print(f'start {bundleid}')
        rpc = InstrumentServer(rsd).init()
        app_launch_lifecyle(rpc, bundleid, rsd)
        rpc.stop()

可以正常唤起iOS17设备对应的app,但是日志没有输出详细的启动数据,感觉是卡住,日志如下:

start com.xunmeng.pinduoduo pid:23016
@YueChen-C
Copy link
Owner

YueChen-C commented Aug 19, 2024

测试过非 17 以下的版本吗,测试过成中要避免其他程序 instrument 对其的影响例如 tidevice 等,建议重启后再执行。
#149

@erduoniba
Copy link
Author

测试过非 17 以下的版本吗,测试过成中要避免其他程序 instrument 对其的影响例如 tidevice 等,建议重启后再执行。 #149

没有测试过非17以下的设备,也没有开启过instrument,也重启了电脑再试也不行。只是打印了:
start com.xunmeng.pinduoduo pid:23016
后没有后文了

@YueChen-C
Copy link
Owner

YueChen-C commented Aug 30, 2024

看了一下 ios17 一部分机器 KdBuf 解析有点问题,还有就是 17 不知道为什么有时候不回传堆栈数据

@YueChen-C YueChen-C added the bug Something isn't working label Aug 30, 2024
@YueChen-C
Copy link
Owner

经过排查我发现经过 pm3 隧道出来的包,偶尔包数据中出现了乱序的问题,还不知道原因。
大概只有 3/10 的概率能正常获取到启动数据,我的测试版本是 ios 17.5.1

@YueChen-C
Copy link
Owner

使用新版本+ go-ios 创建的隧道,可以比较稳定的获取数据,关闭该问题,如果还有问题,请从新开启或者提交新的 issues

@erduoniba
Copy link
Author

拉取了最新的代码之后,app_lifecycle.py 代码需要修改成:

    bundleid = 'com.xxx.xxx'
    with RemoteLockdownClient(('fd40:34c8:xxx::1', xxxxx)) as rsd:
        rpc = InstrumentServer(rsd).init()
        app_launch_lifecyle(rpc, bundleid, rsd)
        rpc.stop()

才可以唤起对应的App,但是依旧获取不到启动阶段的数据,终端日志如下,辛苦再看一下:

start com.xxx.xxx pid:1362
Exception ignored in thread started by: <function app_launch_lifecyle.<locals>.demo at 0x101af2dc0>
Traceback (most recent call last):
  File "/Users/denglibing3/HDProject/GithubProject/py-ios-device/demo/instrument_demo/app_lifecycle.py", line 31, in demo
    _tid = Kperf.threads_tids.get(event.tid)
AttributeError: 'KperfData' object has no attribute 'threads_tids'
Exception ignored in thread started by: <function app_launch_lifecyle.<locals>.demo at 0x101af2dc0>
Traceback (most recent call last):
  File "/Users/denglibing3/HDProject/GithubProject/py-ios-device/demo/instrument_demo/app_lifecycle.py", line 31, in demo
    _tid = Kperf.threads_tids.get(event.tid)
AttributeError: 'KperfData' object has no attribute 'threads_tids'
Exception ignored in thread started by: <function app_launch_lifecyle.<locals>.demo at 0x101af2dc0>
Traceback (most recent call last):
  File "/Users/denglibing3/HDProject/GithubProject/py-ios-device/demo/instrument_demo/app_lifecycle.py", line 31, in demo
    _tid = Kperf.threads_tids.get(event.tid)
AttributeError: 'KperfData' object has no attribute 'threads_tids'
Exception ignored in thread started by: <function app_launch_lifecyle.<locals>.demo at 0x101af2dc0>
Traceback (most recent call last):
  File "/Users/denglibing3/HDProject/GithubProject/py-ios-device/demo/instrument_demo/app_lifecycle.py", line 31, in demo
    _tid = Kperf.threads_tids.get(event.tid)
AttributeError: 'KperfData' object has no attribute 'threads_tids'
Exception ignored in thread started by: <function app_launch_lifecyle.<locals>.demo at 0x101af2dc0>
Traceback (most recent call last):
  File "/Users/denglibing3/HDProject/GithubProject/py-ios-device/demo/instrument_demo/app_lifecycle.py", line 31, in demo
    _tid = Kperf.threads_tids.get(event.tid)
AttributeError: 'KperfData' object has no attribute 'threads_tids'
Exception ignored in thread started by: <function app_launch_lifecyle.<locals>.demo at 0x101af2dc0>
Traceback (most recent call last):
  File "/Users/denglibing3/HDProject/GithubProject/py-ios-device/demo/instrument_demo/app_lifecycle.py", line 31, in demo
    _tid = Kperf.threads_tids.get(event.tid)
AttributeError: 'KperfData' object has no attribute 'threads_tids'

@YueChen-C
Copy link
Owner

YueChen-C commented Sep 25, 2024

AttributeError: 'KperfData' object has no attribute 'threads_tids' 找不到是代码不是最新的,然后用最新的目前版本是 2.4.18

@erduoniba
Copy link
Author

erduoniba commented Sep 25, 2024

AttributeError: 'KperfData' object has no attribute 'threads_tids' 找不到是代码不是最新的,然后用最新的目前版本是 2.4.18

已经更新到 2.4.18 了,还是上面的错误提示。我这边通过对 threads_tids 判空检查后,虽然没有报错,但是没有任何启动阶段的数据。

if not _tid:
   continue
print('_tid not found')

添加日志后,是一直没有打印 _tid not found 数据。

@YueChen-C
Copy link
Owner

YueChen-C commented Sep 26, 2024

又更新了一点,有点小 bug,但是 threads_tids 找不到的问题,有点摸不着 KperfData 对象肯定是有 threads_tids 的

@erduoniba
Copy link
Author

又更新了一点,有点小 bug,但是 threads_tids 找不到的问题,有点摸不着 KperfData 对象肯定是有 threads_tids 的

嗯,更新代码是没有报错了。
但是启动阶段数据没有捕获到

    def demo(data):
        print(f'data: {data}')

在这里添加打印,一直没有打印,大佬辛苦再看看

@YueChen-C
Copy link
Owner

理论上没有可能出现这种情况 ,除非有其他进程 也启动了 com.apple.instruments.server.services.coreprofilesessiontap 服务

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants