I would like to use the --trap_on_deopt flag ("put a break point before 
deoptimizing") because it sounds like a way to pause the program in a 
debugger, inspect the local variables and hopefully understand why a 
function has been deoptimised. Unfortunately I cannot find any examples on 
the web of how this flag is used.

I had naively assumed it would just set a breakpoint when and where a 
function was deoptimised and invoke the debugger. Jakob and Yang have 
explained to me that it throws a SIGTRAP signal that needs to be caught 
(see link below). Unfortunately even with this knowledge I still cannot 
work out how to use this flag. All of the following commands result in 
"d8.exe has stopped working" without d8 printing anything:

[d8 3.17.11, built with Visual Studio 2010, Windows 7 x64]
d8 --trap_on_deopt
d8 --debugger --trap_on_deopt
d8 --trap_on_deopt test.js
d8 --debugger --trap_on_deopt test.js

d8 fails immediately even when it hasn't been passed a js file. d8 runs as 
expected when --trap_on_deopt is omitted.

I have had more success with Node.js:

[node-v0.10.0-x86.msi]
node --trace_deopt --trap_on_deopt test.js

The script will run up to the deopt but then quits to the OS, ignoring 
several nested catch...finally statements. Including the debug option 
yields:

node --trace_deopt --trap_on_deopt debug test.js
[deoptimize context: 671033d]
< debugger listening on port 5858
connecting... ok
break in test.js:1

before Node quits to the OS without running any of the script. Node runs as 
expected when --trap_on_deopt is omitted.

I had assumed that this behaviour and the absence of any examples on the 
web indicated an underused and buggy feature but apparently not 
(http://code.google.com/p/v8/issues/detail?id=2583&thanks=2583&ts=1363468366). 
If the exception is thrown by d8/Node to the OS, and not to my catches or 
the debugger, then I'm really confused about what this flag does and how it 
can be used properly.

I would be grateful if someone could provide an example of how to use 
--trap_on_deopt.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to