当前位置:网站首页>qtcreator调试webkit
qtcreator调试webkit
2022-08-11 02:10:00 【HUI的技術筆記】
qtreator是在ubuntu上支持gdb比较好的IDE,可以方便的单步调试,快速熟悉代码。
ubuntu上通过qtcreator调试wpewebkit,因为是通过cog启动,wpewebkit进程和cog不是同一个进程,需要通过attach的方式才能断点到Mediaplayer的代码。
配置qtcreator
先从命令行启动cog
cog --platform=x11 https://www.w3.org/2010/05/video/mediaevents.html
找到webkit进程
$ ps -ax | grep webkit
15983 pts/18 SLl+ 0:00 /home/hui/disk4t/codes/wpe/source/inst/libexec/wpe-webkit-1.0/WPENetworkProcess 3 10
15994 pts/18 tLl+ 2:37 /home/hui/disk4t/codes/wpe/source/inst/libexec/wpe-webkit-1.0/WPEWebProcess 8 19
增加qtcreator环境变量
LD_LIBRARY_PATH
$LD_LIBRARY_PATH:/home/hui/disk4t/codes/wpe/source/inst/lib:/home/hui/disk4t/codes/wpe/source/inst/lib/x86_64-linux-gnu
ubuntu上通过qtcreator调试webkit,因为是通过cog启动,wpewebkit进程和cog不是同一个进程,需要通过attach的方式才能断点到Mediaplayer的代码。
attach到WPEWebProcess进程
attach从qtcreator菜单进入:
Select Debug > Start Debugging > Attach to Running Application
选择15994进程,如果出现ptrace的error,需要做如下配置:
ptrace: Operation not permitted. Could not attach to the process. Make sure no other debugger traces this process. If your uid matches the uid of the target process, check the settings of /proc/sys/kernel/yama/ptrace_scope For more details, see /etc/sysctl.d/10-ptrace.conf将/proc/sys/kernel/yama/ptrace_scope虚拟文件的内容设为0:
echo 0 > /proc/sys/kernel/yama/ptrace_scope这个是临时方法,重启之后失效。
设置好断点后,运行效果如下:

通过cog启动,然后attach到WPEWebProcess后,发现https://www.w3.org/2010/05/video/mediaevents.html这个测试页面在cog启动后,video标签已经完全加载,没法断点到player创建的地方。
所以又找了一个测试页面https://easyhtml5video.com/help/html-5-video-test-7.html,通过log发现,这个页面启动cog后video标签没有加载,满足条件,设置断点后成功中断。
cog启动:
cog --platform=x11 https://easyhtml5video.com/help/html-5-video-test-7.html
attach进程后的中断:

MediaPlayerPrivateGStreamer::load的调用栈:

