Module aliases are the encouraged way of grouping modules together. They have worked fine up until the point where I tried to use ocamldebug with them.

Module aliases allow development in the large, by permitting namespacing. I couldn't imagine building anything but a toy project with a few engineers with the restriction that no two files have the same basename! Module aliases to the rescue (thanks to Leo White for the suggestion). But, it seems that module aliases with namespacing make ocamldebug completely unusable. Here's a minimal repro case below. There are two simple namespaces each with a submodules in files named "test.ml". I am using module aliases to namespace them so that there are no collisions. Again, this works fine with everything except the debugger.

I hope I'm just doing something incorrect - if that is the case, I thank you in advance for your patience.

    # Compile project using module aliases

    mkdir ~/Desktop/testOne/
    mkdir ~/Desktop/testTwo/
    echo "let x () = print_string \"hello from test one\"" > ~/Desktop/testOne/test.ml
    echo "let x () = print_string \"hello from test two\"" > ~/Desktop/testTwo/test.ml
    echo "module Test = NamespaceOne_test" > ~/Desktop/testOne/namespaceOne.ml
    echo "module Test = NamespaceOne_test" > ~/Desktop/testOne/namespaceOne.mli
    echo "module Test = NamespaceTwo_test" > ~/Desktop/testTwo/namespaceTwo.ml
    echo "module Test = NamespaceTwo_test" > ~/Desktop/testTwo/namespaceTwo.mli
    echo 'NamespaceOne.Test.x (); NamespaceTwo.Test.x ()' > ~/Desktop/prog.ml

    # Generate namespaced module aliases
    ocamlc -g -c -no-alias-deps -w -49 -I ~/Desktop/testOne/ -o ~/Desktop/testOne/namespaceOne -intf ~/Desktop/testOne/namespaceOne.mli -o ~/Desktop/testOne/namespaceOne -impl ~/Desktop/testOne/namespaceOne.ml
    ocamlc -g -c -no-alias-deps -w -49 -I ~/Desktop/testTwo/ -o ~/Desktop/testTwo/namespaceTwo -intf ~/Desktop/testTwo/namespaceTwo.mli -o ~/Desktop/testTwo/namespaceTwo -impl ~/Desktop/testTwo/namespaceTwo.ml

    ocamlc -g -c -I ~/Desktop/testOne/ -open NamespaceOne -o ~/Desktop/testOne/namespaceOne_test -impl ~/Desktop/testOne/test.ml
    ocamlc -g -c -I ~/Desktop/testTwo/ -open NamespaceTwo -o ~/Desktop/testTwo/namespaceTwo_test -impl ~/Desktop/testTwo/test.ml
    ocamlc -g -c -I ~/Desktop -I ~/Desktop/testOne/ -I ~/Desktop/testTwo/ -o ~/Desktop/prog.cmo -impl ~/Desktop/prog.ml

    ocamlc -g -I ~/Desktop/testTwo/ -I ~/Desktop/testOne/ ~/Desktop/testOne/namespaceOne.cmo ~/Desktop/testTwo/namespaceTwo.cmo ~/Desktop/testOne/namespaceOne_test.cmo ~/Desktop/testTwo/namespaceTwo_test.cmo ~/Desktop/prog.cmo -o ~/Desktop/prog.out


    # Start ocamldebug

    ocamldebug ~/Desktop/prog.out

    # Run these commands inside of ocamldebug

    directory ~/Desktop/
    directory ~/Desktop/testOne/
    directory ~/Desktop/testTwo/

    # This doesn't work but that makes sense - there aren't any modules named
    # "Test", there's one named NamespaceOne_test and one named
    # NamespaceTwo_test.

    break @Test 1

    # But - neither of the namespaced modules work either!
    # -----------------------------------------------------------------------

    break @NamespaceOne_test 1
    break @NamespaceTwo_test 1




Here is proof that ocamldebug works correctly without namespacing/module aliases:


# Working project without module aliases:

    mkdir ~/Desktop/testOne/
    mkdir ~/Desktop/testTwo/
    echo "let x () = print_string \"hello from test one\"" > ~/Desktop/testOne/testOneNamespaceNotNeeded.ml
    echo "let x () = print_string \"hello from test two\"" > ~/Desktop/testTwo/testTwoNamespaceNotNeeded.ml
    echo 'TestOneNamespaceNotNeeded.x (); TestTwoNamespaceNotNeeded.x ()' > ~/Desktop/prog.ml

    ocamlc -g -c -I ~/Desktop/testOne/ -o ~/Desktop/testOne/testOneNamespaceNotNeeded -impl ~/Desktop/testOne/testOneNamespaceNotNeeded.ml
    ocamlc -g -c -I ~/Desktop/testTwo/ -o ~/Desktop/testTwo/testTwoNamespaceNotNeeded -impl ~/Desktop/testTwo/testTwoNamespaceNotNeeded.ml
    ocamlc -g -c -I ~/Desktop -I ~/Desktop/testOne/ -I ~/Desktop/testTwo/ -o ~/Desktop/prog.cmo -impl ~/Desktop/prog.ml

    ocamlc -g -I ~/Desktop/testTwo/ -I ~/Desktop/testOne/  ~/Desktop/testOne/testOneNamespaceNotNeeded.cmo ~/Desktop/testTwo/testTwoNamespaceNotNeeded.cmo ~/Desktop/prog.cmo -o ~/Desktop/prog.out

    ocamldebug ~/Desktop/prog.out

    # Run these commands inside of ocamldebug. Working correctly.
    directory ~/Desktop/
    directory ~/Desktop/testOne/
    directory ~/Desktop/testTwo/
    break @TestOneNamespaceNotNeeded 1