当前位置:网站首页>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}
参考
边栏推荐
猜你喜欢
Gaussian beam focused by thermal lens
JVM类加载机制
2022英伟达显卡排名天梯图
[Detailed explanation of C data storage] (1) - in-depth analysis of the storage of shaping data in memory
[oops-framework] Template project [oops-game-kit] Introduction
MySQL Basics [Part 1] | Database Overview and Data Preparation, Common Commands, Viewing Table Structure Steps
Alibaba 最新神作!耗时 182 天肝出来 1015 页分布式全栈手册太香了
Js prototype and prototype chain and prototype inheritance
联盛德W801系列6-从微信小程序的角度来分析W801的蓝牙通信源码(indicate方式)
惨遭面试官吊打高并发系统设计,回来学习 2400 小时后成功复仇
随机推荐
八.数据的存储
HPSO and multi-core LSSVM based network intrusion detection
Section 4-6 of the first week of the second lesson: Appreciation of medical prognosis cases + homework analysis
【C 数据存储详解】(1)——深度剖析整形数据在内存中的存储
软件测试面试题:谈谈你对 cmm 和 is9000 的认识?
如何实现FPGA的可重复性设计
数据的存储(下)——浮点型在内存中的存储
MySQL - 一条SQL在MySQL中是如何被执行的?
comp3331-9331-21t2-midterm复习
Flink二阶段提交
从键入网址到网页显示的详细过程
通过热透镜聚焦的高斯光束
花甲的思考
Deep Learning [Chapter 2]
How to realize the repeatable design of FPGA
Lianshengde W801 series 5-WeChat applet and W801 Bluetooth communication routine (read notes)
Shengxin experiment record (part2)--tf.reduce_sum() usage introduction
生信实验记录(part2)--tf.reduce_sum()用法介绍
Detailed explanation of the opkg of OpenWrt
漏洞管理计划的未来趋势