输出log
journalctl
# 这样过滤的log不全:
journalctl -f WEBKIT_SUBSYSTEM=WPEWebKit WEBKIT_CHANNEL=Media
-- Logs begin at Mon 2021-12-27 19:51:37 CST. --
2月 11 09:54:05 hui WPEWebProcess[32009]: HTMLMediaElement::mediaPlayerPlaybackStateChanged(FE25312987F69B65) false
2月 11 09:54:05 hui WPEWebProcess[32009]: HTMLMediaElement::playInternal(FE25312987F69B65)
2月 11 09:54:05 hui WPEWebProcess[32009]: MediaElementSession::clientWillBeginPlayback(FE25312987F69B65) state = Playing
2月 11 09:54:05 hui WPEWebProcess[32009]: PlatformMediaSessionManager::setCurrentSession(0) (FE25312987F69B65)
2月 11 09:54:05 hui WPEWebProcess[32009]: PlatformMediaSessionManager::sessionWillBeginPlayback(0) (FE25312987F69B65) returning true
2月 11 09:54:05 hui WPEWebProcess[32009]: HTMLMediaElement::setAutoplayEventPlaybackState(FE25312987F69B65) StartedWithoutUserGesture
2月 11 09:54:05 hui WPEWebProcess[32009]: HTMLMediaElement::updatePlayState(FE25312987F69B65) shouldBePlaying = true, playerPaused = false
2月 11 09:54:05 hui WPEWebProcess[32009]: HTMLMediaElement::mediaPlayerVolumeChanged(FE25312987F69B65)
# webkit
export WEBKIT_DEBUG="Network=debug,Media=debug"
export WEBKIT_DEBUG="all"
# gstreamer
export GST_DEBUG="3,webkit*:6"
查看journalctl日志
journalctl -ef | grep -E "WPEWebProcess|WPENetworkProcess"
MediaSource的log输出:
WPEWebProcess[2883]: MediaSource::detachFromElement(0)
WPEWebProcess[2883]: MediaSource::onReadyStateChange(0) old state = open, new state = closed
WPEWebProcess[2883]: MediaSourcePrivateGStreamer::~MediaSourcePrivateGStreamer(20E2EA6F)
WPEWebProcess[2883]: MediaSource::onReadyStateChange(0) old state = closed, new state = open
WPEWebProcess[2883]: MediaSource::setDuration(0) 8656.959
WPEWebProcess[2883]: MediaSource::setDurationInternal(0) {
"value":8656.959}
WPEWebProcess[2883]: MediaSource::seekToTime(0) {
"value":130}
WPEWebProcess[2883]: MediaSource::completeSeek(0) {
"value":130}
WPEWebProcess[2883]: MediaSource::seekToTime(0) {
"value":130}
WPEWebProcess[2883]: MediaSource::completeSeek(0) {
"value":130}
SourceBuffer的log输出:
WPEWebProcess[2883]: SourceBuffer::SourceBuffer(62DF0001)
WPEWebProcess[2883]: SourceBuffer::SourceBuffer(62DF0002)
WPEWebProcess[2883]: SourceBuffer::~SourceBuffer(20E20002)
WPEWebProcess[2883]: SourceBuffer::~SourceBuffer(20E20001)
WPEWebProcess[2883]: SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment(62DF0001)
WPEWebProcess[2883]: SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment(62DF0002)
WPEWebProcess[2883]: SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment(62DF0002)
WPEWebProcess[2883]: SourceBuffer::seekToTime(62DF0001) {
"value":130}
WPEWebProcess[2883]: SourceBuffer::seekToTime(62DF0002) {
"value":130}
参考
边栏推荐
猜你喜欢
随机推荐
软件测试面试题:对 RUP,CMM,CMMI,XP,PSP,TSP 的认识?
[oops-framework] Template project [oops-game-kit] Introduction
FPGA learning column (xinlinx) serial communication -
思念家乡的月亮
Please talk about for...in and for...of in JS (below)
隐私计算融合应用研究
comp3331-9331-16s2-midterm复习
14.cuBLAS开发指南中文版--cuBLAS中的Level-1函数nrm2()和rot()
Tomca启动闪退问题如何解决
【oops-framework】模板项目【oops-game-kit】使用简介
络达开发---串口日志&日志过滤
sql 使用到where和groupby时到底怎么建立索引?
第二课第一周第4-6节 医学预后案例欣赏+作业解析
进程间通信(IPC)的分类以及通信方式的发展
Mysql_Note3
[Detailed explanation of C data storage] (1) - in-depth analysis of the storage of shaping data in memory
Future Trends in Vulnerability Management Programs
LitePal操作数据库
软件测试面试题:软件测试的过程的V模型,说出它的缺点?
js原型和原型链及原型继承
![【iframe父页面调用子页面的方法】踩坑:获取元素的时候需要用 `[x]`是关键,不能用`.eq(x)`否则获取不到。](/img/ec/0cca8c7011770429c34a6aa1f36460.png)
![Deep Learning [Chapter 2]](/img/09/5eb16731c3c47965da131c2aa0c2c3.png)






