Hi,
I also want to trace javascript function calls inside of chromium (V8). I am using the --trace flag as suggested. However, it does not trace "native" function calls.
Example:
I have the following simple website:
<html>
<head></head>
<body>
<h1> A simple test script</h1>
<div id="thediv"></div>
<script>
function foo(var0){
return(bar(var0.concat(" World!")));
}
function bar(var1){
return(bar2(var1));
}
function bar2(var1){
return(var1);
}
var ret = foo("Hello");
console.log(ret);
alert(document.getElementById("thediv"));
</script></body></html>
When I open it in headless chromium I get the following tracing information:
1: ~+0(this=0x191cc7a940b9 <JSGlobal Object>) {
2: ~foo+0(this=0x191cc7a940b9 <JSGlobal Object>, 0x3946ed57cd59 <String[5]: Hello>) {
3: ~bar+0(this=0x191cc7a940b9 <JSGlobal Object>, 0x191cc7af20d9 <String[12]: Hello World!>) {
4: ~bar2+0(this=0x191cc7a940b9 <JSGlobal Object>, 0x191cc7af20d9 <String[12]: Hello World!>) {
4: } -> 0x191cc7af20d9 <String[12]: Hello World!>
3: } -> 0x191cc7af20d9 <String[12]: Hello World!>
2: } -> 0x191cc7af20d9 <String[12]: Hello World!>
Functions like concat(), getElementById(), or log() are not traced. I checked the source code of traceEnter and traceExit (Line 825 and below) but native functions are not traced by those. Can anyone give me some advice what I have to do to trace intrinsic functions
or other function calls (e.g., functions defined in the ECMA specification or browser speficic APIs) within chromium.
Any help is appriciated!
Cheers,
Tobias
TraceEnter implementation
RUNTIME_FUNCTION(Runtime_TraceEnter) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
PrintIndentation(isolate);
JavaScriptFrame::PrintTop(isolate, stdout, true, false);
PrintF(" {\n");
return isolate->heap()->undefined_value();
}