Skip to content

Commit 9d4243f

Browse files
committed
Prefer LLDB local launch delegates on macOS AArch64
The GDB local launch delegates that are preferred for other hosts are not useful on macOS AArch64.
1 parent cf74c35 commit 9d4243f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true
5-
Bundle-Version: 9.0.100.qualifier
5+
Bundle-Version: 9.0.200.qualifier
66
Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin

debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2004, 2012 QNX Software Systems and others.
2+
* Copyright (c) 2004, 2025 QNX Software Systems and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,6 +12,7 @@
1212
* QNX Software Systems - Initial API and implementation
1313
* Ken Ryall (Nokia) - Support for breakpoint actions (bug 118308)
1414
* Sergey Prigogin (Google)
15+
* John Dallaway - Prefer LLDB local debug delegates on macOS AArch64 (#1175)
1516
*******************************************************************************/
1617
package org.eclipse.cdt.debug.core;
1718

@@ -93,6 +94,10 @@ public class CDebugCorePlugin extends Plugin {
9394
public static final String BREAKPOINT_EXTENSION_EXTENSION_POINT_ID = "BreakpointExtension"; //$NON-NLS-1$
9495
public static final String BREAKPOINT_EXTENSION_ELEMENT = "breakpointExtension"; //$NON-NLS-1$
9596

97+
// The preferred launch delegates for local debug sessions on macOS AArch64
98+
private static final String PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE_MACOSX_AARCH64 = "org.eclipse.cdt.llvm.dsf.lldb.launch.attachCLaunch"; //$NON-NLS-1$
99+
private static final String PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE_MACOSX_AARCH64 = "org.eclipse.cdt.llvm.dsf.lldb.launch.localCLaunch"; //$NON-NLS-1$
100+
96101
/**
97102
* Dummy source lookup director needed to manage common source containers.
98103
*/
@@ -358,17 +363,22 @@ private void setDefaultLaunchDelegates() {
358363
// Set the default launch delegates as early as possible, and do it only once (Bug 312997)
359364
ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager();
360365

366+
final boolean isPlatformMacosxAarch64 = Platform.OS_MACOSX.equals(Platform.getOS())
367+
&& Platform.ARCH_AARCH64.equals(Platform.getOSArch());
368+
361369
HashSet<String> debugSet = new HashSet<>();
362370
debugSet.add(ILaunchManager.DEBUG_MODE);
363371

364372
ILaunchConfigurationType localCfg = launchMgr
365373
.getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP);
366374
try {
367375
if (localCfg.getPreferredDelegate(debugSet) == null) {
376+
String preferredLocalDelegate = isPlatformMacosxAarch64
377+
? PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE_MACOSX_AARCH64
378+
: ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE;
368379
ILaunchDelegate[] delegates = localCfg.getDelegates(debugSet);
369380
for (ILaunchDelegate delegate : delegates) {
370-
if (ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE
371-
.equals(delegate.getId())) {
381+
if (preferredLocalDelegate.equals(delegate.getId())) {
372382
localCfg.setPreferredDelegate(debugSet, delegate);
373383
break;
374384
}
@@ -397,10 +407,12 @@ private void setDefaultLaunchDelegates() {
397407
.getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH);
398408
try {
399409
if (attachCfg.getPreferredDelegate(debugSet) == null) {
410+
String preferredAttachDelegate = isPlatformMacosxAarch64
411+
? PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE_MACOSX_AARCH64
412+
: ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE;
400413
ILaunchDelegate[] delegates = attachCfg.getDelegates(debugSet);
401414
for (ILaunchDelegate delegate : delegates) {
402-
if (ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE
403-
.equals(delegate.getId())) {
415+
if (preferredAttachDelegate.equals(delegate.getId())) {
404416
attachCfg.setPreferredDelegate(debugSet, delegate);
405417
break;
406418
}

0 commit comments

Comments
 (0)