How setup Debug for Plugin XCode and Database

Hi All,

Oops, I created this in the plug-in area and I think it’s better here.

Can someone please tell me the steps to debug a plugin created in XCode (trying with v6 and v9) so that when I attempt to debug in the 4D DB XCode will get called at the breakpoints I set.

The older Technotes have very different screenshots. So it’s a pick and hunt mystery.

For example in TN 4D Plug-in Developmemt Guide - Part 1, page 19 “Testing the plug-in” it says:

“…To do so, find the “Executables” in the Groups and Files pane and select “Add/New Custom Executable” from the context menu. … locate the appropriate 4D application.”

I cannot find any place this exists. I have no executable to click in my plugin. And no menu or build setting I can find.

Can someone help me by listing the steps to get into the testing state so I can debug from 4D?

Thanks,
John…

The “Executables” is your 4D.app; your plugin is just a DLL. Xcode starts in debugging mode 4D.app and steps into your code if you have set a breakpoint.

Hi Christian,

I have it setup correctly - as I had Rob L. create it for me - and it’s in XCOde and the 4D DB is open and I have break points setup…

But 4D just executes and…

So I must be setting something up incorrectly.

John…

Have you activated debug symbols?

[]22693690[/]

Hi Christian,

Here’s what mine looks like.

[]22693729;“Your comment here…”[/]

John…

There is no information about “Debug Information Format”.

And your running Scheme?
[]22693790[/]

Hi Christian,

How did you get that screen?

Menu: Product->Scheme -> Swiss Ephemeris Plugin

is selected.

John…

Hey Christian (et al),

Here’s a the Edit Scheme screen and it looks similar to yours.

[]22694118;“Your comment here…”[/]

Thanks,
John…

To all,

With help from Rob Laveau I was able to get it working on my newer MAcBook Pro. But not on my older Mac running OS 10.9.5.

All kinds of issues on Visual Studio 2015 as it seems it can’t find various “PDB” files?

I wish someone would write an updated technote with updated screenshots so it would be easier to get started.

I’m sure once the environment is setup correctly it’s smooth sailing.

Anyway, Thanks for the help Christian and Rob,
John…

Hi John and all,

What did Rob Laveau do to make it work? I have the same problem. It’s been more than 10 years since I programmed my last plugins. Back then, I could debug my plugins, but now it doesn’t work. Of course, the whole environment has changed since then.

All parameters seem ok, but when I start the “run process” in xCode, 4D doesn’t start automatically.

Here is the current environment:
osx: 10.15.2
xCode: 11.3
4D: 17.3

Best Regards,

Hi Serge,

I am far from skillful yet at the plugin environment. But I can get my version of XCode 9 (Mac OS 12.6) to open 4D and then from within 4D have the plugin call jump to a line of code in debugging mode in XCode.

It’s not that hard just have to make sure the settings are correct - at least in this version I am using. I cannot speak to later versions of XCode.

Please find attached a screenshot of my Debug Scheme.

[]33336277;“Your comment here…”[/]

The Build Configuration is for Development, Executable has been opened and linked to the version of the 4D v17 App my application will open with.

Let’s start there and see if that helps. I haven’t really messed with or looked at this after it was setup correctly. But I"d be willing to help if I can.

Email me and let me know. And be patient as I recall with time lags this took days to figure out.

John…

as a heads-up:

on Catalina, you need to add the "com.apple.security.get-task-allow“ entitlement to 4D, (see apple documentation for details) to debug a plugin in the context of a running 4D.

Can you, please, point me to the right Apple documentation?
I understand I can add “com.apple.security.get-task-allow” to my application, but I don’t know how to do that to signed & notarized 4D v18. I am on 10.14.6 and I can’t attach debugger to v18.

you should really take some time to study the code to see which command line tools are used and how,
but to get started, you can simply use this example (method: TEST)

specify the path at line #44 and run up to the first TRACE at line #220
at this point, the app is code signed.
the rest of the code is for notarisation, which is not relevant in this context.

you should avoid running the code on itself, i.e. use 17R6 or a nightly build to sign v18.

https://github.com/miyako/4d-utility-build-application

Thank you very much Miyako, it’s working fine!

IOW, 4D will not support plugin debugging on MacOS, do it yourself: remove the 4D signature, sign it with your own certificate… until Apple prohibits that signature removal…

(Before asking for the “right documentation”, I simply removed the signing to be able to debug on 10.14.6. And I will have to sign it on 10.15 once I will be able to use that version (not needing to create 32-bit plugins for older 4D versions.))