Help debugging C?

    Jul 28 2019 | 4:33 pm
    I'm seeing that a decade ago, people were using the xcode debugger. Is there a current guide to this? I've been debugging using the crash reports from OSX. I don't know how to do xcode debugging if I can't "run" my object's code in xcode.

    • Aug 14 2019 | 1:57 pm
    • Aug 15 2019 | 3:34 pm
      Well xcode is still going strong, probably stronger than ever due to all the iOS development. You going to have to bite the bullet and find a mac, download xcode and install it. Then run your project in the debugger and see what it finds. You may be able to open the crash report in xcode and it might give you some useful information, but probably not much.
    • Aug 15 2019 | 10:14 pm
      A, I apologize for not being clear. I’m using Xcode already. I’m wondering about how to use the debugger given that the code is an extension. I can’t ”run” a max object in Xcode right?
    • Aug 16 2019 | 2:35 am
      you run Max as the 'debug executable':
      you get to that screen by opening the pop-up menu clicking on where it says "max-external>MyMac" in the above pic near the top left(then choose 'Edit Scheme...'), do all that and you'll see the above window drop down(this is where you edit your development/deployment scheme for building/running/testing). for the settings, i chose 'wait for executable to be launched' but i think you can also choose "automatically"... could probably choose either option for 'debug process as' too, i forget if there are any limitations imposed when not in the root... after that, you just hit the build/run/debug 'play' icon xcodethingamabob (my technical term for it), and if you chose "wait for executable..." XCode will say something like 'waiting to attach...' as it waits for you to launch Max with a patch that uses your external, once you do that within Max, XCode will then say something like "running..." and be able to provide debug info(all your XCode breakpoints will work, too, allowing you to pause execution and study the values of all your variables at specific samples, etc.)
      This is all if your initial build doesn't fail, if it does, then you can get debug info for that within XCode in the warnings tab(looks like a triangular hazard sign up near the top of the left panel..).
      Sorry if that's unclear, i can't remember where I learned this anymore(might be in an article on the site, or else Eric Lyon's book), but try what my pic above does, and it should work.
      Best of luck! 🍻
    • Aug 16 2019 | 4:04 am
      I cannot believe this is possible and I’ve been coding for years using the crash reports. Will give it a try soon.
      thank you raja. (And Anthony)
    • Aug 16 2019 | 5:40 am
      happy to help :)
      been coding for years using the crash reports
      i remember doing that... it felt very excruciating at times... you'll love the XCode debug features then.
      since i can't easily find/figure out how i learned it in the first place, made this video just for this thread's posterity :D... it shows navigating to all the settings and info, and then also shows breakpoints and mousing over variables to see their state/value:

      XCode Debugging Max

    • Aug 16 2019 | 11:48 am
      checking "launch automatically" works fine for me. also, in the 'arguments' tab you can enter "open /path/to/your/maxpatch" to let max automatically run your test-patch after launch.
    • Aug 16 2019 | 3:27 pm
      in the 'arguments' tab you can enter "open /path/to/your/maxpatch" to let max automatically run your test-patch
      👆Beautiful! I always wondered about that. Will help me immensely :) Thank you, Volker! 🙏 🙌 it works pretty easily too, here's a screenshot for any others to quickly find the 'arguments' tab and where to enter the info. there, i use a .maxhelp file to test my externals, but one could substitute a path to any patch they wanted:
    • Aug 17 2019 | 8:55 am
      This feels like being a god.
      (ok maybe being a god of a broken program but still)
    • Aug 17 2019 | 3:03 pm
      YES! 🙌 I'm so glad you got it working: you'll accelerate your learning about anything you're interested in programming exponentially now.. a smooth debugging experience allows you to focus more on learning programming concepts rather than trying to bandage code from unclear/incomprehensive guesswork. i hope they make this information more apparent/transparent in the SDK someday, it will help so many people all at once. 🤗
      (and yes to feeling exactly like a god, because if there IS any real god, they too are a god of broken programs, have you seen the shitstorm this world is in lately?? 😆 The-Great-Big-Dev-In-The-Sky needs to debug the bullshit of all this 'humanity' it created REAL quick 🤣)