日期:2014-05-16 浏览次数:20445 次
webkit关于gdb的wiki:http://trac.webkit.org/wiki/GDB
它是自带了gdb和lldb的python脚本的,路径分别在
webkit workingcopy/Tools/gdb/webkit.py 直接看脚本内容http://trac.webkit.org/browser/trunk/Tools/gdb/webkit.py
webkit workingcopy/Tools/lldb/lldb_webkit.py 直接看脚本内容http://trac.webkit.org/browser/trunk/Tools/lldb/lldb_webkit.py
配置lldb初始化时加载python脚本:
1. 当然是checkout出lldb_webkit.py这个文件了,也可直接下载http://trac.webkit.org/export/147046/trunk/Tools/lldb/lldb_webkit.py,放在什么地方都行,现举例是放在用户目录下, 即 ~/
2. 在用户目录下新建文件,命名为“.lldbinit”,注意前面有个点符号哦。
3. .lldbinit的内容为:
command script import ~/lldb_webkit.py4. 如果已打开,重启xcode
从脚本内容看,支持查看:
xcode只有lldb支持了python,所以以下的截图都是lldb的。
这是测试代码:
Vector<String> v; v.append("hello"); v.append("world"); HashMap<String, String> map; map.set("h", "hello"); map.set("w", "world"); AtomicString as = "thanks";这是xcode的可视化调试窗口的效果:
这是terminal的p功能:
(lldb) p v (WTF::Vector<WTF::String, 0>) $0 = { size = 2, capacity = 16 } { (WTF::String) [0] = { length = 5, contents = 'hello' } { (WTF::RefPtr<WTF::StringImpl>) m_impl = { (WTF::StringImpl *) m_ptr = 0x000000010a45a7d0 { length = 5, is8bit = 1, contents = 'hello' } } } (WTF::String) [1] = { length = 5, contents = 'world' } { (WTF::RefPtr<WTF::StringImpl>) m_impl = { (WTF::StringImpl *) m_ptr = 0x000000010a45ad80 { length = 5, is8bit = 1, contents = 'world' } } } (size_t) m_size = 2 (WTF::Vector<WTF::String, 0>::Buffer) m_buffer = { (WTF::VectorBufferBase<WTF::String>) WTF::VectorBufferBase<WTF::String> = { (WTF::String *) m_buffer = 0x000000010a45ae50 { length = 5, contents = 'hello' } (size_t) m_capacity = 16 } } } (lldb) p as (WTF::AtomicString) $1 = { length = 6, contents = 'thanks' } { (WTF::String) m_string = { length = 6, contents = 'thanks' } { (WTF::RefPtr<WTF::StringImpl>) m_impl = { (WTF::StringImpl *) m_ptr = 0x000000010a45b0b0 { length = 6, is8bit = 1, contents = 'thanks' } } } } (lldb) p map (WTF::HashMap<WTF::String, WTF::String, WTF::StringHash, WTF::HashTraits<WTF::String>, WTF::HashTraits<WTF::String> >) $2 = { (WTF::HashMap<WTF::String, WTF::String, WTF::StringHash, WTF::HashTraits<WTF::String>, WTF::HashTraits<WTF::String> >::HashTableType) m_impl = { tableSize = 8, keyCount = 2 } { (WTF::String) [0] = { length = 0, contents = '' } { (WTF::RefPtr<WTF::StringImpl>) m_impl = { (WTF::StringImpl *) m_ptr = 0x0000000000000000 { length = 0, is8bit = 0, contents = '' } } } (WTF::String) [1] = { length = 0, contents = '' } { (WTF::RefPtr<WTF::StringImpl>) m_impl = { (WTF::StringImpl *) m_ptr = 0x0000000000000000 { length = 0, is8bit = 0, contents = '' } } } (WTF::String) [2] = { length = 0, contents = '' } { (WTF::RefPtr<WTF::StringImpl>) m_impl = { (WTF::StringImpl *) m_ptr = 0x0000000000000000 { length = 0, is8bit = 0, contents = '' } } }