Chrome多进程调试
来源:互联网 发布:淘宝店铺彻底释放 编辑:程序博客网 时间:2024/06/05 04:52
Chrome的多进程模型给DEBUG带来了很大的挑战。
一、如果你设置代码的断点,默认情况下,VS只会跟踪那些在主进程Browser代码中的那些断点。VS提供了"Attach To Process"的方法。比如当Render Process启动之后,可以用菜单"Debug"=>"Attach To Process"选项,选择那个新产生的进程,然后在你需要跟踪的代码处设置断点,就可以。但是这种方法,只能在子进程启动之后,才比较有效,如果我们想在子进程启动时,跟踪某些代码的执行,就没有办法了。
二、针对这个Chrome从源代码级别提供了支持。共有两种方法:
1. 用启动选项“--single-process“,以单进程的方法来启动Chrome。发现这个方法不好用了已经
2.用启动选项"--renderer-startup-dialog"和"--no-sandbox"。两个选项将会让子进程在启动之后,弹出一个模态对话框。之后在关闭这个对话框之后才可以继续运行代码。在这期间,我们可以用上述"Attach To Process"的方法来跟踪子进程代码的执行。
之所以要加上"--no-sandbox",是因为默认情况下Chrome的子进程的创建和启动是在sanbox中(也就说访问系统资源是严格限制的),无法显示模态对话框UI。
Render进程的主函数如下:
- int RendererMain(const MainFunctionParams& parameters) {
- const CommandLine& parsed_command_line = parameters.command_line_;
- base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_;
- // This function allows pausing execution using the --renderer-startup-dialog
- // flag allowing us to attach a debugger.
- // Do not move this function down since that would mean we can't easily debug
- // whatever occurs before it.
- HandleRendererErrorTestParameters(parsed_command_line);
HandleRenderErrorTestParameters函数会显示这个模态对话框。
- // This function provides some ways to test crash and assertion handling
- // behavior of the renderer.
- static void HandleRendererErrorTestParameters(const CommandLine& command_line) {
- if (command_line.HasSwitch(switches::kWaitForDebugger))
- base::debug::WaitForDebugger(60, true);
- if (command_line.HasSwitch(switches::kRendererStartupDialog))
- ChildProcess::WaitForDebugger("Renderer");
- // This parameter causes an assertion.
- if (command_line.HasSwitch(switches::kRendererAssertTest)) {
- DCHECK(false);
- }
- }
转自:http://blog.csdn.net/leer168/article/details/8438149
0 0
- Chrome多进程调试
- Chrome多进程调试
- Chrome多进程调试
- Chrome多进程调试
- [Chrome源码阅读] Chrome的多进程调试方法
- Chrome 多进程架构
- chrome多进程结构翻译
- Chrome调试
- chrome调试
- Chrome调试
- Chrome调试
- chrome调试
- chrome 调试
- chrome调试
- gdb进程调试,多进程调试
- gdb 多进程调试
- gdb多进程调试
- linux多进程调试
- java环境变量中 用户变量与系统变量的区别
- varchar和Nvarchar区别
- 为什么营养保健品需要坚持用3-6个月才会达到明显效果呢?
- 利用JS弹出层实现简单的动态提示“正在加载中,请稍等...
- Codeforces #282 div 1 C Helping People 题解
- Chrome多进程调试
- Trie树的C++实现
- 石子合并问题 (朴素区间DP&&GarsiaWachs算法)
- Bootstrap入门Demo——制作路径导航栏
- 利用RMAN跨平台迁移数据库
- Global Financial Applications uses the following Public tables
- jQuery EasyUI API 中文文档 - DataGrid数据表格
- 全国省市级联数据sql语句 mysql版
- "HelloWorld"