1.输出各阶段的asm
1 | /Tools/Scripts/run-jsc <arg> /path/to/jsfile &> ~/out |
其中arg可以为
1 | JSC_dumpDisassembly = true 转储所有JIT编译函数的反汇编。 |
一例
1 | ./Tools/Scripts/run-jsc --JSC_dumpDisassembly=true --JSC_dumpDFGDisassembly=true --JSC_dumpFTLDisassembly=true --JSC_dumpSourceAtDFGTime=true --JSC_dumpBytecodeAtDFGTime=true --JSC_dumpGraphAfterParsing=true --JSC_dumpGraphAtEachPhase=true /home/r00t/workspace/poc3.js &> ~/log |
2.lldb输出崩溃信息
1 | bugreport unwind -outfile </path/to/logfile> |
也可以在lldb shell里使用log enable,语法
1 | log enable <cmd-options> <log-channel> <log-category> [<log-category> [...]] |
一例
1 | log enable lldb all -f ~/test |
3.js代码断点(类似v8的%SystemBreak();)
1 | b arrayProtoFuncSlice |
在js代码中调用
1 | Array.prototype.slice([]); |