Thank you for explaining this.

On 18/03/2013 17:25, Vyacheslav Egorov wrote:
This flag is not intended to be used by _javascript_ developers.

It is intended to be used by VM developers.

You need to use a native debugger like gdb (not V8's built-in debugger) or WinDBG (on Windows) to catch SIGTRAP and then you'll have to look at the disassembly and the memory state to figure out what is going on.

So unless you have deep understanding of V8 internals and proficient in reading assembly language this flag is useless. 

Vyacheslav Egorov


On Mon, Mar 18, 2013 at 5:19 PM, Nick Evans <nick.evans8...@gmail.com> wrote:
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.
 
 

--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to a topic in the Google Groups "v8-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-users/m08siuUhZCI/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
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