Author Topic: Unable to debug on macOS  (Read 2403 times)

rjpontefract

  • Senior Community Member
  • Posts: 257
  • Hero Points: 10
Unable to debug on macOS
« on: November 14, 2024, 08:51:28 PM »
Running SE 29 on macOS 15.1 on ARM.

I used to be able to debug single file projects written in C/C++ using LLDB.  I tried to use this today and the debugger starts, the application runs but no breakpoints are hit.  I tried it with a single file project and with a larger project with a workspace and neither works.  I tried using a clean configuration which made no difference.  LLDB works fine from the command line, as does debugging using LLDB in VSCode.

Any help would be appreciated.

rjpontefract

  • Senior Community Member
  • Posts: 257
  • Hero Points: 10
Re: Unable to debug on macOS
« Reply #1 on: November 18, 2024, 10:36:13 PM »
Well that's disappointing, I at least expected some sort of suggestion of things to try.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Unable to debug on macOS
« Reply #2 on: November 26, 2024, 10:30:17 PM »
Here's the fix for getting SlickEdit's LLDB debugging working on Sequoia with Xcode 16 (clang 16):
 
* Open your SlickEdit LLDB Workspace/Project
* Go to Project>Properties
* Select the Tools Tab
* Select the Compile tool
* Select the "Debug" configuration
* Click on "Options..."
* Select the Compile tab
* Set "Other Options:" to -fdebug-default-version=4
* Press OK on the clang++ Options dialog
* Press OK on the Project Properties dialog
* Rebuild or Build your application

rjpontefract

  • Senior Community Member
  • Posts: 257
  • Hero Points: 10
Re: Unable to debug on macOS
« Reply #3 on: November 26, 2024, 10:56:58 PM »
Thank you, it's very much appreciated.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Unable to debug on macOS
« Reply #4 on: November 27, 2024, 01:48:36 AM »
A hot fix is available for this (hot fix 1 for v29). The hot fix automatically adds this clang compiler option if necessary.

You can download the hot fix from here:

https://www.slickedit.com/hotfixes

Then load the hot fix: Help>Product Updates>Load Hot Fix...

Build or Rebuid your application after loading the hot fix and restarting SlickEdit.

PaulElliott

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
Re: Unable to debug on macOS
« Reply #5 on: February 05, 2025, 05:30:14 PM »
Hi all,
The above manual instructions do not seem to work for me (debug breakpoints still don't catch) on v28. Is this to be expected, and we have to upgrade to v29 to fix?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Unable to debug on macOS
« Reply #6 on: February 05, 2025, 05:58:28 PM »
Hi all,
The above manual instructions do not seem to work for me (debug breakpoints still don't catch) on v28. Is this to be expected, and we have to upgrade to v29 to fix?
Make sure you clear out the following setting:

Tools>Options>Debugging>General>Debug Server executable

Restart SlickEdit before trying to debug.

PaulElliott

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
Re: Unable to debug on macOS
« Reply #7 on: February 06, 2025, 12:43:10 PM »
Make sure you clear out the following setting:
Tools>Options>Debugging>General>Debug Server executable
Restart SlickEdit before trying to debug.

Hi Clark, definitely done that, I wasn't even able to start debugging until that was done, and that definitely fixes that, many thanks with your help catching that.

Now when I start debugging, the executable just runs straight through and no breakpoints catch. I have followed the instructions above on the clang project, checked that -fdebug-default-version=4 is definitely included on the build command line, however no breakpoints set in the editor are caught, the same symptoms as described in the initial post.

The only major difference here is that I am running v28 (hence no hot fix, so using the manual instructions). My question therefore, is whether or not this fix is expected to work in v28 with apple clang 16, or whether upgrading to v29 is required here.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Unable to debug on macOS
« Reply #8 on: February 06, 2025, 11:25:01 PM »
Upgrading to v29 shouldn't be required. The only change in v29 is automation for adding the extra compile option.

Make sure you build the Debug config and not Release. Build>Set Active Configuration

Debug won't work in a Release config


PaulElliott

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
Re: Unable to debug on macOS
« Reply #9 on: February 07, 2025, 12:01:53 AM »
Yep, definitely building debug, like I say, I can see the option on the build command line.

Only major difference then is I am running 15.2, but its still Apple clang version 16.0.0 (clang-1600.0.26.6) - I'm not entirely sure there was an upgrade.

Looks like I need to do some elf Mach-O analysis in the morning. Any hints and tips on this would be greatly appreciated, I know my way around an elf file, but but new on Mach-O.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Unable to debug on macOS
« Reply #10 on: February 07, 2025, 01:48:26 AM »
Have you tried debugging with the clang sample?

Project>All Workspaces>Sample Workspaces>clang.vpw

PaulElliott

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
Re: Unable to debug on macOS
« Reply #11 on: February 07, 2025, 04:26:57 PM »
This was with the clang workspace, my other projects are too complex for simple tests / built externally.

This was extremely curious. It didn't work until I started messing around with dsymutil on clang_prog, trying to ascertain what debug version it was using. At some point during this, breakpoints started catching again. I have since tried to break this by removing the files that this produces, but to no avail. For now, I will just take the win I think.

I will report back if I can find anything more on this, given many of my projects are being built externally with cmake, this is still something of an issue which won't get resolved with the hotfix either.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 7041
  • Hero Points: 535
Re: Unable to debug on macOS
« Reply #12 on: February 07, 2025, 08:02:54 PM »
glad this works for you.

v30 there will have support for CMake's new file API. It's really good. Much better and more convenient that the old cmake support. Although you will have to manually change the compiler options if you want to be able to debug on macOS. No way to automate that.
« Last Edit: February 07, 2025, 08:27:25 PM by Clark »

rjpontefract

  • Senior Community Member
  • Posts: 257
  • Hero Points: 10
Re: Unable to debug on macOS
« Reply #13 on: February 24, 2025, 01:31:40 AM »
There seems to be an issue on macOS where existing breakpoints don't work when a file is restored after restarting SE.  If I remove and re-add a breakpoint it works as expected.