Skip to content

Hard to debug problem and and how to debug standard lib?  #477

Closed
@fxfactorial

Description

@fxfactorial

I have these basic bindings to reactjs and I'm getting a type error from which I can't figure out why its happening/where to look.

To reproduce, first need:
https://github.com/fxfactorial/runa, which you can pin opam pin add runa

(note the branch new_ideas)
and then https://github.com/fxfactorial/ocaml-reactjs/tree/new_ideas, and make debug should build the project, it assumes OS X but you can just open the index.html in example/tutorial/index.html.
This creates a button and clicking the button, things seems to work, the state is changed correctly, but then this type error comes up and I can't catch it with try/with

The problem gives this stack trace

stdlib.js:60 Uncaught TypeError: Cannot read property 'fun' of undefinedcaml_call_gen_U_ @ 
stdlib.js:60caml_call_gen_U_ @ stdlib.js:68(anonymous function) @ 
jslib_js_of_ocaml.js:96ReactErrorUtils.invokeGuardedCallback @ react.js:10670executeDispatch @ 
react.js:2913executeDispatchesInOrder @ react.js:2936executeDispatchesAndRelease @ 
react.js:2390executeDispatchesAndReleaseTopLevel @ react.js:2401forEachAccumulated @ 
react.js:16650EventPluginHub.processEventQueue @ react.js:2563runEventQueueInBatch @ 
react.js:10695ReactEventEmitterMixin.handleTopLevel @ react.js:10706handleTopLevelImpl @ 
react.js:10784Mixin.perform @ react.js:16116ReactDefaultBatchingStrategy.batchedUpdates @ 
react.js:9371batchedUpdates @ react.js:13845ReactEventListener.dispatchEvent @ react.js:10861

So something in react is calling my code.

and it blows up in stdlib.js on:

function caml_call_gen(f, args) {
// I want to put a debugger statement here
  if(f.fun)
    return caml_call_gen(f.fun, args);
  var n = f.length;
  var argsLen = args.length;
....

and as the comment mentions, I'm trying to put a debugger statement in there. I thought that putting the debugger in the ~/.opam/<the_switch>/lib/js_of_ocaml would work since it would link against the standard lib there, and I seemingly see it changed, with the debugger statement, in chrome dev tools for the file stdlib.js, but I don't get the breakpoint going on.

How can I debug this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions