node breaks --expose-debug-as #5165

Closed
bnoordhuis opened this Issue Mar 28, 2013 · 2 comments

Projects

None yet

1 participant

@bnoordhuis
Member

I'm not sure what's causing it but it works in d8 and it doesn't in node.

$ cat tmp/test.js 
// Flags: --expose-debug-as=debug

Debug = debug.Debug;
Debug.setListener(typeof print === 'function' && print || console.log);

function f() {
  x = 42;
}

Debug.setBreakPoint(f, 0, 0);
f();

$ deps/v8/out/x64.debug/d8 --expose-debug-as=debug tmp/test.js
1 [object Object] [object Object] undefined

$ out/Debug/node --expose-debug-as=debug tmp/test.js
# <no output>

The debug object is there but the breakpoint never hits. Works in v0.8, broken in v0.10 and master.

@bnoordhuis bnoordhuis was assigned Mar 28, 2013
@bnoordhuis
Member

It works with --expose-debug-as v8debug - there's a hack in lib/module.js that checks for that object and adjusts accordingly...

EDIT: Turns out that's not it. It's a timing issue in V8 itself. It works when you insert a 1 ms delay before the call to Debug.setBreakPoint().

@bnoordhuis
Member

Closing, works reliably in master now provided you name it v8debug. Not sure if it was fixed in V8 or through something on our side and I don't feel like running git bisect over seven months of development history.

$ out/Release/node --expose-debug-as=v8debug tmp/issue5165.js
1 { break_id: 2, selected_frame: 0 } { exec_state_: { break_id: 2, selected_frame: 0 },
  break_points_hit_: 
   [ { source_position_: 205,
       script_break_point_: [Object],
       hit_count_: 1,
       active_: true,
       condition_: null,
       ignoreCount_: 0,
       actual_location: [Object] } ] } undefined
@bnoordhuis bnoordhuis closed this Oct 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment