Debugging externals with Xcode–possible to automatically load test patch?

    Jan 21 2014 | 9:41 am
    Has anyone found a way to automate the process of debugging externals with Xcode so that the Max Runtime is started automatically by the "Run" action, with a test patch loaded and the Max runtime process connected to the debugger?
    I can launch the Max Runtime automatically by making it the Executable in the Run action of the build scheme, but there seems to be no way to automatically load a patch. I tried passing it as an argument to the runtime but this doesn't work.
    Has anyone managed to find a way around this?

    • Jan 21 2014 | 10:12 am
      hi jamie,
      with xcode3 you can add MaxRT as an executable, so that it launches on run and i guess you can do the same via the scheme settings in xcode4/5. Unfortunately i don't think it's possible to supply a .maxpat file as an argument on the command line (that would be very useful if anyone at C74 is listening)
    • Jan 21 2014 | 10:16 am
      Thanks Oli,
      I just edited my question to say that I'd managed to launch the runtime via the build scheme "Executable" setting, but your reply just beat me to it!
      +1 for the ability to pass a patch path to the runtime.
    • Jan 21 2014 | 10:23 am
      Actually... thinking about this a bit more, it needs more than just the path to the patch, it needs the path to the external being tested (or it needs to be in Max's path).
      For Pd externals in my Xcode scheme, I set the Executable to the path to the pd binary and then set the Arguments Passed On Launch list to:
      • -path ${BUILT_PRODUCTS_DIR}
      • -lib library_name
      • /path/to/test/patch.pd
      This means I can be debugging my external with a single keyboard shortcut.
      It would be great if the Max Runtime supported similar arguments.
    • Jan 21 2014 | 12:33 pm
      Ive only just started to do this... but what Ive done, is create a max project with my test patch in it, set it to use the external that is built by Xcode.
      then in Xcode, set executable in scheme to be max runtime add an argument that is my max project
      hit run... everything works as expected.
      p.s. i use project as you can specify search path for externals etc, whereas I cannot find a way to do this just with a patch. (the patch works passed as an argument, but cannot find the external - which is I assume the issue you are having?)
    • Jan 21 2014 | 7:09 pm
      Actually no, If I pass the path to my patch in "Arguments Passed on Launch" in Xcode, it just launches the Max RT, but doesn't load the patch.
      I'm using Max 5.0.5. Which version do you have? Maybe the ability to pass the path to a patch as an argument was added in Max 6?
    • Jan 21 2014 | 7:16 pm
      Yup, just confirmed this works with the Max 6 RT. I haven't used projects yet, but it sounds like that is the way to go.
    • Jan 21 2014 | 7:32 pm
      Ah... an alternative to using projects is to copy the external to the Max6 RT extensions folder in a Pre-actions script in the scheme settings. e.g.
      cp -rf ${BUILT_PRODUCTS_DIR}/.mxo /Applications/Max\ 6.1\ Runtime/Cycling\ \'74/extensions/
    • Jan 22 2014 | 11:06 am
      i find leaving the object binary in the same folder as the help patch is sufficient for it to be found on launch. I don't like putting half finished stuff in my max search path
    • Jan 22 2014 | 11:47 am
      In this instance, I'm developing a library so just copying the .mxo next to the test patch won't cut it.
      I do, however, have a Post-action deleting the the .mxo after the RT exits, as I agree, it's bad practice leaving these things around in non-temporary locations.