Menu ▾ ▴

#1667 macOS / Apple silicon: crash fixes, a native arm64 build of 25.03, and a working LLDB (DAP) debugger, for review

Undefined
open
nobody
None
Patch
2026-11-20
2026-11-18
No

Hello Code::Blocks team,

I am a beginner C++ user on a MacBook Air with Apple silicon, running macOS 27.0.1. The official Code::Blocks 25.03 x64 .dmg did not work for me. It crashed on startup in the CodeCompletion plugin, it crashed on exit in wxSmith, and under Rosetta it could not compile anything (unable to load libxcrun). While working around this, I built 25.03 natively for arm64 from the release tarball and found a few small bugs on the way. I am sending everything for your review in the attached archive, codeblocks-25.03-macos-arm64-src.tar.gz.

What is in the archive

  1. Two small patches to Code::Blocks (patches/codeblocks-25.03-macos-fixes.patch, about 10 lines; applies cleanly to the 25.03 tarball):
    • src/src/main.cpp: on macOS, "Quit Code::Blocks" in the application menu and Cmd+Q use wxID_EXIT, which Code::Blocks does not handle. wxOSX then just calls ExitMainLoop(), so MainFrame::OnApplicationClose() never runs. As a result default.conf is not saved and plugins are not released. The patch binds wxID_EXIT to OnFileQuit under __WXOSX__. I confirmed the call path with a backtrace.
    • wxsresourcetreeitemdata.cpp: ~wxsResourceTree() clears the singleton before the base tree control deletes its items, so ~wxsResourceTreeItemData() dereferences NULL on exit. The patch adds a NULL check.
  2. A native arm64 build script (scripts/build_all.sh) that turns the release tarball into a self-contained, ad-hoc signed CodeBlocks.app. Two notes on the build system: configure does not check for Boost, which NassiShneiderman needs, and bundle.sh bundles only the wx libraries and does not sign the app.
  3. A working debugger on Apple silicon. GDB is not available there, and 25.03 ships only an empty dap_debugger folder. I used the third-party debugger_DAP plugin (originally by Andrew Cottrell, now at github.com/pecanh/debugger_DAP, GPL-3.0) with Apple's lldb-dap, and fixed five macOS problems in it:

    • free-port detection used the Linux-only ss command
    • the output panel was a wxDialog docked as a pane, and it was added hidden
    • the output panel was destroyed on the second debug run
    • function locals never appeared in the Watches window

    With these fixes, stepping, line breakpoints, locals in Watches and program output all work. The patch and the patched plugin source are included.

  4. Documentation (docs/): the original bug report with stack traces, build steps, test results and known limitations.

What I could not solve

  • The startup crash in ClassBrowser::SetParser happens only with the official x64 .dmg. I could not reproduce it in the native build, so I did not find its cause.
  • I tested the debugger only with a small console program (int locals, a loop, stdout). I did not test structs, STL containers, attaching to a process or memory views.

The macOS 27 crash reports and the Code::Blocks debug report are available if they would help.

I hope some of this is useful, especially the two small patches and maybe an official arm64 macOS build. I am happy to test anything on my machine.

Thank you for Code::Blocks!

Best regards,
Mladen Markovic

1 Attachments

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2026-11-19

    Small patches applied in [r14064], thank you.

     

    Related

    Commit: [r14064]

  • pecan

    pecan - 2026-11-20

    Re: debugger_dap. Thanks.
    I'm on the road right now but will attend to your patch as soon as possible.

     

Log in to post a comment.