1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-18 14:35:23 +02:00

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.
This commit is contained in:
John Dallaway 2025-07-01 09:32:14 +01:00
parent cf74c35e5b
commit 9d4243f219
2 changed files with 18 additions and 6 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true
Bundle-Version: 9.0.100.qualifier Bundle-Version: 9.0.200.qualifier
Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2012 QNX Software Systems and others. * Copyright (c) 2004, 2025 QNX Software Systems and others.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0 * are made available under the terms of the Eclipse Public License 2.0
@ -12,6 +12,7 @@
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Ken Ryall (Nokia) - Support for breakpoint actions (bug 118308) * Ken Ryall (Nokia) - Support for breakpoint actions (bug 118308)
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
* John Dallaway - Prefer LLDB local debug delegates on macOS AArch64 (#1175)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.core; package org.eclipse.cdt.debug.core;
@ -93,6 +94,10 @@ public class CDebugCorePlugin extends Plugin {
public static final String BREAKPOINT_EXTENSION_EXTENSION_POINT_ID = "BreakpointExtension"; //$NON-NLS-1$ public static final String BREAKPOINT_EXTENSION_EXTENSION_POINT_ID = "BreakpointExtension"; //$NON-NLS-1$
public static final String BREAKPOINT_EXTENSION_ELEMENT = "breakpointExtension"; //$NON-NLS-1$ public static final String BREAKPOINT_EXTENSION_ELEMENT = "breakpointExtension"; //$NON-NLS-1$
// The preferred launch delegates for local debug sessions on macOS AArch64
private static final String PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE_MACOSX_AARCH64 = "org.eclipse.cdt.llvm.dsf.lldb.launch.attachCLaunch"; //$NON-NLS-1$
private static final String PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE_MACOSX_AARCH64 = "org.eclipse.cdt.llvm.dsf.lldb.launch.localCLaunch"; //$NON-NLS-1$
/** /**
* Dummy source lookup director needed to manage common source containers. * Dummy source lookup director needed to manage common source containers.
*/ */
@ -358,6 +363,9 @@ public class CDebugCorePlugin extends Plugin {
// Set the default launch delegates as early as possible, and do it only once (Bug 312997) // Set the default launch delegates as early as possible, and do it only once (Bug 312997)
ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager(); ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager();
final boolean isPlatformMacosxAarch64 = Platform.OS_MACOSX.equals(Platform.getOS())
&& Platform.ARCH_AARCH64.equals(Platform.getOSArch());
HashSet<String> debugSet = new HashSet<>(); HashSet<String> debugSet = new HashSet<>();
debugSet.add(ILaunchManager.DEBUG_MODE); debugSet.add(ILaunchManager.DEBUG_MODE);
@ -365,10 +373,12 @@ public class CDebugCorePlugin extends Plugin {
.getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP); .getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP);
try { try {
if (localCfg.getPreferredDelegate(debugSet) == null) { if (localCfg.getPreferredDelegate(debugSet) == null) {
String preferredLocalDelegate = isPlatformMacosxAarch64
? PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE_MACOSX_AARCH64
: ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE;
ILaunchDelegate[] delegates = localCfg.getDelegates(debugSet); ILaunchDelegate[] delegates = localCfg.getDelegates(debugSet);
for (ILaunchDelegate delegate : delegates) { for (ILaunchDelegate delegate : delegates) {
if (ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_LOCAL_LAUNCH_DELEGATE if (preferredLocalDelegate.equals(delegate.getId())) {
.equals(delegate.getId())) {
localCfg.setPreferredDelegate(debugSet, delegate); localCfg.setPreferredDelegate(debugSet, delegate);
break; break;
} }
@ -397,10 +407,12 @@ public class CDebugCorePlugin extends Plugin {
.getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH); .getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH);
try { try {
if (attachCfg.getPreferredDelegate(debugSet) == null) { if (attachCfg.getPreferredDelegate(debugSet) == null) {
String preferredAttachDelegate = isPlatformMacosxAarch64
? PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE_MACOSX_AARCH64
: ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE;
ILaunchDelegate[] delegates = attachCfg.getDelegates(debugSet); ILaunchDelegate[] delegates = attachCfg.getDelegates(debugSet);
for (ILaunchDelegate delegate : delegates) { for (ILaunchDelegate delegate : delegates) {
if (ICDTLaunchConfigurationConstants.PREFERRED_DEBUG_ATTACH_LAUNCH_DELEGATE if (preferredAttachDelegate.equals(delegate.getId())) {
.equals(delegate.getId())) {
attachCfg.setPreferredDelegate(debugSet, delegate); attachCfg.setPreferredDelegate(debugSet, delegate);
break; break;
} }