当前位置:网站首页>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}
参考
边栏推荐
- MySQL - an SQL in MySQL is how to be performed?
- nvidia-smi:控制你的 GPU
- 阿里的数据同步神器——Canal
- MySQL中的DDL常规操作总结
- 【oops-framework】模板项目【oops-game-kit】使用简介
- install dlib library
- mysql 死锁 Deadlock found when trying to get lock; try restarting transaction
- Ora - 00001 in violation of the only constraint
- [Detailed explanation of C data storage] (1) - in-depth analysis of the storage of shaping data in memory
- 软件测试面试题:什么是数据的对立性,有几个层次?
猜你喜欢

ARM开发(四)新手小白如何阅读芯片手册,裸机驱动开发步骤以及纯汇编实现点灯,汇编结合c点灯,c实现点灯
![【iframe父页面调用子页面的方法】踩坑:获取元素的时候需要用 `[x]`是关键,不能用`.eq(x)`否则获取不到。](/img/ec/0cca8c7011770429c34a6aa1f36460.png)
【iframe父页面调用子页面的方法】踩坑:获取元素的时候需要用 `[x]`是关键,不能用`.eq(x)`否则获取不到。

Lianshengde W801 series 5-WeChat applet and W801 Bluetooth communication routine (read notes)

想进阿里?先来搞懂一下分布式事务

Deep Learning【第二章】

阿里的数据同步神器——Canal

Oops novice template Framework project guide

The latest domestic power supply manufacturers and pin-to-pin replacement manuals for specific models are released
![划分字母区间[贪心->空间换时间->数组hash优化]](/img/bb/e750c7cd4a80e767bd64d96ffc2ce3.png)
划分字母区间[贪心->空间换时间->数组hash优化]

FPGA learning column (xinlinx) serial communication -
随机推荐
《QA离业务代码能有多近?》轻量级单元测试方案
ARM development (4) How to read the chip manual for novice Xiaobai, bare metal driver development steps and pure assembly to achieve lighting, assembly combined with c lighting, c to achieve lighting
[oops-framework] Template project [oops-game-kit] Introduction
Deep Learning [Chapter 2]
联盛德W801系列6-从微信小程序的角度来分析W801的蓝牙通信源码(indicate方式)
Section 4-6 of the first week of the second lesson: Appreciation of medical prognosis cases + homework analysis
Inter-process communication method (2) Named pipe
两日总结十
软件测试面试题:I P协议、RARP协议、ICMP协议与ARP协议的功能是什么?
数据库数据采集利器FlinkCDC
【备战“金九银十”】2022年软件测试面试题最新汇总
Geogebra 教程之 04 Geogebra 小程序
The classification of inter-process communication (IPC) and the development of communication methods
软件测试面试题:性能测试工作?
MySQL基础篇【第一篇】| 数据库概述及数据准备、常用命令、查看表结构步骤
【iframe父页面调用子页面的方法】踩坑:获取元素的时候需要用 `[x]`是关键,不能用`.eq(x)`否则获取不到。
C# WebBrower1控件可编辑模式保存时会提示“该文档已被修改,是否保存修改结果”
117. 本地开发好的 SAP UI5 应用部署到 ABAP 服务器时,中文字符变成乱码的原因分析和解决方案
ora-00001违反唯一约束
单面PCB布线阻抗的工程设计